Package javafx.geometry

Examples of javafx.geometry.Point2D


    private static Rectangle2D getScreenBounds(Node node) {
        double windowX = node.getScene().getWindow().getX();
        double windowY = node.getScene().getWindow().getY();

        Point2D scenepos = node.localToScene(0, 0);

        windowX += scenepos.getX();
        windowY += scenepos.getY();

        return new Rectangle2D(windowX, windowY, node.getLayoutBounds().getWidth(), node.getLayoutBounds().getHeight());
    }
View Full Code Here


            this.added = added;
        }

        public void handle(MouseEvent e) {
            if (currentMoveNode.equals(added)) {
                Point2D delta = new Point2D(e.getScreenX() - moveStartPoint.getX(), e.getScreenY() - moveStartPoint.getY());
                double stageX = getScene().getWindow().getX();
                double stageY = getScene().getWindow().getY();

                stageX += delta.getX();
                stageY += delta.getY();

                Rectangle2D newBounds = new Rectangle2D(stageX, stageY, getScene().getWindow().getWidth(), getScene().getWindow().getHeight());

                // check screen bounds
                for (Screen screen : Screen.getScreensForRectangle(newBounds)) {
                    // Limit dragging over menu bar
                    if (screen.getVisualBounds().equals(Screen.getPrimary().getVisualBounds())
                            && OperatingSystem.getOS().isMac()
                            && stageY < screen.getVisualBounds().getMinY()) {
                        stageY = screen.getVisualBounds().getMinY();
                    }
                }

                getScene().getWindow().setX(stageX);
                getScene().getWindow().setY(stageY);
                moveStartPoint = new Point2D(e.getScreenX(), e.getScreenY());
                e.consume();
            }
        }
View Full Code Here

     * in which the content is displayed, measured from the left of it, to the right.
     * @param ORIGIN_Y Insert the Y coordinate, relative to the <i>area</i>
     * in which the content is displayed, measured from the top of it, to the bottom.
     */
    public final ContentBuilder origin(final int ORIGIN_X, final int ORIGIN_Y) {
        properties.put("origin", new SimpleObjectProperty<>(new Point2D(ORIGIN_X,ORIGIN_Y)));
        return this;
    }
View Full Code Here

    public List<Stop> getStops() {
        return sortedStops;
    }

    public Image getImage(final double WIDTH, final double HEIGHT) {
        return getImage(WIDTH, HEIGHT, new Point2D(WIDTH / 2.0, HEIGHT / 2.0));
    }
View Full Code Here

        }
        return RASTER;
    }

    public ImagePattern getFill(final Shape SHAPE) {
        return getFill(SHAPE, new Point2D(SHAPE.getLayoutBounds().getWidth() / 2.0, SHAPE.getLayoutBounds().getHeight() / 2.0));
    }
View Full Code Here

        int height = (int) HEIGHT <= 0 ? 100 : (int) HEIGHT;
        final WritableImage RASTER = new WritableImage(width, height);
        final PixelWriter PIXEL_WRITER = RASTER.getPixelWriter();
        Color color = Color.TRANSPARENT;
        if (center == null) {
            center = new Point2D(width / 2, height / 2);
        }

        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++) {
                double dx = x - center.getX();
View Full Code Here

    public ImagePattern apply(final Shape SHAPE) {
    double x      = SHAPE.getLayoutBounds().getMinX();
    double y      = SHAPE.getLayoutBounds().getMinY();
    double width  = SHAPE.getLayoutBounds().getWidth();
    double height = SHAPE.getLayoutBounds().getHeight();
    center        = new Point2D(width / 2.0, height / 2.0);
    return new ImagePattern(getImage(width, height), x, y, width, height, false);
    }
View Full Code Here

    private ObjectProperty<MatrixFont>      matrixFont;
    private ObjectProperty<Gap>             fontGap;
    private ObjectProperty<Align>           txtAlign;
   
    public Content(){
        this(MatrixColor.RED, Type.TEXT, new Point2D(0,0), new Rectangle(0,0,20000,20000), "", MatrixFont.FF_5x7,
                Gap.SIMPLE, Align.LEFT, Effect.NONE, PostEffect.STOP, 0, 10, RotationOrder.SINGLE, false);
    }
View Full Code Here

        CANVAS.setLayoutY(SHAPE.getLayoutBounds().getMinY());
        CANVAS.setClip(CLIP);
        // create the gradient with the given stops
        final GraphicsContext CTX          = CANVAS.getGraphicsContext2D();
        final Bounds          BOUNDS       = SHAPE.getLayoutBounds();
        final Point2D         CENTER       = new Point2D(BOUNDS.getWidth() / 2, BOUNDS.getHeight() / 2);
        final double          RADIUS       = Math.sqrt(BOUNDS.getWidth() * BOUNDS.getWidth() + BOUNDS.getHeight() * BOUNDS.getHeight()) / 2;
        final double          ANGLE_STEP   = 0.1;
        final GradientLookup COLOR_LOOKUP = new GradientLookup(STOPS);
        CTX.translate(CENTER.getX(), CENTER.getY());
        CTX.rotate(-90 + ROTATION_OFFSET);
        CTX.translate(-CENTER.getX(), -CENTER.getY());
        for (int i = 0, size = STOPS.length - 1; i < size; i++) {
            for (double angle = STOPS[i].getOffset() * 360; Double.compare(angle,STOPS[i + 1].getOffset() * 360) <= 0; angle += 0.1) {
                CTX.beginPath();
                CTX.moveTo(CENTER.getX() - RADIUS, CENTER.getY() - RADIUS);
                CTX.setFill(COLOR_LOOKUP.getColorAt(angle / 360));
                if (RADIUS > 0) {
                    CTX.fillArc(CENTER.getX() - RADIUS, CENTER.getY() - RADIUS, 2 * RADIUS, 2 * RADIUS, angle, ANGLE_STEP, ArcType.ROUND);
                } else {
                    CTX.moveTo(CENTER.getX() - RADIUS, CENTER.getY() - RADIUS);
                }
                CTX.fill();
            }
        }
    }
View Full Code Here

        if(getSkinnable().isFrameVisible()){
            Platform.runLater(()->{
                Image image = null;  
                switch (getSkinnable().getFrameDesign()) {
                    case BLACK_METAL:
                        ConicalGradient bmGradient = new ConicalGradient(new Point2D(width/2d,height/2d),
                                                                     new Stop(0.0000, Color.rgb(254, 254, 254)),
                                                                     new Stop(0.1250, Color.rgb(0, 0, 0)),
                                                                     new Stop(0.3472, Color.rgb(153, 153, 153)),
                                                                     new Stop(0.5000, Color.rgb(0, 0, 0)),
                                                                     new Stop(0.6805, Color.rgb(153, 153, 153)),
                                                                     new Stop(0.8750, Color.rgb(0, 0, 0)),
                                                                     new Stop(1.0000, Color.rgb(254, 254, 254)));
                        image = bmGradient.apply(new Rectangle(width,height)).getImage();
                        break;
                    case CHROME:
                        ConicalGradient cmGradient = new ConicalGradient(new Point2D(width/2d,height/2d),
                                                                     new Stop(0.00, Color.WHITE),
                                                                     new Stop(0.09, Color.WHITE),
                                                                     new Stop(0.12, Color.rgb(136, 136, 138)),
                                                                     new Stop(0.16, Color.rgb(164, 185, 190)),
                                                                     new Stop(0.25, Color.rgb(158, 179, 182)),
                                                                     new Stop(0.29, Color.rgb(112, 112, 112)),
                                                                     new Stop(0.33, Color.rgb(221, 227, 227)),
                                                                     new Stop(0.38, Color.rgb(155, 176, 179)),
                                                                     new Stop(0.48, Color.rgb(156, 176, 177)),
                                                                     new Stop(0.52, Color.rgb(254, 255, 255)),
                                                                     new Stop(0.63, Color.WHITE),
                                                                     new Stop(0.68, Color.rgb(156, 180, 180)),
                                                                     new Stop(0.80, Color.rgb(198, 209, 211)),
                                                                     new Stop(0.83, Color.rgb(246, 248, 247)),
                                                                     new Stop(0.87, Color.rgb(204, 216, 216)),
                                                                     new Stop(0.97, Color.rgb(164, 188, 190)),
                                                                     new Stop(1.00, Color.WHITE));
                        image = cmGradient.apply(new Rectangle(width,height)).getImage();
                        break;
                    case SHINY_METAL:
                        Color c=getSkinnable().getFrameBaseColor();
                        ConicalGradient smGradient = new ConicalGradient(new Point2D(width/2d,height/2d),
                                                                 new Stop(0.0000, Color.rgb(254, 254, 254)),
                                                                 new Stop(0.1250, Util.darker(c, 0.15)),
                                                                 new Stop(0.2500, c.darker()),
                                                                 new Stop(0.3472, c.brighter()),
                                                                 new Stop(0.5000, c.darker().darker()),
View Full Code Here

TOP

Related Classes of javafx.geometry.Point2D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.