Vaibhav's Blog Space

Guassian Blur Example JavaFX

Saturday Sep 06, 2008

This is one simulation of Golden Eyes :-D(with an ugly face). I tried to make one use of Gaussian Blur which is applied in the white color of eyes. Adding this spot in the eyes gives a real simulation.

Here is the simple code :

package eyes;

import javafx.application.Frame;
import javafx.application.Stage;
import javafx.scene.geometry.Arc;
import javafx.scene.geometry.*;
import javafx.scene.paint.Color;
import javafx.scene.paint.*;
import javafx.scene.effect.*;

var y: Number = 150;
Frame {
    title: "Golden Eyes"
    width: 500
    height: 500
    closeAction: function() { java.lang.System.exit( 0 ); 
    }
    visible: true

    stage: Stage {
        fill: Color.GRAY;
        content: [  
 
            Circle {
                centerX: 160, centerY: y
                radius: 23
                fill: LinearGradient {
                    startX: 0.0
                    startY: 0.0
                    endX: 1.0
                    endY: 0.0
                    proportional: true
                    stops: [
                        Stop { offset: 0.0 color: Color.GOLD },
                        Stop { offset: 1.0 color: Color.BLACK }
                    ]
                }
                opacity: 0.9
            },
 
            Circle {
                centerX: 160, centerY: y
                radius: 10
                fill: Color.BLACK
            },
            Circle {
                centerX: 166, centerY: y - 5
                radius: 5
                fill: Color.WHITE;
                effect : GaussianBlur {
                    radius: 6
                }
            },
            Circle {
                centerX: 250, centerY: y
                radius: 23
                fill: LinearGradient {
                    startX: 0.0
                    startY: 0.0
                    endX: 1.0
                    endY: 0.0
                    proportional: true
                    stops: [
                        Stop { offset: 0.0 color: Color.BLACK },
                        Stop { offset: 1.0 color: Color.GOLD }
                    ]
                }
                opacity: 0.2
            },
 
 
            Circle {
                centerX: 250, centerY: y
                radius: 10
                fill: Color.BLACK
            },
            Circle {
                centerX: 244, centerY: y - 5
                radius: 5
                fill: Color.WHITE;
                effect : GaussianBlur {
                    radius: 6
                }
            },
            Circle {
                centerX: 200, centerY: 180
                radius: 100
                fill: Color.SIENNA
                opacity: 0.1
 
            },
            Polyline { 
             stroke:Color.BLACK
                points: [
                    200,160, 
                    220.0,220.0,
                    180.0,220.0
                ]
            },
            Path {
               fill: LinearGradient {
                    startX: 0.0
                    startY: 0.0
                    endX: 1.0
                    endY: 0.0
                    proportional: true
                    stops: [
                        Stop { offset: 0.0 color: Color.BLACK },
                        Stop { offset: 1.0 color: Color.RED }
                    ]
                }
                elements: [
                    MoveTo { x: 160 y: 240 },
                    ArcTo { x: 250 y: 240 radiusX: 100 radiusY: 100},
 
                ]
            },
 
       ]
    }
}

[3] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg
Comments:

NIH stikes again! You can do that easily in SVG. Who needs a (new) program-language for that?

Posted by F. Simoni on September 07, 2008 at 09:17 PM IST #

This new Programming Language can do bit more than this, not only this. Any Programming Language can do anything. It that sense in world, we need only one language :-).

Posted by Vaibhav on September 07, 2008 at 09:39 PM IST #

By the way, what you can do in SVG can be doable here.

Posted by Vaibhav on September 07, 2008 at 09:41 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed