functional/SceneGraphTests/src/test/scenegraph/app/Effects2App.java

Print this page




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation. Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  */
  24 package test.scenegraph.app;
  25 


  26 import java.util.ArrayList;

  27 import java.util.List;






  28 import javafx.scene.Group;
  29 import javafx.scene.Node;
  30 import javafx.scene.effect.*;
  31 import javafx.scene.effect.Light.Distant;
  32 import javafx.scene.effect.Light.Point;
  33 import javafx.scene.effect.Light.Spot;

  34 import javafx.scene.layout.StackPane;
  35 import javafx.scene.layout.VBox;
  36 import javafx.scene.paint.Color;
  37 import javafx.scene.paint.CycleMethod;
  38 import javafx.scene.paint.LinearGradient;
  39 import javafx.scene.paint.Stop;
  40 import javafx.scene.shape.*;
  41 import javafx.scene.text.Font;
  42 import javafx.scene.text.FontWeight;
  43 import javafx.scene.text.Text;

  44 import test.javaclient.shared.BasicButtonChooserApp;
  45 import test.javaclient.shared.PageWithSlots;
  46 import test.javaclient.shared.TestNode;
  47 import test.javaclient.shared.Utils;
  48 
  49 /**
  50  *
  51  * @author shubov
  52  */
  53 public class Effects2App extends BasicButtonChooserApp {
  54 
  55     public Effects2App() {
  56         super(600, 520, "Effects", false); // "true" stands for "additionalActionButton = "
  57     }
  58 
  59     public Effects2App(int width, int height, String title, boolean showAdditionalActionButton) {
  60         super(width, height, title, showAdditionalActionButton);
  61     }
  62 
  63     public static void main(String args[]) {


  72     }
  73 
  74     private void setFontViaCss(Text _text, int _size) {
  75             _text.setFont(Font.font("Verdana", _size));
  76 //            _text.setStyle("-fx-font: " + _size+ "pt Verdana;");
  77     }
  78 
  79     @Override
  80     protected void initPredefinedFont() {
  81     }
  82 
  83     private interface Factory {
  84         Node create(final Effect ne);
  85     }
  86 
  87     //private Factory defaultFactory;
  88     //private Factory hugeFontFactory;
  89     private Factory textFactory;
  90 
  91     // Blend page -------------------------------------------------------------






























  92     private class slotBlendRectangleCircle extends TestNode {
  93 
  94         Group group;
  95         BlendMode blendMode;
  96 
  97         slotBlendRectangleCircle(BlendMode _blendMode) {
  98             blendMode = _blendMode;
  99         }
 100 
 101         @Override
 102         public Node drawNode() {
 103             group = new Group();
 104             //group.setBlendMode(blendMode);
 105             group.setBlendMode(BlendMode.SRC_OVER);
 106             if (BlendMode.SRC_OVER != group.getBlendMode()) {
 107                 reportGetterFailure("Group.getBlendMode()");
 108             }
 109             Rectangle r = new Rectangle(20, 20, 60, 60);
 110             r.setFill(Color.rgb(0, 50, 255));
 111             Circle c = new Circle(70, 70, 30);


 145 //                                    setHeight(80); // (SLOTSIZEY - 10);
 146 //                                }
 147 //                            });
 148 //                        }
 149 //                    });
 150             text.setEffect(new Blend(BlendMode.SRC_OVER, null, new ColorInput(5, 5, 80, 80, Color.GREEN)));
 151             group.getChildren().add(text);
 152             return group;
 153         }
 154 
 155     }
 156     private class slotBloom extends TestNode {
 157         final Float threshold;
 158         slotBloom (final Float _threshold) {
 159             threshold = _threshold;
 160         }
 161         @Override
 162         public Node drawNode() {
 163             Group group = new Group();
 164             group.setEffect(new Bloom(threshold));
 165             group.getChildren().add(RectangleBuilder.create().x(0).y(0).width(160).height(80).
 166                     fill(Color.DARKBLUE).build());

 167             Text text = new Text("Bloom!");
 168             group.getChildren().add(text);
 169             text.setX(10);
 170             text.setY(60);
 171             text.setFill(Color.YELLOW);
 172             setFontViaCss(text, 36);
 173 
 174             return group;
 175         }
 176 
 177     }
 178     private class slotBlur extends TestNode {
 179         Node node;
 180         slotBlur(Node _node) {
 181             node = _node;
 182         }
 183         @Override
 184         public Node drawNode() {
 185             return node;
 186         }


 229         slotDisplacementMap() {
 230         }
 231         slotDisplacementMap(final NamedEffect _namedeffect) {
 232             namedeffect = _namedeffect;
 233         }
 234         List<NamedEffect> getNamedEffectList() {
 235             final FloatMap mapWaves = new FloatMap();
 236             mapWaves.setWidth(100);
 237             mapWaves.setHeight(80);
 238             for (int i = 0; i < mapWaves.getWidth()-1; i++) {
 239                 float v = (float) ((Math.sin(i / 30f * Math.PI) - 0.5f) / 20f);
 240                 for (int j = 0; j < mapWaves.getHeight()-1; j++) {
 241                     mapWaves.setSamples(i, j, 0f, v);
 242                 }
 243             }
 244 
 245             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 246             nes.add(new NamedEffect("defaults", new DisplacementMap(mapWaves)));
 247             nes.add(new NamedEffect("scale",  new DisplacementMap(mapWaves, 0, 0, 1.2f, 2.0f)));
 248             nes.add(new NamedEffect("offset",  new DisplacementMap(mapWaves, 0.2f, 0.1f, 1.0, 1.0)));
 249             nes.add(new NamedEffect("wrap",  DisplacementMapBuilder.create().mapData(mapWaves).
 250                     wrap(true).offsetX(0.5f).offsetY(0.3f).build()));



 251             return nes;
 252         }
 253         @Override
 254         public Node drawNode() {
 255             group = new Group();
 256             group.setEffect(namedeffect.effect);
 257             group.getChildren().add(new Rectangle(10,10, 100, 50));
 258             group.getChildren().add(RectangleBuilder.create().x(0).y(0).width(120).height(120).
 259                     fill(Color.TRANSPARENT).build()); // widener

 260             Text text = new Text("Waves");
 261             text.setX(11);
 262             text.setY(50);
 263             text.setFill(Color.RED);
 264             //text.setFont(Font.font("Verdana", 28));
 265             setFontViaCss(text, 28);
 266 
 267             group.getChildren().add(text);
 268             return group;
 269         }
 270 
 271     }
 272     private class slotWithDefaultDrawNode extends TestNode {
 273         final Effect e;
 274         Group group;
 275         slotWithDefaultDrawNode (final Effect _e) {
 276             e = _e;
 277         }
 278         @Override
 279         public Node drawNode() {
 280             VBox vb = new VBox();
 281             group = new Group();
 282             group.setEffect(e);
 283             group.getChildren().add(RectangleBuilder.create().x(10).y(10).width(100).height(50).
 284                     fill(Color.YELLOW).build());

 285             Text text = new Text("Text");
 286             text.setFill(Color.RED);
 287 //            text.setFont(Font.font("Verdana", 28));
 288             setFontViaCss(text, 28);
 289 
 290             group.getChildren().add(text);
 291             vb.getChildren().add(group);
 292             return vb;
 293         }
 294 
 295     }
 296     private class slotDropShadow extends slotWithDefaultDrawNode {
 297         slotDropShadow() {
 298             super(null);
 299         }
 300         slotDropShadow(final NamedEffect _namedeffect) {
 301             super(_namedeffect.effect);
 302         }
 303         List<NamedEffect> getNamedEffectList() {
 304             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 305             nes.add(new NamedEffect("colored", new DropShadow(10., Color.GREEN)));
 306             nes.add(new NamedEffect("height: 40", new DropShadow() {{ setHeight(40);}})); // Have to use double braces to test constructors
 307             nes.add(new NamedEffect("width: 40", new DropShadow(10., 0., 0., Color.BLACK) {{ setWidth(40);}}));
 308             nes.add(new NamedEffect("spread: 0.7", new DropShadow(BlurType.THREE_PASS_BOX, Color.BLACK, 10., 0.7, 0., 0.)));
 309             for (final BlurType bt : BlurType.values()) {
 310                 nes.add(new NamedEffect("bt:" + bt.name(), DropShadowBuilder.create().blurType(bt).build()));


 311             }
 312             nes.add(new NamedEffect("offset: 10, 20", new DropShadow(10., 10, 20, Color.BLACK)));
 313             return nes;
 314         }
 315 
 316     }
 317 
 318     private class slotFloodSimplePaint extends TestNode {
 319         @Override
 320         public Node drawNode() {
 321             Rectangle rect = new Rectangle(10, 10, 70, 70);
 322             ColorInput effect = new ColorInput();
 323             effect.setPaint(Color.RED);
 324             effect.setX(15);
 325             effect.setY(15);
 326             effect.setWidth(70);
 327             effect.setHeight(70);
 328             rect.setEffect(effect);
 329             return rect;
 330         }


 336             ColorInput effect = new ColorInput();
 337             effect.setPaint(new LinearGradient(0, 0, 0.5f, 0.1f, true, CycleMethod.REPEAT, new Stop[] {
 338                             new Stop(0, Color.RED),
 339                             new Stop(1, Color.GREEN),
 340                         }));
 341             effect.setX(15);
 342             effect.setY(15);
 343             effect.setWidth(70);
 344             effect.setHeight(70);
 345             rect.setEffect(effect);
 346             return rect;
 347         }
 348     }
 349     private class slotFloodAlphaPaint extends TestNode {
 350         @Override
 351         public Node drawNode() {
 352             StackPane st = new StackPane();
 353             Text tmpTxt = new Text("Background");
 354             tmpTxt.setFill(Color.RED);
 355             st.getChildren().add(tmpTxt);
 356             st.getChildren().add(RectangleBuilder.create().x(0).y(0).width(40).height(40).
 357                     effect(new ColorInput(5, 5, 70, 70, Color.rgb(0, 255, 0, 0.5f))).build());

 358             return st;
 359         }
 360 
 361     }
 362 
 363 
 364     private class slotWithTextNode extends TestNode {
 365         final Effect e;
 366         Group group;
 367         slotWithTextNode (final Effect _e) {
 368             e = _e;
 369         }
 370         @Override
 371         public Node drawNode() {
 372             VBox vb = new VBox();
 373             group = new Group();
 374             group.setEffect(e);
 375             Text text = new Text("Text");
 376             text.setX(10);
 377             text.setY(60);


 386 
 387     }
 388     private class slotWithHugeTextNode extends TestNode {
 389         final Effect e;
 390         Group group;
 391         slotWithHugeTextNode (final Effect _e) {
 392             e = _e;
 393         }
 394         @Override
 395         public Node drawNode() {
 396             VBox vb = new VBox();
 397             group = new Group();
 398             group.setEffect(e);
 399             Text text = new Text("XO");
 400             text.setX(10);
 401 //            text.setFont(Font.font("Verdana", 80));
 402             setFontViaCss(text, 80);
 403 
 404             text.setFill(Color.YELLOW);
 405             group.getChildren().add(text);
 406             group.getChildren().add(RectangleBuilder.create().x(10).y(10).width(100).height(40).
 407                     fill(Color.LIGHTBLUE).build());

 408 
 409             vb.getChildren().add(group);
 410             return vb;
 411         }
 412 
 413     }
 414     private class slotInnerShadow extends slotWithHugeTextNode {
 415         slotInnerShadow() {
 416             super(null);
 417         }
 418         slotInnerShadow(final NamedEffect _namedeffect) {
 419             super(_namedeffect.effect);
 420         }
 421         List<NamedEffect> getNamedEffectList() {
 422             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 423             nes.add(new NamedEffect("colored", InnerShadowBuilder.create().color(Color.GREEN).build()));
 424             nes.add(new NamedEffect("height: 40", InnerShadowBuilder.create().height(40).build()));
 425             nes.add(new NamedEffect("width: 40", InnerShadowBuilder.create().width(40).build()));
 426             nes.add(new NamedEffect("radius: 40", InnerShadowBuilder.create().radius(40).build()));









 427             for (final BlurType bt : BlurType.values()) {
 428                 nes.add(new NamedEffect("bt:" + bt.name(), InnerShadowBuilder.create().blurType(bt).build()));
 429             }
 430             nes.add(new NamedEffect("choke: 0.7", InnerShadowBuilder.create().choke(0.7f).build()));
 431             nes.add(new NamedEffect("offset: 10, 20", InnerShadowBuilder.create().offsetX(10).offsetY(20).build()));







 432             return nes;
 433         }
 434 
 435     }
 436     private class slotLightningShadow extends slotWithHugeTextNode {
 437         slotLightningShadow() {
 438             super(null);
 439         }
 440         slotLightningShadow(final NamedEffect _namedeffect) {
 441             super(_namedeffect.effect);
 442         }
 443         List<NamedEffect> getNamedEffectList() {
 444             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 445             nes.add(new NamedEffect("default", new Lighting()));
 446             nes.add(new NamedEffect("distant light", LightingBuilder.create().light(new Distant()
 447             {{ setAzimuth(90f); setElevation(50);}}).build()));
 448             nes.add(new NamedEffect("point light", LightingBuilder.create().light(new Point(
 449                     70, 120, 10, Color.WHITE)).build()));
 450             nes.add(new NamedEffect("spot light", LightingBuilder.create().light(new Spot() {{
 451                     setX(70);setY(120);setZ(50);
 452                     setPointsAtX(150);setPointsAtY(0);setPointsAtZ(0);
 453                 }}).build()));
 454 
 455             nes.add(new NamedEffect("diffuse: 0.5", LightingBuilder.create().diffuseConstant(0.5f).build()));
 456             nes.add(new NamedEffect("specularC: 1.5", LightingBuilder.create().specularConstant(1.5f).build()));
 457             nes.add(new NamedEffect("specularExp: 35", LightingBuilder.create().specularExponent(35f).build()));
 458             nes.add(new NamedEffect("scale: 7", LightingBuilder.create().surfaceScale(7f).build()));
 459             nes.add(new NamedEffect("bump input", LightingBuilder.create().bumpInput(new DropShadow()).build()));
 460             nes.add(new NamedEffect("content input", LightingBuilder.create().contentInput(new DropShadow()).build()));

























 461 
 462             return nes;
 463         }
 464 
 465     }
 466 
 467     private class slotPerspectiveTransform extends slotWithDefaultDrawNode {
 468         slotPerspectiveTransform() {
 469             super(null);
 470         }
 471         slotPerspectiveTransform(final NamedEffect _namedeffect) {
 472             super(_namedeffect.effect);
 473         }
 474         List<NamedEffect> getNamedEffectList() {
 475             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 476             PerspectiveTransform pt = new PerspectiveTransform();
 477             pt.setUlx(10);
 478             pt.setUly(10);
 479             pt.setUrx(150);
 480             pt.setUry(50);
 481             pt.setLrx(150);
 482             pt.setLry(100);
 483             pt.setLlx(10);
 484             pt.setLly(70);
 485             nes.add(new NamedEffect("perspective", pt));
 486 
 487             return nes;
 488         }
 489 
 490     }
 491     private class slotReflection extends slotWithTextNode {
 492         slotReflection() {
 493             super(null);
 494         }
 495         slotReflection(final NamedEffect _namedeffect) {
 496             super(_namedeffect.effect);
 497         }
 498         List<NamedEffect> getNamedEffectList() {
 499             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 500             nes.add(new NamedEffect("default", new Reflection() ));
 501             nes.add(new NamedEffect("bottom opacity 0.7", ReflectionBuilder.create().bottomOpacity(.7f).build()));
 502             nes.add(new NamedEffect("fraction: 0.5", ReflectionBuilder.create().fraction(0.5f).build()));
 503             nes.add(new NamedEffect("top offset: 15", ReflectionBuilder.create().topOffset(15).build()));
 504             nes.add(new NamedEffect("top opacity: 0.9", ReflectionBuilder.create().topOpacity(.9f).build()));









 505 
 506             return nes;
 507         }
 508 
 509     }
 510     private class slotShadow extends slotWithHugeTextNode {
 511         slotShadow() {
 512             super(null);
 513         }
 514         slotShadow(final NamedEffect _namedeffect) {
 515             super(_namedeffect.effect);
 516         }
 517         List<NamedEffect> getNamedEffectList() {
 518             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 519             nes.add(new NamedEffect("colored", ShadowBuilder.create().color(Color.GREEN).build()));
 520             nes.add(new NamedEffect("height: 40", ShadowBuilder.create().height(40).build()));
 521             nes.add(new NamedEffect("width: 40", ShadowBuilder.create().width(40).build()));
 522             nes.add(new NamedEffect("radius: 40", ShadowBuilder.create().radius(40).build()));








 523             for (final BlurType bt : BlurType.values()) {
 524                 nes.add(new NamedEffect("bt:" + bt.name(), ShadowBuilder.create().blurType(bt).build()));


 525             }
 526 
 527             return nes;
 528         }
 529 
 530     }
 531 
 532     public TestNode setup() {
 533         TestNode rootTestNode = new TestNode();
 534 
 535         initFactories();
 536 
 537     // utility classes
 538 
 539 
 540         final int heightPageContentPane = height;
 541         final int widthPageContentPane = width;
 542 
 543         // ======== BLEND =================
 544         final PageWithSlots blendPage = new PageWithSlots(Pages.Blend.name(), heightPageContentPane, widthPageContentPane);
 545         blendPage.setSlotSize(90, 90);
 546         for (final BlendMode blendMode : BlendMode.values()) {
 547             blendPage.add(new slotBlendRectangleCircle(blendMode), blendMode.name());
 548         }
 549         blendPage.add(new slotBlend2(),"Grad_SrcOut");
 550 
 551         // ======== BLOOM =================
 552         final PageWithSlots bloomPage = new PageWithSlots(Pages.Bloom.name(), heightPageContentPane, widthPageContentPane);
 553         bloomPage.setSlotSize(160, 160);
 554         for (final Float threshold : new Float[] {0f, 0.3f, 0.7f, 1f}) {
 555             bloomPage.add(new slotBloom(threshold), "Threshold " + threshold);
 556         }
 557 
 558         // ======== BOX BLUR =================
 559         final PageWithSlots blurPage = new PageWithSlots(Pages.BoxBlur.name(), heightPageContentPane, widthPageContentPane);
 560         blurPage.setSlotSize(110, 110);
 561 
 562         for (final int iterations : new int[]{1, 3}) {
 563             for (final int _width : new int[]{1, 10, 20}) {
 564                 for (final int _height : new int[]{1, 10, 20}) {
 565                     final Node node = textFactory.create(BoxBlurBuilder.create().width(_width).
 566                             height(_height).iterations(iterations).build());
 567                     blurPage.add(new slotBlur(node),"W:" + _width + " H:" + _height + " I:" + iterations);
 568                 }
 569             }
 570         }
 571 
 572         // ======== COLOR ADJUST =================
 573         final PageWithSlots cadjPage = new PageWithSlots(Pages.ColorAdjust.name(), heightPageContentPane, widthPageContentPane);
 574         cadjPage.setSlotSize(110, 110);
 575         for (NamedEffect namedEffect : new slotColorAdjust().getNamedEffectList()) {
 576             cadjPage.add(new slotColorAdjust(namedEffect),namedEffect.name);
 577         }
 578 
 579         // ======== DISPLACEMENT MAP =================
 580         final PageWithSlots mapPage = new PageWithSlots(Pages.Map.name(), heightPageContentPane, widthPageContentPane);
 581         mapPage.setSlotSize(120, 120);
 582         for (NamedEffect namedEffect : new slotDisplacementMap().getNamedEffectList()) {
 583             mapPage.add(new slotDisplacementMap(namedEffect),namedEffect.name);
 584         }
 585         // ======== DROP SHADOW =================
 586         final PageWithSlots dropPage = new PageWithSlots(Pages.DropShadow.name(), heightPageContentPane, widthPageContentPane);


 591 
 592         // ======== ColorInput (FLOOD) =================
 593         final PageWithSlots floodPage = new PageWithSlots(Pages.Flood.name(), heightPageContentPane, widthPageContentPane);
 594         floodPage.add(new slotFloodSimplePaint(), "Simple_Paint");
 595         floodPage.add(new slotFloodGradPaint(), "Grad_Paint");
 596         floodPage.add(new slotFloodAlphaPaint(), "Alpha_Paint");
 597 
 598         // ======== GaussianBlur =================
 599         final PageWithSlots gauPage = new PageWithSlots(Pages.GaussianBlur.name(), heightPageContentPane, widthPageContentPane);
 600         gauPage.setSlotSize(180, 180);
 601         for (final Float radius : new Float[]{0f, 10f, 30f, 63f}) {
 602             GaussianBlur gb = new GaussianBlur();
 603             gb.setRadius(radius);
 604             gauPage.add(new slotWithDefaultDrawNode(gb),"Threshold_" + radius);
 605         }
 606 
 607         // ======== Glow =================
 608         final PageWithSlots glowPage = new PageWithSlots(Pages.Glow.name(), heightPageContentPane, widthPageContentPane);
 609         glowPage.setSlotSize(160, 160);
 610         for (final Float level : new Float[] {0f, 0.3f, 0.7f, 1f}) {
 611             Glow gl = GlowBuilder.create().level(level).build();
 612             glowPage.add(new slotWithTextNode(gl),"Level_" + level);
 613         }
 614 
 615         // ======== INNER SHADOW =================
 616         final PageWithSlots innershadowPage = new PageWithSlots(Pages.InnerShadow.name(), heightPageContentPane, widthPageContentPane);
 617         innershadowPage.setSlotSize(140, 140);
 618         for (NamedEffect namedEffect : new slotInnerShadow().getNamedEffectList()) {
 619             innershadowPage.add(new slotInnerShadow(namedEffect),namedEffect.name);
 620         }
 621 
 622         // ======== Lightning SHADOW =================
 623         final PageWithSlots lightningPage = new PageWithSlots(Pages.Lightning.name(), heightPageContentPane, widthPageContentPane);
 624         lightningPage.setSlotSize(140, 140);
 625         for (NamedEffect namedEffect : new slotLightningShadow().getNamedEffectList()) {
 626             lightningPage.add(new slotLightningShadow(namedEffect),namedEffect.name);
 627         }
 628 
 629         // ======== MotionBlur =================
 630         final PageWithSlots motionBlurPage = new PageWithSlots(Pages.MotionBlur.name(), heightPageContentPane, widthPageContentPane);
 631         motionBlurPage.setSlotSize(120, 120);
 632         for (final int radius : new int[] {0, 10, 20}) {
 633             for (final int angle : new int[] {0, 45, 160, 315}) {
 634                 motionBlurPage.add(new slotWithTextNode(MotionBlurBuilder.create().angle(angle).
 635                         radius(radius).build()), "Angle_" + angle + "_Radius_" + radius);
 636             }
 637         }
 638 
 639         // ======== PerspectiveTransform =================
 640         final PageWithSlots perspectiveTransformPage = new PageWithSlots(Pages.Transform.name(), heightPageContentPane, widthPageContentPane);
 641         perspectiveTransformPage.setSlotSize(140, 140);
 642         for (NamedEffect namedEffect : new slotPerspectiveTransform().getNamedEffectList()) {
 643             perspectiveTransformPage.add(new slotPerspectiveTransform(namedEffect),namedEffect.name);
 644         }
 645 
 646         // ======== Reflection =================
 647         final PageWithSlots reflectionPage = new PageWithSlots(Pages.Reflection.name(), heightPageContentPane, widthPageContentPane);
 648         reflectionPage.setSlotSize(140, 140);
 649         for (NamedEffect namedEffect : new slotReflection().getNamedEffectList()) {
 650             reflectionPage.add(new slotReflection(namedEffect),namedEffect.name);
 651         }
 652 
 653         // ============= SepiaTone ==================
 654         final PageWithSlots sepiaTonePage = new PageWithSlots(Pages.SepiaTone.name(), heightPageContentPane, widthPageContentPane);
 655         sepiaTonePage.setSlotSize(180, 180);




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation. Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  */
  24 package test.scenegraph.app;
  25 
  26 import java.io.IOException;
  27 import java.net.URL;
  28 import java.util.ArrayList;
  29 import java.util.Enumeration;
  30 import java.util.List;
  31 import java.util.Timer;
  32 import java.util.TimerTask;
  33 import java.util.logging.Level;
  34 import java.util.logging.Logger;
  35 import javafx.animation.RotateTransition;
  36 import javafx.geometry.Bounds;
  37 import javafx.scene.Group;
  38 import javafx.scene.Node;
  39 import javafx.scene.effect.*;
  40 import javafx.scene.effect.Light.Distant;
  41 import javafx.scene.effect.Light.Point;
  42 import javafx.scene.effect.Light.Spot;
  43 import javafx.scene.image.Image;
  44 import javafx.scene.layout.StackPane;
  45 import javafx.scene.layout.VBox;
  46 import javafx.scene.paint.Color;
  47 import javafx.scene.paint.CycleMethod;
  48 import javafx.scene.paint.LinearGradient;
  49 import javafx.scene.paint.Stop;
  50 import javafx.scene.shape.*;
  51 import javafx.scene.text.Font;
  52 import javafx.scene.text.FontWeight;
  53 import javafx.scene.text.Text;
  54 import javafx.util.Duration;
  55 import test.javaclient.shared.BasicButtonChooserApp;
  56 import test.javaclient.shared.PageWithSlots;
  57 import test.javaclient.shared.TestNode;
  58 import test.javaclient.shared.Utils;
  59 
  60 /**
  61  *
  62  * @author shubov
  63  */
  64 public class Effects2App extends BasicButtonChooserApp {
  65 
  66     public Effects2App() {
  67         super(600, 520, "Effects", false); // "true" stands for "additionalActionButton = "
  68     }
  69 
  70     public Effects2App(int width, int height, String title, boolean showAdditionalActionButton) {
  71         super(width, height, title, showAdditionalActionButton);
  72     }
  73 
  74     public static void main(String args[]) {


  83     }
  84 
  85     private void setFontViaCss(Text _text, int _size) {
  86             _text.setFont(Font.font("Verdana", _size));
  87 //            _text.setStyle("-fx-font: " + _size+ "pt Verdana;");
  88     }
  89 
  90     @Override
  91     protected void initPredefinedFont() {
  92     }
  93 
  94     private interface Factory {
  95         Node create(final Effect ne);
  96     }
  97 
  98     //private Factory defaultFactory;
  99     //private Factory hugeFontFactory;
 100     private Factory textFactory;
 101 
 102     // Blend page -------------------------------------------------------------
 103     private class slotTexturedBlendRectangle extends TestNode {
 104         private Image image = new Image(
 105                 getClass().getResourceAsStream(ImagesApp.IMAGE_BASE + "blend_texture.png"));
 106 
 107         @Override
 108         public Node drawNode() {
 109             Blend blend = new Blend();
 110             blend.setTopInput(new ImageInput(image));
 111             blend.setMode(BlendMode.SRC_ATOP);
 112 
 113             Polygon p = new Polygon(0, 200, 100, 0, 200, 200);
 114             p.setLayoutX(100);
 115             p.setLayoutY(100);
 116             p.setFill(Color.RED);
 117             p.setStroke(Color.ORANGE);
 118             p.setStrokeWidth(4.0);
 119             p.setStrokeType(StrokeType.OUTSIDE);
 120 
 121 
 122             //Just need to add effect somewhere in the future, when the polygon is already drawn
 123             new Timer().schedule(new TimerTask() {
 124                 @Override
 125                 public void run() {
 126                   p.setEffect(blend);
 127                 }
 128             }, 500);
 129             return p;
 130         }
 131     }
 132 
 133     private class slotBlendRectangleCircle extends TestNode {
 134 
 135         Group group;
 136         BlendMode blendMode;
 137 
 138         slotBlendRectangleCircle(BlendMode _blendMode) {
 139             blendMode = _blendMode;
 140         }
 141 
 142         @Override
 143         public Node drawNode() {
 144             group = new Group();
 145             //group.setBlendMode(blendMode);
 146             group.setBlendMode(BlendMode.SRC_OVER);
 147             if (BlendMode.SRC_OVER != group.getBlendMode()) {
 148                 reportGetterFailure("Group.getBlendMode()");
 149             }
 150             Rectangle r = new Rectangle(20, 20, 60, 60);
 151             r.setFill(Color.rgb(0, 50, 255));
 152             Circle c = new Circle(70, 70, 30);


 186 //                                    setHeight(80); // (SLOTSIZEY - 10);
 187 //                                }
 188 //                            });
 189 //                        }
 190 //                    });
 191             text.setEffect(new Blend(BlendMode.SRC_OVER, null, new ColorInput(5, 5, 80, 80, Color.GREEN)));
 192             group.getChildren().add(text);
 193             return group;
 194         }
 195 
 196     }
 197     private class slotBloom extends TestNode {
 198         final Float threshold;
 199         slotBloom (final Float _threshold) {
 200             threshold = _threshold;
 201         }
 202         @Override
 203         public Node drawNode() {
 204             Group group = new Group();
 205             group.setEffect(new Bloom(threshold));
 206                         Rectangle temp = new Rectangle(0, 0, 160, 80);
 207                         temp.setFill(Color.DARKBLUE);
 208             group.getChildren().add(temp);
 209             Text text = new Text("Bloom!");
 210             group.getChildren().add(text);
 211             text.setX(10);
 212             text.setY(60);
 213             text.setFill(Color.YELLOW);
 214             setFontViaCss(text, 36);
 215 
 216             return group;
 217         }
 218 
 219     }
 220     private class slotBlur extends TestNode {
 221         Node node;
 222         slotBlur(Node _node) {
 223             node = _node;
 224         }
 225         @Override
 226         public Node drawNode() {
 227             return node;
 228         }


 271         slotDisplacementMap() {
 272         }
 273         slotDisplacementMap(final NamedEffect _namedeffect) {
 274             namedeffect = _namedeffect;
 275         }
 276         List<NamedEffect> getNamedEffectList() {
 277             final FloatMap mapWaves = new FloatMap();
 278             mapWaves.setWidth(100);
 279             mapWaves.setHeight(80);
 280             for (int i = 0; i < mapWaves.getWidth()-1; i++) {
 281                 float v = (float) ((Math.sin(i / 30f * Math.PI) - 0.5f) / 20f);
 282                 for (int j = 0; j < mapWaves.getHeight()-1; j++) {
 283                     mapWaves.setSamples(i, j, 0f, v);
 284                 }
 285             }
 286 
 287             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 288             nes.add(new NamedEffect("defaults", new DisplacementMap(mapWaves)));
 289             nes.add(new NamedEffect("scale",  new DisplacementMap(mapWaves, 0, 0, 1.2f, 2.0f)));
 290             nes.add(new NamedEffect("offset",  new DisplacementMap(mapWaves, 0.2f, 0.1f, 1.0, 1.0)));
 291                         DisplacementMap temp = new DisplacementMap(mapWaves);
 292                         temp.setWrap(true);
 293                         temp.setOffsetX(0.5f);
 294                         temp.setOffsetY(0.3f);
 295             nes.add(new NamedEffect("wrap",  temp));
 296             return nes;
 297         }
 298         @Override
 299         public Node drawNode() {
 300             group = new Group();
 301             group.setEffect(namedeffect.effect);
 302             group.getChildren().add(new Rectangle(10,10, 100, 50));
 303                         Rectangle temp = new Rectangle(0, 0, 120, 120);
 304                         temp.setFill(Color.TRANSPARENT);
 305             group.getChildren().add(temp); // widener
 306             Text text = new Text("Waves");
 307             text.setX(11);
 308             text.setY(50);
 309             text.setFill(Color.RED);
 310             //text.setFont(Font.font("Verdana", 28));
 311             setFontViaCss(text, 28);
 312 
 313             group.getChildren().add(text);
 314             return group;
 315         }
 316 
 317     }
 318     private class slotWithDefaultDrawNode extends TestNode {
 319         final Effect e;
 320         Group group;
 321         slotWithDefaultDrawNode (final Effect _e) {
 322             e = _e;
 323         }
 324         @Override
 325         public Node drawNode() {
 326             VBox vb = new VBox();
 327             group = new Group();
 328             group.setEffect(e);
 329                         Rectangle temp = new Rectangle(10, 10, 100, 50);
 330                         temp.setFill(Color.YELLOW);
 331             group.getChildren().add(temp);
 332             Text text = new Text("Text");
 333             text.setFill(Color.RED);
 334 //            text.setFont(Font.font("Verdana", 28));
 335             setFontViaCss(text, 28);
 336 
 337             group.getChildren().add(text);
 338             vb.getChildren().add(group);
 339             return vb;
 340         }
 341 
 342     }
 343     private class slotDropShadow extends slotWithDefaultDrawNode {
 344         slotDropShadow() {
 345             super(null);
 346         }
 347         slotDropShadow(final NamedEffect _namedeffect) {
 348             super(_namedeffect.effect);
 349         }
 350         List<NamedEffect> getNamedEffectList() {
 351             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 352             nes.add(new NamedEffect("colored", new DropShadow(10., Color.GREEN)));
 353             nes.add(new NamedEffect("height: 40", new DropShadow() {{ setHeight(40);}})); // Have to use double braces to test constructors
 354             nes.add(new NamedEffect("width: 40", new DropShadow(10., 0., 0., Color.BLACK) {{ setWidth(40);}}));
 355             nes.add(new NamedEffect("spread: 0.7", new DropShadow(BlurType.THREE_PASS_BOX, Color.BLACK, 10., 0.7, 0., 0.)));
 356             for (final BlurType bt : BlurType.values()) {
 357                                 DropShadow temp = new DropShadow();
 358                                 temp.setBlurType(bt);
 359                 nes.add(new NamedEffect("bt:" + bt.name(), temp));
 360             }
 361             nes.add(new NamedEffect("offset: 10, 20", new DropShadow(10., 10, 20, Color.BLACK)));
 362             return nes;
 363         }
 364 
 365     }
 366 
 367     private class slotFloodSimplePaint extends TestNode {
 368         @Override
 369         public Node drawNode() {
 370             Rectangle rect = new Rectangle(10, 10, 70, 70);
 371             ColorInput effect = new ColorInput();
 372             effect.setPaint(Color.RED);
 373             effect.setX(15);
 374             effect.setY(15);
 375             effect.setWidth(70);
 376             effect.setHeight(70);
 377             rect.setEffect(effect);
 378             return rect;
 379         }


 385             ColorInput effect = new ColorInput();
 386             effect.setPaint(new LinearGradient(0, 0, 0.5f, 0.1f, true, CycleMethod.REPEAT, new Stop[] {
 387                             new Stop(0, Color.RED),
 388                             new Stop(1, Color.GREEN),
 389                         }));
 390             effect.setX(15);
 391             effect.setY(15);
 392             effect.setWidth(70);
 393             effect.setHeight(70);
 394             rect.setEffect(effect);
 395             return rect;
 396         }
 397     }
 398     private class slotFloodAlphaPaint extends TestNode {
 399         @Override
 400         public Node drawNode() {
 401             StackPane st = new StackPane();
 402             Text tmpTxt = new Text("Background");
 403             tmpTxt.setFill(Color.RED);
 404             st.getChildren().add(tmpTxt);
 405                         Rectangle temp = new Rectangle(0, 0, 40, 40);
 406                         temp.setEffect(new ColorInput(5, 5, 70, 70, Color.rgb(0, 255, 0, 0.5f)));
 407             st.getChildren().add(temp);
 408             return st;
 409         }
 410 
 411     }
 412 
 413 
 414     private class slotWithTextNode extends TestNode {
 415         final Effect e;
 416         Group group;
 417         slotWithTextNode (final Effect _e) {
 418             e = _e;
 419         }
 420         @Override
 421         public Node drawNode() {
 422             VBox vb = new VBox();
 423             group = new Group();
 424             group.setEffect(e);
 425             Text text = new Text("Text");
 426             text.setX(10);
 427             text.setY(60);


 436 
 437     }
 438     private class slotWithHugeTextNode extends TestNode {
 439         final Effect e;
 440         Group group;
 441         slotWithHugeTextNode (final Effect _e) {
 442             e = _e;
 443         }
 444         @Override
 445         public Node drawNode() {
 446             VBox vb = new VBox();
 447             group = new Group();
 448             group.setEffect(e);
 449             Text text = new Text("XO");
 450             text.setX(10);
 451 //            text.setFont(Font.font("Verdana", 80));
 452             setFontViaCss(text, 80);
 453 
 454             text.setFill(Color.YELLOW);
 455             group.getChildren().add(text);
 456                         Rectangle temp = new Rectangle(10, 10, 100, 40);
 457                         temp.setFill(Color.LIGHTBLUE);
 458             group.getChildren().add(temp);
 459 
 460             vb.getChildren().add(group);
 461             return vb;
 462         }
 463 
 464     }
 465     private class slotInnerShadow extends slotWithHugeTextNode {
 466         slotInnerShadow() {
 467             super(null);
 468         }
 469         slotInnerShadow(final NamedEffect _namedeffect) {
 470             super(_namedeffect.effect);
 471         }
 472         List<NamedEffect> getNamedEffectList() {
 473             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 474                         InnerShadow temp;
 475                         temp = new InnerShadow();
 476                         temp.setColor(Color.GREEN);
 477             nes.add(new NamedEffect("colored", temp));
 478                         temp = new InnerShadow();
 479                         temp.setHeight(40);
 480             nes.add(new NamedEffect("height: 40", temp));
 481                         temp = new InnerShadow();
 482                         temp.setWidth(40);
 483             nes.add(new NamedEffect("width: 40", temp));
 484                         temp = new InnerShadow();
 485                         temp.setRadius(40);
 486             nes.add(new NamedEffect("radius: 40", temp));
 487             for (final BlurType bt : BlurType.values()) {
 488                                 temp = new InnerShadow();
 489                                 temp.setBlurType(bt);
 490                 nes.add(new NamedEffect("bt:" + bt.name(), temp));
 491             }
 492                         temp = new InnerShadow();
 493                         temp.setChoke(0.7f);
 494             nes.add(new NamedEffect("choke: 0.7", temp));
 495             temp = new InnerShadow();
 496                         temp.setOffsetX(10);
 497                         temp.setOffsetY(20);
 498                         nes.add(new NamedEffect("offset: 10, 20", temp));
 499             return nes;
 500         }
 501 
 502     }
 503     private class slotLightningShadow extends slotWithHugeTextNode {
 504         slotLightningShadow() {
 505             super(null);
 506         }
 507         slotLightningShadow(final NamedEffect _namedeffect) {
 508             super(_namedeffect.effect);
 509         }
 510         List<NamedEffect> getNamedEffectList() {
 511             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 512                         Lighting temp = new Lighting();
 513             nes.add(new NamedEffect("default", temp));
 514                         temp = new Lighting();
 515                         Light.Distant td = new Light.Distant();
 516                         td.setAzimuth(90f);
 517                         td.setElevation(50);
 518                         temp.setLight(td);
 519             nes.add(new NamedEffect("distant light", temp));
 520                         temp = new Lighting();
 521                         Light.Point tp = new Light.Point(70, 120, 10, Color.WHITE);
 522                         temp.setLight(tp);
 523             nes.add(new NamedEffect("point light", temp));
 524                         temp = new Lighting();
 525                         Light.Spot ts = new Light.Spot();
 526                         ts.setX(70);
 527                         ts.setY(120);
 528                         ts.setZ(50);
 529                         ts.setPointsAtX(150);
 530                         ts.setPointsAtY(0);
 531                         ts.setPointsAtZ(0);
 532                         temp.setLight(ts);
 533             nes.add(new NamedEffect("spot light", temp));
 534 
 535                         temp = new Lighting();
 536                         temp.setDiffuseConstant(0.5f);
 537             nes.add(new NamedEffect("diffuse: 0.5", temp));
 538                         temp = new Lighting();
 539                         temp.setSpecularConstant(1.5f);
 540             nes.add(new NamedEffect("specularC: 1.5", temp));
 541                         temp = new Lighting();
 542                         temp.setSpecularExponent(35f);
 543             nes.add(new NamedEffect("specularExp: 35", temp));
 544                         temp = new Lighting();
 545                         temp.setSurfaceScale(7f);
 546             nes.add(new NamedEffect("scale: 7", temp));
 547                         temp = new Lighting();
 548                         temp.setBumpInput(new DropShadow());
 549             nes.add(new NamedEffect("bump input", temp));
 550                         temp = new Lighting();
 551                         temp.setContentInput(new DropShadow());
 552             nes.add(new NamedEffect("content input", temp));
 553 
 554             return nes;
 555         }
 556 
 557     }
 558 
 559     private class slotPerspectiveTransform extends slotWithDefaultDrawNode {
 560         slotPerspectiveTransform() {
 561             super(null);
 562         }
 563         slotPerspectiveTransform(final NamedEffect _namedeffect) {
 564             super(_namedeffect.effect);
 565         }
 566         List<NamedEffect> getNamedEffectList() {
 567             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 568             PerspectiveTransform pt = new PerspectiveTransform();
 569             pt.setUlx(10);
 570             pt.setUly(10);
 571             pt.setUrx(150);
 572             pt.setUry(50);
 573             pt.setLrx(150);
 574             pt.setLry(100);
 575             pt.setLlx(10);
 576             pt.setLly(70);
 577             nes.add(new NamedEffect("perspective", pt));
 578 
 579             return nes;
 580         }
 581 
 582     }
 583     private class slotReflection extends slotWithTextNode {
 584         slotReflection() {
 585             super(null);
 586         }
 587         slotReflection(final NamedEffect _namedeffect) {
 588             super(_namedeffect.effect);
 589         }
 590         List<NamedEffect> getNamedEffectList() {
 591             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 592                         Reflection temp = new Reflection();
 593             nes.add(new NamedEffect("default", temp));
 594                         temp = new Reflection();
 595                         temp.setBottomOpacity(.7f);
 596             nes.add(new NamedEffect("bottom opacity 0.7", temp));
 597                         temp = new Reflection();
 598                         temp.setFraction(0.5f);
 599             nes.add(new NamedEffect("fraction: 0.5", temp));
 600                         temp = new Reflection();
 601                         temp.setTopOffset(15);
 602             nes.add(new NamedEffect("top offset: 15", temp));
 603                         temp = new Reflection();
 604                         temp.setTopOpacity(.9f);
 605             nes.add(new NamedEffect("top opacity: 0.9", temp));
 606 
 607             return nes;
 608         }
 609 
 610     }
 611     private class slotShadow extends slotWithHugeTextNode {
 612         slotShadow() {
 613             super(null);
 614         }
 615         slotShadow(final NamedEffect _namedeffect) {
 616             super(_namedeffect.effect);
 617         }
 618         List<NamedEffect> getNamedEffectList() {
 619             List<NamedEffect> nes = new ArrayList<NamedEffect>();
 620                         Shadow temp = new Shadow();
 621                         temp.setColor(Color.GREEN);
 622             nes.add(new NamedEffect("colored", temp));
 623                         temp = new Shadow();
 624                         temp.setHeight(40);
 625             nes.add(new NamedEffect("height: 40", temp));
 626                         temp = new Shadow();
 627                         temp.setWidth(40);
 628             nes.add(new NamedEffect("width: 40", temp));
 629                         temp = new Shadow();
 630                         temp.setRadius(40);
 631             nes.add(new NamedEffect("radius: 40", temp));
 632             for (final BlurType bt : BlurType.values()) {
 633                                 temp = new Shadow();
 634                                 temp.setBlurType(bt);
 635                 nes.add(new NamedEffect("bt:" + bt.name(), temp));
 636             }
 637 
 638             return nes;
 639         }
 640 
 641     }
 642 
 643     public TestNode setup() {
 644         TestNode rootTestNode = new TestNode();
 645 
 646         initFactories();
 647 
 648     // utility classes
 649 
 650 
 651         final int heightPageContentPane = height;
 652         final int widthPageContentPane = width;
 653 
 654         // ======== BLEND =================
 655         final PageWithSlots blendPage = new PageWithSlots(Pages.Blend.name(), heightPageContentPane, widthPageContentPane);
 656         blendPage.setSlotSize(90, 90);
 657         for (final BlendMode blendMode : BlendMode.values()) {
 658             blendPage.add(new slotBlendRectangleCircle(blendMode), blendMode.name());
 659         }
 660         blendPage.add(new slotBlend2(),"Grad_SrcOut");
 661         blendPage.add(new slotTexturedBlendRectangle(), "Textured");
 662         // ======== BLOOM =================
 663         final PageWithSlots bloomPage = new PageWithSlots(Pages.Bloom.name(), heightPageContentPane, widthPageContentPane);
 664         bloomPage.setSlotSize(160, 160);
 665         for (final Float threshold : new Float[] {0f, 0.3f, 0.7f, 1f}) {
 666             bloomPage.add(new slotBloom(threshold), "Threshold " + threshold);
 667         }
 668 
 669         // ======== BOX BLUR =================
 670         final PageWithSlots blurPage = new PageWithSlots(Pages.BoxBlur.name(), heightPageContentPane, widthPageContentPane);
 671         blurPage.setSlotSize(110, 110);
 672 
 673         for (final int iterations : new int[]{1, 3}) {
 674             for (final int _width : new int[]{1, 10, 20}) {
 675                 for (final int _height : new int[]{1, 10, 20}) {
 676                                     final Node node = textFactory.create(new BoxBlur(_width, _height, iterations));

 677                     blurPage.add(new slotBlur(node),"W:" + _width + " H:" + _height + " I:" + iterations);
 678                 }
 679             }
 680         }
 681 
 682         // ======== COLOR ADJUST =================
 683         final PageWithSlots cadjPage = new PageWithSlots(Pages.ColorAdjust.name(), heightPageContentPane, widthPageContentPane);
 684         cadjPage.setSlotSize(110, 110);
 685         for (NamedEffect namedEffect : new slotColorAdjust().getNamedEffectList()) {
 686             cadjPage.add(new slotColorAdjust(namedEffect),namedEffect.name);
 687         }
 688 
 689         // ======== DISPLACEMENT MAP =================
 690         final PageWithSlots mapPage = new PageWithSlots(Pages.Map.name(), heightPageContentPane, widthPageContentPane);
 691         mapPage.setSlotSize(120, 120);
 692         for (NamedEffect namedEffect : new slotDisplacementMap().getNamedEffectList()) {
 693             mapPage.add(new slotDisplacementMap(namedEffect),namedEffect.name);
 694         }
 695         // ======== DROP SHADOW =================
 696         final PageWithSlots dropPage = new PageWithSlots(Pages.DropShadow.name(), heightPageContentPane, widthPageContentPane);


 701 
 702         // ======== ColorInput (FLOOD) =================
 703         final PageWithSlots floodPage = new PageWithSlots(Pages.Flood.name(), heightPageContentPane, widthPageContentPane);
 704         floodPage.add(new slotFloodSimplePaint(), "Simple_Paint");
 705         floodPage.add(new slotFloodGradPaint(), "Grad_Paint");
 706         floodPage.add(new slotFloodAlphaPaint(), "Alpha_Paint");
 707 
 708         // ======== GaussianBlur =================
 709         final PageWithSlots gauPage = new PageWithSlots(Pages.GaussianBlur.name(), heightPageContentPane, widthPageContentPane);
 710         gauPage.setSlotSize(180, 180);
 711         for (final Float radius : new Float[]{0f, 10f, 30f, 63f}) {
 712             GaussianBlur gb = new GaussianBlur();
 713             gb.setRadius(radius);
 714             gauPage.add(new slotWithDefaultDrawNode(gb),"Threshold_" + radius);
 715         }
 716 
 717         // ======== Glow =================
 718         final PageWithSlots glowPage = new PageWithSlots(Pages.Glow.name(), heightPageContentPane, widthPageContentPane);
 719         glowPage.setSlotSize(160, 160);
 720         for (final Float level : new Float[] {0f, 0.3f, 0.7f, 1f}) {
 721                     Glow gl = new Glow(level);
 722             glowPage.add(new slotWithTextNode(gl),"Level_" + level);
 723         }
 724 
 725         // ======== INNER SHADOW =================
 726         final PageWithSlots innershadowPage = new PageWithSlots(Pages.InnerShadow.name(), heightPageContentPane, widthPageContentPane);
 727         innershadowPage.setSlotSize(140, 140);
 728         for (NamedEffect namedEffect : new slotInnerShadow().getNamedEffectList()) {
 729             innershadowPage.add(new slotInnerShadow(namedEffect),namedEffect.name);
 730         }
 731 
 732         // ======== Lightning SHADOW =================
 733         final PageWithSlots lightningPage = new PageWithSlots(Pages.Lightning.name(), heightPageContentPane, widthPageContentPane);
 734         lightningPage.setSlotSize(140, 140);
 735         for (NamedEffect namedEffect : new slotLightningShadow().getNamedEffectList()) {
 736             lightningPage.add(new slotLightningShadow(namedEffect),namedEffect.name);
 737         }
 738 
 739         // ======== MotionBlur =================
 740         final PageWithSlots motionBlurPage = new PageWithSlots(Pages.MotionBlur.name(), heightPageContentPane, widthPageContentPane);
 741         motionBlurPage.setSlotSize(120, 120);
 742         for (final int radius : new int[] {0, 10, 20}) {
 743             for (final int angle : new int[] {0, 45, 160, 315}) {
 744                 motionBlurPage.add(new slotWithTextNode(new MotionBlur(angle, radius)), "Angle_" + angle + "_Radius_" + radius);

 745             }
 746         }
 747 
 748         // ======== PerspectiveTransform =================
 749         final PageWithSlots perspectiveTransformPage = new PageWithSlots(Pages.Transform.name(), heightPageContentPane, widthPageContentPane);
 750         perspectiveTransformPage.setSlotSize(140, 140);
 751         for (NamedEffect namedEffect : new slotPerspectiveTransform().getNamedEffectList()) {
 752             perspectiveTransformPage.add(new slotPerspectiveTransform(namedEffect),namedEffect.name);
 753         }
 754 
 755         // ======== Reflection =================
 756         final PageWithSlots reflectionPage = new PageWithSlots(Pages.Reflection.name(), heightPageContentPane, widthPageContentPane);
 757         reflectionPage.setSlotSize(140, 140);
 758         for (NamedEffect namedEffect : new slotReflection().getNamedEffectList()) {
 759             reflectionPage.add(new slotReflection(namedEffect),namedEffect.name);
 760         }
 761 
 762         // ============= SepiaTone ==================
 763         final PageWithSlots sepiaTonePage = new PageWithSlots(Pages.SepiaTone.name(), heightPageContentPane, widthPageContentPane);
 764         sepiaTonePage.setSlotSize(180, 180);