Package javafx.scene.shape

Examples of javafx.scene.shape.Shape


     */
    protected Shape createIndicatorShape(final IndicatorType indicatorType, final double x, final double y,
        final double width, final double height, final double pointDistance,
        final double gaugeCenterX, final double gaugeCenterY,
        final ObjectProperty<Paint> indicatorFillProperty) {
      Shape indicatorShape;
      switch (indicatorType) {
      case RECTANGLE: indicatorShape = new Rectangle(x, y, width, height);
        Bindings.bindBidirectional(indicatorShape.fillProperty(), indicatorFillProperty);
        break;
      case CLOCK: indicatorShape = new Polygon(
          x, y,
          x - pointDistance, y + (height / 2d)
          x, y + height,
          x + width, y + (height / 2d) + (height / 4d),
          x + width, y + (height / 4d));
        Bindings.bindBidirectional(indicatorShape.fillProperty(), indicatorFillProperty);
        break;
      case KNOB:
        indicatorShape = new Polygon(
              x, y,
              x - pointDistance, y + (indicatorHeight / 2d)
              x, y + indicatorHeight,
              x + (indicatorWidth / 2d), y + (indicatorHeight / 2d) + (indicatorHeight / 4d),
              x + (indicatorWidth / 2d), y + (indicatorHeight / 4d));
        Bindings.bindBidirectional(indicatorShape.fillProperty(), indicatorFillProperty);
        indicatorShape.setStroke(Color.WHITESMOKE);
        indicatorShape.setStrokeWidth(2d);
        indicatorShape.setStrokeType(StrokeType.CENTERED);
        indicatorShape.setEffect(createLighting());
        break;
      case NEEDLE: default: indicatorShape = new Polygon(
        x, y + (height / 2.5d),
        x, y + height - (height / 2.5d),
        x + width - pointDistance, y + height,
        x + width, y + (height / 2d),
        x + width - pointDistance, y);
        Bindings.bindBidirectional(indicatorShape.fillProperty(), indicatorFillProperty);
        break;
      }
      indicatorShape.setCache(true);
      indicatorShape.setCacheHint(CacheHint.QUALITY);
      //indicatorShape.setEffect(createLighting());
      return indicatorShape; 
    }
View Full Code Here


  protected void layoutChildren() {
    doLayout();
  }

  private void doLayout() {
    Shape cumulativeClip = null;
    int selectedIndex = getSkinnable().getFocusModel().getFocusedIndex();

    /*
     * Positions the Cells in front-to-back order.  This is done in order to clip the reflections
     * of cells positioned behind other cells using a cumulative clip.  Reflections would otherwise
     * blend with each other as they are partially transparent in nature.
     */

    ListIterator<Node> iterator = getChildren().listIterator(getChildren().size());

    while(iterator.hasPrevious()) {
      @SuppressWarnings("unchecked")
      CarouselCell<T> cell = (CarouselCell<T>)iterator.previous();

      cell.setVisible(!cell.isEmpty());

      if(!cell.isEmpty()) {
        Shape clip = layoutCell(cell, selectedIndex - cell.getIndex() - fractionalIndex);

        layoutInArea(cell, getWidth() / 2, getHeight() / 2, 0, 0, 0, HPos.CENTER, VPos.CENTER);

        if(cumulativeClip != null) {
          Shape cellClip = Shape.intersect(cumulativeClip, new Rectangle(0, 0, getWidth(), getHeight()))// TODO there must be a better way to just copy a Shape...
          Point2D localToParent = cell.localToParent(0, 0);

          cellClip.getTransforms().add(new Translate(-localToParent.getX(), -localToParent.getY()));

          cell.setClip(cellClip);
        }
        else {
          cell.setClip(null);
View Full Code Here

        }
        if (CANVAS.getLayoutBounds().getHeight() < SHAPE.getLayoutBounds().getHeight()) {
            CANVAS.setHeight(SHAPE.getLayoutBounds().getHeight());
        }
        // create clip shape
        final Shape CLIP = SHAPE;
        CLIP.setTranslateX(-SHAPE.getLayoutBounds().getMinX());
        CLIP.setTranslateY(-SHAPE.getLayoutBounds().getMinY());
        // adjust position of canvas in relation to shape
        CANVAS.setLayoutX(SHAPE.getLayoutBounds().getMinX());
        CANVAS.setLayoutY(SHAPE.getLayoutBounds().getMinY());
        CANVAS.setClip(CLIP);
        // create the gradient with the given stops
View Full Code Here

TOP

Related Classes of javafx.scene.shape.Shape

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.