public static void drawShadow(Image image, double scale, GraphicsContext dst) { final double shadowSize = scale * SHADOW_SIZE; final double shadowBlur = scale * SHADOW_BLUR; GaussianBlur blur = new GaussianBlur(shadowBlur); dst.drawImage(image, shadowSize * 2 / 3, shadowSize); dst.applyEffect(blur); ColorAdjust colorAdjust = new ColorAdjust(); colorAdjust.setBrightness(SHADOW_BRIGHTNESS); dst.applyEffect(colorAdjust); dst.drawImage(image, 0, shadowSize); dst.applyEffect(colorAdjust); }
/** * Creates a UI display monitor for provided worker. * * Assumes the worker is reporting progress as work done on a scale from 0 to 100 (other values indicate indeterminate progress). * * @param worker the worker whose progress is to be monitored and displayed. */ public LoadingProgressDisplay(Worker worker) { setMaxWidth(Double.MAX_VALUE); ColorAdjust bleach = new ColorAdjust(); bleach.setSaturation(-0.6); setEffect(bleach); HBox.setHgrow(this, Priority.ALWAYS); visibleProperty().bind(worker.runningProperty()); // as the webview load progresses update progress. worker.workDoneProperty().addListener((observableValue, oldNumber, newNumber) -> { if (newNumber == null) newNumber = -1.0; final double newValue = newNumber.doubleValue(); if (newValue < 0.0 || newValue > 100.0) { setProgress(ProgressBar.INDETERMINATE_PROGRESS); } setProgress(newValue / 100.0); }); }
protected Effect setInputEffect(Effect a, Effect b) { // I don't know a better way to chain effects, it's missing in FX // https://bugs.openjdk.java.net/browse/JDK-8091895 // perhaps try Blend: // https://community.oracle.com/thread/2337194?tstart=0 if(b instanceof GaussianBlur) { ((GaussianBlur)b).setInput(a); } else if(b instanceof ColorAdjust) { ((ColorAdjust)b).setInput(a); } else { throw new Error("todo: does " + b + " have setInput()?"); } return b; }
List<NamedEffect> getNamedEffectList() { List<NamedEffect> nes = new ArrayList<NamedEffect>(); nes.add(new NamedEffect("defaults", new ColorAdjust())); nes.add(new NamedEffect("brightness 0.7", new ColorAdjust() {{ setBrightness(0.7f); }})); nes.add(new NamedEffect("brightness -0.7", new ColorAdjust() {{ setBrightness(-0.7f); }})); nes.add(new NamedEffect("contrast 0.5", new ColorAdjust() {{ setContrast(-0.75f); }})); nes.add(new NamedEffect("contrast 3", new ColorAdjust() {{ setContrast(0.75); }})); nes.add(new NamedEffect("hue 0.7", new ColorAdjust() {{ setHue(0.7f); }})); nes.add(new NamedEffect("hue -0.7", new ColorAdjust() {{ setHue(-0.7f); }})); nes.add(new NamedEffect("saturation 0.7", new ColorAdjust() {{ setSaturation(0.7f); }})); nes.add(new NamedEffect("saturation -0.7", new ColorAdjust() {{ setSaturation(-0.7f); }})); nes.add(new NamedEffect("B 0.7, C 1.5, H 0.5, S -0.5", new ColorAdjust() {{ setSaturation(-0.5f); setHue(0.5f); setContrast(1.5f); setBrightness(0.7f); }})); return nes; }
/** * Creates a new RuleModalStage to be used in the Rule creation and removal. * * @param primaryStage * The primary stage of the application. */ public ModalStage(Stage primaryStage) { super(StageStyle.TRANSPARENT); this.primaryStage = primaryStage; initModality(Modality.WINDOW_MODAL); initOwner(primaryStage); colorAdjust = new ColorAdjust(); colorAdjust.setBrightness(-0.275); setOnCloseRequest(Event::consume); setResizable(false); Scene scene = new Scene(new HBox(), 800, 580); scene.getStylesheets().add(ClassLoader.getSystemResource(Constants.RSC_CSS_SHARED).toExternalForm()); scene.getStylesheets().add(ClassLoader.getSystemResource(Constants.RSC_CSS_MODAL).toExternalForm()); setScene(scene); }
/** * The stage of the SIP exportation panels * * @param primaryStage * The primary stage of the application */ public CreationModalStage(Stage primaryStage) { super(StageStyle.TRANSPARENT); this.primaryStage = primaryStage; initModality(Modality.WINDOW_MODAL); initOwner(primaryStage); colorAdjust = new ColorAdjust(); colorAdjust.setBrightness(-0.275); setOnCloseRequest(Event::consume); setResizable(true); Scene scene = new Scene(new HBox()); scene.getStylesheets().add(ClassLoader.getSystemResource(Constants.RSC_CSS_MODAL).toExternalForm()); scene.getStylesheets().add(ClassLoader.getSystemResource(Constants.RSC_CSS_SHARED).toExternalForm()); setScene(scene); }
/** * The stage of the SIP exportation panels * * @param primaryStage * The primary stage of the application */ public RenameModalStage(Stage primaryStage) { super(StageStyle.TRANSPARENT); this.primaryStage = primaryStage; initModality(Modality.WINDOW_MODAL); initOwner(primaryStage); colorAdjust = new ColorAdjust(); colorAdjust.setBrightness(-0.275); setOnCloseRequest(Event::consume); setResizable(true); Scene scene = new Scene(new HBox(), 400, PREPARATION_HEIGHT); scene.getStylesheets().add(ClassLoader.getSystemResource(Constants.RSC_CSS_MODAL).toExternalForm()); scene.getStylesheets().add(ClassLoader.getSystemResource(Constants.RSC_CSS_SHARED).toExternalForm()); setScene(scene); }
private void createTargetButton() { target = (StackPane) lookup("#targetAnchor"); Image image = IconFactory.getTargetIcon(); ImageView targetIcon = new ImageView(image); targetIcon.setClip(new ImageView(image)); ColorAdjust monochrome = new ColorAdjust(); monochrome.setSaturation(-1.0); Blend red = new Blend(BlendMode.MULTIPLY, monochrome, new ColorInput(0, 0, targetIcon.getImage().getWidth(), targetIcon.getImage().getHeight(), Color.RED)); Blend green = new Blend(BlendMode.MULTIPLY, monochrome, new ColorInput(0, 0, targetIcon.getImage().getWidth(), targetIcon.getImage().getHeight(), new Color(0, 1, 0, 0.5))); targetButton = targetIcon; targetIcon.effectProperty().bind(Bindings.when(targetButton.hoverProperty()).then((Effect) green).otherwise((Effect) red)); targetButton.setId("target_button"); hideTargetMarker(); target.getChildren().add(targetButton); }
private void removeEffect(Node node, int duration) { if (node != null) { node.setMouseTransparent(false); removeEffectTimeLine = new Timeline(); GaussianBlur blur = (GaussianBlur) node.getEffect(); if (blur != null) { KeyValue kv1 = new KeyValue(blur.radiusProperty(), 0.0); KeyFrame kf1 = new KeyFrame(Duration.millis(getDuration(duration)), kv1); removeEffectTimeLine.getKeyFrames().add(kf1); ColorAdjust darken = (ColorAdjust) blur.getInput(); KeyValue kv2 = new KeyValue(darken.brightnessProperty(), 0.0); KeyFrame kf2 = new KeyFrame(Duration.millis(getDuration(duration)), kv2); removeEffectTimeLine.getKeyFrames().add(kf2); removeEffectTimeLine.setOnFinished(actionEvent -> { node.setEffect(null); removeEffectTimeLine = null; }); removeEffectTimeLine.play(); } else { node.setEffect(null); removeEffectTimeLine = null; } } }
@Override public void draw(DungeonTileRenderer renderer, GraphicsContext g) { g.setFill(this.stairPaint); g.fillRect(0, 0, 1, 1); g.setFill(this.stairPaint); g.setEffect(new ColorAdjust(0, 0, -0.3, 0)); g.fillRect(0, SIZE_STEP, 1, SIZE_STEP); }
/** * Generates a random {@link ColorAdjust} the a ship. * @return The new color for the ship. */ public static ColorAdjust randomColor(){ ColorAdjust blackout = new ColorAdjust(); Color color = Color.color(Math.random(), Math.random(), Math.random()); System.out.println("color hue: " + color.getHue()); double hue = map( (color.getHue() + 180) % 360, -1); System.out.println("hue: " + hue); blackout.setHue(hue); return blackout; }
@Override public void select (Selector selector) { ColorAdjust colorAdjust = new ColorAdjust(); colorAdjust.setBrightness(selector.getLightness()); this.setEffect(colorAdjust); this.setEffect(new Glow(selector.getGlow())); }
/** * determine selector for the object */ public void select (Selector selector) { ColorAdjust colorAdjust = new ColorAdjust(); colorAdjust.setBrightness(selector.getLightness()); this.setEffect(colorAdjust); this.setEffect(new Glow(selector.getGlow())); }
protected Node makePlane() { FxIconBuilder b = new FxIconBuilder(500); b.setFill(Color.gray(1, 0.7)); b.fill(); b.setOpacity(0.5); b.addEffect(new GaussianBlur(4)); b.addEffect(new ColorAdjust(0, -0.8, 0, 0)); b.setTranslate(-150, -150); try { b.image(CKit.readLocalBytes(TestFxIconBuilder.class, "ground.png")); } catch(Exception e) { Log.ex(e); } b.setEffect(null); b.setOpacity(1); b.setFill(Color.YELLOW); b.setStrokeColor(FX.mix(Color.YELLOW, Color.BLACK, 0.7)); b.setStrokeWidth(10); b.setScale(0.1); b.setTranslate(-600, -600); b.setEffect(new DropShadow(300, 300, 300, Color.BLACK)); b.setRotate(0.5); b.svgPath("m1696.665161,1345.895996c0,0 2.263428,9.05481 2.009399,18.580444c-0.242432,9.33374 -3.01416,29.730469 -3.01416,25.085327c0,-4.644897 -9.025146,-10.449951 -9.025146,-10.449951l-1.259033,8.125l-7.021362,0.235229l-0.248169,-13.010864l-213.013794,-89.416504c0,0 -0.248169,-11.150513 -1.25293,-11.380371c-0.248291,11.14502 0.502319,18.580322 -1.004761,19.505127c-2.003662,-0.694946 -235.744873,-96.775757 -240.8573,-99.407349c-2.25769,-1.159912 -1.004761,-10.679688 -1.004761,-10.679688l-60.214233,-8.360229l-0.248169,7.429688c0,0 -126.705688,-16.490234 -130.216309,-14.400269c-3.510742,2.09021 3.268555,128.20813 -2.76001,213.680054c-6.022705,85.466675 -16.306396,131.452637 -20.821777,147.942993c-4.214355,15.390747 -0.750854,18.810059 7.275513,25.315552c8.026001,6.505371 169.348145,117.062744 182.900635,126.582886c13.303833,9.35022 13.552124,13.623291 13.552124,19.275269c0,7.42981 0.248413,56.435913 0.248413,56.435913l-224.55072,-50.630737c0,0 -1.25885,20.664551 -4.515381,23.684814c-3.268494,3.025879 -10.036011,1.860229 -10.036011,1.860229c0,0 -4.521423,42.971313 -7.02124,45.756226c-2.512085,2.785156 -6.773071,4.17981 -6.773071,4.17981c0,0 -10.012268,44.312012 -14.616211,45.471924c0,0.016602 0,0.043579 0,0.054688c-0.035645,0 -0.071289,-0.021973 -0.094543,-0.027466c-0.035645,0.005493 -0.070984,0.027466 -0.094666,0.027466c0,-0.011108 0,-0.038086 0,-0.054688c-4.604065,-1.159912 -14.62207,-45.471924 -14.62207,-45.471924c0,0 -4.267578,-1.394653 -6.773438,-4.17981c-2.505859,-2.790283 -7.021545,-45.756226 -7.021545,-45.756226c0,0 -6.773071,1.165649 -10.035645,-1.860229c-3.262512,-3.020264 -4.515442,-23.684814 -4.515442,-23.684814l-224.550537,50.630737c0,0 0.247986,-49.006104 0.247986,-56.435913c0,-5.651978 0.248352,-9.925049 13.546448,-19.275269c13.546814,-9.520142 174.874695,-120.077515 182.900879,-126.582886c8.026306,-6.505493 11.489502,-9.924805 7.275452,-25.315552c-4.515381,-16.490356 -14.799377,-62.476318 -20.821899,-147.942993c-6.022705,-85.471924 0.750549,-211.589844 -2.760071,-213.680054c-3.510681,-2.089966 -130.216248,14.400269 -130.216248,14.400269l-0.248169,-7.429688l-60.214294,8.360229c0,0 1.25293,9.519775 -1.004944,10.679688c-5.112305,2.631592 -238.853577,98.712402 -240.857056,99.407349c-1.507141,-0.930176 -0.750641,-8.360107 -1.004852,-19.505127c-1.004669,0.229858 -1.253021,11.380371 -1.253021,11.380371l-213.019516,89.416504l-0.248169,13.010864l-7.021637,-0.235229l-1.25293,-8.125c0,0 -9.031006,5.810425 -9.031006,10.449951c0,4.639771 -2.765961,-15.751587 -3.008469,-25.085327c-0.248169,-9.520386 2.009674,-18.580444 2.009674,-18.580444c0,0 -7.275681,2.089722 -6.524902,-6.735229c0.484406,-5.630005 19.320663,-31.35022 19.320663,-31.35022c0,0 1.335785,-3.857422 1.105377,-6.581787c-0.266083,-3.167847 3.906494,-5.208862 6.111176,-7.019897c1.276733,-1.044922 -0.136017,-6.789673 -0.136017,-6.789673c0,0 70.586868,-56.031128 192.889267,-143.812134c122.101288,-87.63855 266.614288,-195.093994 266.614288,-195.093994c0,0 0,-6.193481 -1.335693,-14.865417c-1.341736,-8.666382 -2.340332,-12.386841 -2.340332,-12.386841c0,0 -7.358521,-2.166748 -9.367859,-7.742065c-1.495239,-4.158081 -5.348877,-34.375854 -4.681091,-61.62793c0.667908,-27.252625 2.340454,-41.494263 4.349976,-45.832886c2.003479,-4.333313 8.788452,-6.253723 17.394043,-7.430176c9.030945,-1.236389 44.079224,-0.47052 52.519226,0.618286c8.014221,1.034119 13.049805,2.166687 14.385559,12.698792c1.335815,10.526978 1.672668,46.757507 0.667908,61.622925c-0.715027,10.581299 -3.68219,22.6073 -2.009521,23.225464c1.672668,0.618164 30.775146,-25.703918 46.833374,-36.230652c16.058228,-10.532349 43.488098,-32.515869 46.833374,-39.327393c3.345337,-6.811707 3.68219,-7.74176 5.685852,-1.548401c2.003479,6.193481 1.672363,12.387024 -1.004944,16.720093c-2.677429,4.333252 -4.013,9.914001 -1.341614,12.387024c1.004944,0.930054 9.031128,-5.263306 11.040466,-8.983826c2.009399,-3.715088 0,-10.838623 1.341736,-13.935242c1.341614,-3.096802 6.577942,-12.080688 6.353638,-19.510681c-1.335876,-44.284241 -2.961121,-110.552246 -3.345398,-255.480347c-0.407776,-155.088196 1.253113,-201.418945 22.411865,-284.281097c19.208618,-75.218842 33.641724,-90.095245 41.029541,-100.944687c6.832336,-10.028824 22.252502,-17.819885 28.706299,-17.956787c0,0 0,-0.010818 0,-0.010818c0.023865,0 0.059204,0.005432 0.094543,0.005432c0.023682,0 0.059021,-0.005432 0.094666,-0.005432c0,0 0,0.010818 0,0.010818c6.448059,0.136902 21.862366,7.933395 28.694519,17.956787c7.388123,10.843872 21.815186,25.725845 41.029297,100.944687c21.159302,82.862152 22.819824,129.192902 22.412109,284.281097c-0.378418,144.928101 -2.009277,211.201416 -3.345337,255.480347c-0.218506,7.429993 5.023682,16.413879 6.359619,19.510681c1.335815,3.096619 -0.667847,10.220154 1.341675,13.935242c2.00354,3.715088 10.029785,9.913879 11.034546,8.983826c2.67749,-2.478455 1.341675,-8.053772 -1.341919,-12.387024c-2.682983,-4.333069 -3.014038,-10.526611 -1.004395,-16.720093c2.009399,-6.193359 2.340332,-5.263306 5.691284,1.548401c3.339478,6.811523 30.775391,28.800781 46.833618,39.327393c16.05835,10.526733 45.160522,36.848816 46.833252,36.230652c1.672485,-0.618164 -1.294678,-12.644165 -2.009399,-23.225464c-1.004883,-14.865417 -0.668091,-51.095947 0.667725,-61.622925c1.335571,-10.526672 6.371338,-11.659241 14.385742,-12.698792c8.445801,-1.094177 43.488281,-1.854675 52.525146,-0.618286c8.599365,1.181885 15.390381,3.096863 17.394043,7.430176c2.009399,4.333069 3.682007,18.580261 4.349854,45.832886c0.661987,27.252075 -3.19165,57.469849 -4.68689,61.62793c-2.009277,5.575317 -9.36792,7.742065 -9.36792,7.742065c0,0 -1.004761,3.714722 -2.340332,12.386841c-1.341797,8.671936 -1.341797,14.865417 -1.341797,14.865417c0,0 144.513184,107.460693 266.608398,195.093994c122.302368,87.781006 192.89502,143.812134 192.89502,143.812134c0,0 -1.418335,5.744751 -0.135742,6.789673c2.20459,1.811035 6.377319,3.852051 6.105469,7.019897c-0.230591,2.724365 1.105347,6.581787 1.105347,6.581787c0,0 18.841797,25.720215 19.326538,31.35022c0.73877,8.824951 -6.536743,6.735229 -6.536743,6.735229zm-1463.317642,-65.151733l-14.143494,10.03418l1.223557,1.477417l14.267349,-10.12207l-1.347412,-1.389526zm28.363449,-20.123291l-26.767807,18.990723l1.341614,1.389771l26.655563,-18.914307l-1.22937,-1.466187zm28.422821,-20.167114l-26.826935,19.034302l1.22937,1.471802l26.661285,-18.91394l-1.063721,-1.592163zm35.810577,-25.403076l-34.208954,24.270508l1.063965,1.592285l34.326996,-24.358154l-1.182007,-1.504639zm33.020996,-23.422607l-31.431244,22.289917l1.182251,1.504761l31.460541,-22.322754l-1.211548,-1.471924zm33.381378,-23.679565l-31.785736,22.547363l1.217682,1.482666l31.726563,-22.509033l-1.158508,-1.520996zm34.516479,-24.494873l-32.926575,23.362427l1.158386,1.515503l33.139252,-23.510132l-1.371063,-1.367798zm34.835144,-24.713623l-33.233521,23.581299l1.365234,1.367554l33.008972,-23.416748l-1.140686,-1.532104zm34.545746,-24.505737l-32.949799,23.373169l1.140564,1.531982l32.837921,-23.30188l-1.028687,-1.603271zm34.291901,-24.330811l-32.690155,23.187378l1.028442,1.613892l32.808197,-23.274658l-1.146484,-1.526611zm32.967529,-23.384033l-31.371826,22.246094l1.146545,1.526733l31.425232,-22.290039l-1.199951,-1.482788zm32.932495,-23.362366l-31.33667,22.229919l1.205811,1.482544l31.1651,-22.109009l-1.034241,-1.603455zm38.801208,-27.536682l-37.199646,26.393372l1.034363,1.608643l37.028015,-26.267639l-0.862732,-1.734375zm10.14801,-7.19458l-8.510864,6.040222l0.857056,1.728821l8.445801,-5.996338l-0.791992,-1.772705zm31.785522,-22.546997l-30.130615,21.376221l0.792053,1.778137l30.562012,-21.682678l-1.22345,-1.47168zm531.798706,0l-1.223633,1.477112l30.568115,21.682678l0.786133,-1.778259l-30.130615,-21.381531zm31.779541,22.546997l-0.786133,1.778137l8.451782,5.996338l0.857056,-1.728821l-8.522705,-6.045654zm10.154053,7.19458l-0.862793,1.734375l37.034058,26.267639l1.028198,-1.608643l-37.199463,-26.393372zm38.801147,27.536682l-1.03418,1.608948l31.165039,22.109253l1.205811,-1.48291l-31.33667,-22.235291zm32.932373,23.362366l-1.205811,1.482788l31.425049,22.290039l1.140869,-1.526733l-31.360107,-22.246094zm32.967773,23.384033l-1.146484,1.526611l32.807739,23.274658l1.028564,-1.613892l-32.689819,-23.187378zm34.285767,24.330811l-1.028198,1.608643l32.843384,23.30188l1.140869,-1.53186l-32.956055,-23.378662zm34.551636,24.505737l-1.140625,1.526611l33.00293,23.416748l1.371582,-1.367798l-33.233887,-23.575562zm34.835205,24.713623l-1.36499,1.367798l33.13916,23.510132l1.152222,-1.515503l-32.926392,-23.362427zm34.516235,24.494873l-1.152466,1.515503l31.726563,22.508789l1.211914,-1.482666l-31.786011,-22.541626zm33.381714,23.679565l-1.211548,1.477295l31.460327,22.322754l1.17627,-1.504639l-31.425049,-22.29541zm33.020996,23.422607l-1.176514,1.499268l34.333374,24.358032l1.063843,-1.592163l-34.220703,-24.265137zm35.810303,25.403076l-1.063477,1.586426l26.661377,18.914307l1.229126,-1.471558l-26.827026,-19.029175zm28.423096,20.167114l-1.229614,1.466187l26.65564,18.914307l1.347656,-1.389771l-26.773682,-18.990723zm28.369385,20.123291l-1.347656,1.389526l14.2677,10.12207l1.217407,-1.477417l-14.137451,-10.03418z"); return b.getIcon(); }
public void setColor(Color color) { this.color = color; if (color == null) { imageView.setEffect(null); } else { imageView.setEffect(new ColorAdjust(color.getHue() / 180 - colorOffset, 0.3, 0, 0)); } }
private void refreshHSLCircle() { ColorAdjust colorAdjust = new ColorAdjust(); colorAdjust.setHue(map(currentHue + (currentHue < 127.5 ? 1 : -1) * 127.5, 0, 255, -1, 1)); slCircleView.setEffect(colorAdjust); setColorAtLocation((int) selector.getTranslateX() + selectorSize / 2, (int) selector.getTranslateY() + selectorSize / 2); }
private static void applyFontColor(ImageView image, Color color) { ColorAdjust monochrome = new ColorAdjust(); monochrome.setSaturation(-1.0); Effect colorInput = new ColorInput(0, 0, image.getImage().getWidth(), image.getImage().getHeight(), color); Blend blend = new Blend(BlendMode.MULTIPLY, new ImageInput(image.getImage()), colorInput); image.setClip(new ImageView(image.getImage())); image.setEffect(blend); image.setCache(true); }
/** * Colorizes all icons created by this provider to a choosen color (defined by the parameters). * * @param hue the hue of the color to be set * @param saturation the saturation of the color to be set * @param brightness the brightness of the color to be set * @param contrast the contrast of the color to be set */ public static void colorizeIcons(final double hue, final double saturation, final double brightness, final double contrast) { actColor = new ColorAdjust(hue, saturation, brightness, contrast); for (final ImageView imageView : imageViews) { imageView.setEffect(actColor); imageView.setSmooth(true); } }
/** * {@inheritDoc} */ @Override protected Collection<Decoration> createRequiredDecorations(Control target) { ImageView imageView = new ImageView(REQUIRED_IMAGE); // The following code will transform REQUIRED_IMAGE from red to blue. ColorAdjust adjust = new ColorAdjust(); adjust.setSaturation(-1); Blend bluemaker = new Blend(BlendMode.SRC_ATOP, adjust, new ColorInput(0, 0, imageView.getImage().getWidth(), imageView.getImage().getHeight(), Color.DEEPSKYBLUE)); imageView.setEffect(bluemaker); return Arrays.asList(new GraphicDecoration(imageView, Pos.TOP_LEFT, REQUIRED_IMAGE.getWidth() / 2, REQUIRED_IMAGE.getHeight() / 2)); }
/** * Given a monochrome image, apply a color to it * * @param imageView A view to the target monochrome image * @param color Target new image color */ public static void colorize(final ImageView imageView, final Paint color) { final ColorAdjust monochrome = new ColorAdjust(); monochrome.setSaturation(-1.0); monochrome.setBrightness(0.75); final Blend selectionColorBlend = new Blend(BlendMode.SRC_ATOP, monochrome, new ColorInput(0, 0, imageView.getFitWidth(), imageView.getFitHeight(), color)); imageView.setEffect(selectionColorBlend); }
public Particle( Vector2D location, Vector2D velocity, Vector2D acceleration, double width, double height) { super( location, velocity, acceleration, width, height); // effect for this particle colorAdjust = new ColorAdjust(); setEffect(colorAdjust); }
/** * @param node * @return */ private ActionAnimation createShineStarAnimation(Node node) { ColorAdjust colorAdjust = (ColorAdjust) node.getEffect(); DropShadow dropShadow = (DropShadow) colorAdjust.getInput(); ActionAnimation brightAction = ActionAnimation.create().duration(600).cycles(2).autoReverse(); brightAction.add(dropShadow.radiusProperty(), 50); ActionAnimation colorAction = ActionAnimation.create().duration(600); colorAction.add(colorAdjust.brightnessProperty(), 0); colorAction.add(colorAdjust.saturationProperty(), 0); colorAction.onFinished(brightAction); return colorAction; }
/** * @return */ private ImageView createStarImage() { ColorAdjust colorAdjust = ColorEffect.grayTone(); colorAdjust.setInput(new DropShadow(10, Color.rgb(250, 209, 37))); ImageView starImage = new ImageView(R.image.star); starImage.setEffect(colorAdjust); return starImage; }
/** * @return */ protected ColorAdjust colorAdjust() { if(colorAdjust == null) { colorAdjust = ColorEffect.grayTone(); colorAdjust.setInput(dropShadow()); } return colorAdjust; }
public SlideshowPanel() { ColorAdjust brightness = new ColorAdjust(); brightness.setBrightness(-0.3); imageViewNew.setEffect(brightness); imageViewOld.setEffect(brightness); getChildren().add(imageViewOld); getChildren().add(imageViewNew); }
private void updateImageAdjustments() { double hue = Double.parseDouble(hueValue.getText()); double saturation = Double.parseDouble(saturationValue.getText()); double brightness = Double.parseDouble(brightnessValue.getText()); double contrast = Double.parseDouble(contrastValue.getText()); imageAdjustments = new ColorAdjust(); imageAdjustments.setContrast(contrast); imageAdjustments.setBrightness(brightness); imageAdjustments.setHue(hue); imageAdjustments.setSaturation(saturation); sourceImageView.setEffect(imageAdjustments); }
public PromptHandler( String message, String defaultValue, EventHandler<ActionEvent> submitHandler, EventHandler<ActionEvent> cancelHandler ) { super(14); // add controls to the popup. final Label promptMessage = new Label(message); promptMessage.setWrapText(true); final ImageView promptImage = new ImageView(ResourceUtil.getImage("help_64.png")); promptImage.setFitHeight(32); promptImage.setPreserveRatio(true); promptMessage.setGraphic(promptImage); promptMessage.setPrefWidth(350); final TextField inputField = new TextField(defaultValue); inputField.setTranslateY(-5); Platform.runLater(inputField::selectAll); // action button text setup. HBox buttonBar = new HBox(20); final Button submitButton = new Button(getString("dialog.submit")); submitButton.setDefaultButton(true); final Button cancelButton = new Button(getString("dialog.cancel")); cancelButton.setCancelButton(true); ColorAdjust bleach = new ColorAdjust(); bleach.setSaturation(-0.6); cancelButton.setEffect(bleach); buttonBar.getChildren().addAll(submitButton, cancelButton); // layout the popup. setPadding(new Insets(10)); getStyleClass().add("alert-dialog"); getChildren().addAll(promptMessage, inputField, buttonBar); final DropShadow dropShadow = new DropShadow(); setEffect(dropShadow); // submit and close the popup. submitButton.setOnAction(submitHandler); // submit and close the popup. cancelButton.setOnAction(cancelHandler); }
private void setupServiceListeners() { // handle each Worker.State log.log(Level.FINER, "Setting state listener."); EventStreams.valuesOf(neuralService.stateProperty()).subscribe(state -> { switch (state) { case SCHEDULED: log.log(Level.FINER, "Neural service: Scheduled."); statusLabel.setText(bundle.getString("neuralServiceStatusScheduled")); startButton.setDisable(true); stopButton.setDisable(false); progress.setProgress(0); break; case READY: log.log(Level.FINER, "Neural service: Ready."); statusLabel.setText(bundle.getString("neuralServiceStatusReady")); startButton.setDisable(false); stopButton.setDisable(true); break; case RUNNING: log.log(Level.FINER, "Neural service: Running."); statusLabel.setText(bundle.getString("neuralServiceStatusRunning")); startButton.setDisable(true); stopButton.setDisable(false); break; case SUCCEEDED: log.log(Level.FINER, "Neural service: Succeeded."); statusLabel.setText(bundle.getString("neuralServiceStatusFinished")); startButton.setDisable(false); stopButton.setDisable(true); progress.setProgress(100); break; case CANCELLED: log.log(Level.FINER, "Neural service: Cancelled."); statusLabel.setText(bundle.getString("neuralServiceStatusCancelled")); startButton.setDisable(false); stopButton.setDisable(true); break; case FAILED: log.log(Level.FINER, "Neural service: Failed."); statusLabel.setText(bundle.getString("neuralServiceStatusFailed")); startButton.setDisable(false); stopButton.setDisable(true); break; } }); log.log(Level.FINER, "Setting Image Output Service listener."); EventStreams.nonNullValuesOf(imageOutputService.valueProperty()).subscribe(valueProperty -> { log.log(Level.FINER, "Received updated Image Outputs from Service."); Map<String, Set<String>> results = imageOutputService.getValue(); updateNeuralOutputs(results); updateImageView(); }); log.log(Level.FINER, "Setting progress listener."); EventStreams.nonNullValuesOf(neuralService.progressProperty()) .subscribe(value -> progress.setProgress(value.doubleValue())); log.log(Level.FINER, "Setting running listener."); final ColorAdjust highlighted = new ColorAdjust(0, 0, 0.3, 0); EventStreams.nonNullValuesOf(neuralService.runningProperty()) .subscribe(running -> { if (running) statusLabel.setEffect(highlighted); else statusLabel.setEffect(null); }); }
/** render the application on a stage */ public StackPane createGUI() { SwingUtilities.invokeLater(() -> { //Simulation.instance().getJConsole().write(ADDRESS,Color.ORANGE,Color.BLACK); }); // place the address content in a bordered title pane. Pane titledContent = new BorderedTitledPane(TITLE, getContent()); titledContent.getStyleClass().add("titled-address"); titledContent.setPrefSize(800, 745); // make some crumpled paper as a background. final Image paper = new Image(PAPER); final ImageView paperView = new ImageView(paper); ColorAdjust colorAdjust = new ColorAdjust(0, -.2, .2, 0); paperView.setEffect(colorAdjust); // place the address content over the top of the paper. StackPane stackedContent = new StackPane(); stackedContent.getChildren().addAll(paperView, titledContent); // manage the viewport of the paper background, to size it to the content. paperView.setViewport(new Rectangle2D(0, 0, titledContent.getPrefWidth(), titledContent.getPrefHeight())); stackedContent.layoutBoundsProperty().addListener(new ChangeListener<Bounds>() { @Override public void changed(ObservableValue<? extends Bounds> observableValue, Bounds oldValue, Bounds newValue) { paperView.setViewport(new Rectangle2D( newValue.getMinX(), newValue.getMinY(), Math.min(newValue.getWidth(), paper.getWidth()), Math.min(newValue.getHeight(), paper.getHeight()) )); } }); // blend the content into the paper and make it look old. titledContent.setMaxWidth(paper.getWidth()); titledContent.setEffect(new SepiaTone()); titledContent.setBlendMode(BlendMode.MULTIPLY); // configure and display the scene and stage. //Scene scene = new Scene(stackedContent); //scene.getStylesheets().add(getClass().getResource("/css/gettysburg.css").toExternalForm()); /* stage.setTitle(TITLE); stage.getIcons().add(new Image(ICON)); stage.setScene(scene); stage.setMinWidth(600); stage.setMinHeight(500); stage.show(); */ // make the scrollbar in the address scroll pane hide when it is not needed. makeScrollFadeable(titledContent.lookup(".address > .scroll-pane")); return stackedContent; }
/** * Only create the UI, using the initial stream as default which is also * played at the start of the radio UI. * * @param parent * @param stream the initially activated stream. */ private void createUI(ControllablePanel parent, Stream stream) { setMinWidth(Mephisto3.WIDTH); VBox labelBox = new VBox(20); labelBox.getStyleClass().add("streams-panel"); labelBox.setMinHeight(Mephisto3.HEIGHT - 60); labelBox.setAlignment(Pos.TOP_LEFT); getChildren().add(labelBox); getChildren().add(serviceScroller); labelBox.setPadding(new Insets(20, 30, 30, 30)); artistBackgroundImageView = new ImageView(); ColorAdjust brightness = new ColorAdjust(); brightness.setBrightness(-0.3); artistBackgroundImageView.setEffect(brightness); parent.getChildren().add(artistBackgroundImageView); nameLabel = ComponentUtil.createLabel(stream.getName(), "stream-name", labelBox); HBox artistLabelBox = new HBox(); artistLabelBox.setMaxHeight(28); artistLabel = ComponentUtil.createLabel(LOADING_DATA_TITLE, "stream-artist", artistLabelBox); labelBox.getChildren().add(artistLabelBox); metaDataBusyIndicator = new ProgressIndicator(); artistLabelBox.getChildren().add(metaDataBusyIndicator); titleLabel = ComponentUtil.createLabel("", "stream-title", labelBox); HBox spacer = new HBox(); spacer.setMinHeight(70); labelBox.getChildren().add(spacer); imageLoader = new HBox(); imageLoader.setOpacity(0); imageLoader.setMinHeight(20); imageLoader.setMaxWidth(Mephisto3.WIDTH); imageLoader.setAlignment(Pos.CENTER_RIGHT); labelBox.getChildren().add(imageLoader); ComponentUtil.createLabel("Suche nach Bildern...", "", imageLoader); imageDataBusyIndicator = new ProgressIndicator(); imageLoader.getChildren().add(imageDataBusyIndicator); playerStatusBox = new StreamStatusBox(); getChildren().add(playerStatusBox); //set the initial UI state playerStatusBox.updateStatus(stream.getName(), null, null); }
private void darkenWithDistance(Node node, double zoomLevel) { double brightnessAdjust = -zoomLevel / 5; node.setEffect(new ColorAdjust(0, 0, brightnessAdjust, 0)); }
protected HasLocationPortrait(EconomicAgent agent, DoubleProperty xLocationProperty, DoubleProperty yLocationProperty) { this.agent =agent; this.xLocationProperty = xLocationProperty; this.yLocationProperty = yLocationProperty; nodeDelegate = new GUINodeSimple(); //load the image icon = new ImageView(); icon.setImage(initImage(agent)); this.getChildren().add(icon); //bind icon height to pref-height. The idea here is that when they resize this region, we resize the location portrait as well icon.fitWidthProperty().bind(prefWidthProperty()); icon.fitHeightProperty().bind(prefHeightProperty()); //this is to keep it with the right color ColorAdjust monochrome = new ColorAdjust(); //this is the first effect //monochrome.setBrightness(-1.0); //keep the color color= new SimpleObjectProperty<>(Color.BLACK); ColorInput input = new ColorInput(); //this is the second effect, the coloring proper input.setX(0); input.setY(0); input.widthProperty().bind(prefWidthProperty()); input.heightProperty().bind(prefHeightProperty()); input.paintProperty().bind(color); //bind the color adjust Blend coloring = new Blend(BlendMode.SRC_ATOP,monochrome,input); icon.effectProperty().setValue(coloring); setCache(true); setCacheHint(CacheHint.SPEED); //now set the text priceText = new Text(); this.getChildren().add(priceText ); priceText.setFont(Font.font("Verdana", 10)); priceText.setFill(Color.BLACK); }