List of usage examples for javafx.scene.paint ImagePattern ImagePattern
public ImagePattern(@NamedArg("image") Image image, @NamedArg("x") double x, @NamedArg("y") double y, @NamedArg("width") double width, @NamedArg("height") double height, @NamedArg("proportional") boolean proportional)
From source file:net.gazeplay.commons.utils.License.java
public License(double X, double Y, double width, double height, GazePlay gazePlay, Scene scene, Group root) { super(X, Y, width, height); this.setFill(new ImagePattern(new Image("data/common/images/license.png"), 0, 0, 1, 1, true)); EventHandler<Event> homeEvent = new EventHandler<javafx.event.Event>() { @Override//from w w w . j a v a2 s.c om public void handle(javafx.event.Event e) { if (e.getEventType() == MouseEvent.MOUSE_CLICKED) { root.getChildren().add(licence(width, height)); gazePlay.getHomeMenuScreen(); } } }; this.addEventHandler(MouseEvent.MOUSE_CLICKED, homeEvent); }
From source file:net.rptools.image.listeners.DrawHandler.java
/** * Main work method./*from ww w . j av a 2 s .c o m*/ * @param phase phase of drawing we are in * @param newEnd new end of current draw * @param pen pen color * @param fill fill color * @param radius pen radius */ @ThreadPolicy(ThreadPolicy.ThreadId.JFX) private void draw(final String phase, final Point2D newEnd, final String pen, final String fill, final int radius) { LOGGER.debug("phase={}; draw={}; pen={}; fill={}; radius={}", phase, newEnd, pen, fill, radius); if (phase.equals(START)) { currentShape = new Polygon(); getLayer().getDrawable().getChildren().add(currentShape); } if (currentShape == null) { return; } currentShape.getPoints().addAll(newEnd.getX(), newEnd.getY()); switch (fill.charAt(0)) { case '#': currentShape.setFill(Color.web(fill)); break; case '-': currentShape.setFill(null); break; default: if (currentFill == null) { currentFill = getLayer().loadImage(fill); } currentShape.setFill( new ImagePattern(currentFill, 0, 0, currentFill.getWidth(), currentFill.getHeight(), false)); } switch (pen.charAt(0)) { case '#': currentShape.setStroke(Color.web(pen)); break; case '-': currentShape.setStroke(null); break; default: if (currentPen == null) { currentPen = getLayer().loadImage(pen); } currentShape.setStroke( new ImagePattern(currentPen, 0, 0, currentPen.getWidth(), currentPen.getHeight(), false)); } currentShape.setStrokeLineCap(StrokeLineCap.ROUND); currentShape.setStrokeLineJoin(StrokeLineJoin.ROUND); currentShape.setStrokeWidth(radius); if (phase.equals(END)) { finalizeDrawing(); currentShape = null; currentPen = null; currentFill = null; } LOGGER.debug("draw polygon completed={}", currentShape == null); }