Java 类javafx.scene.shape.ArcType 实例源码

项目:lttng-scope    文件:ExampleCanvas.java   
private static void drawShapes(GraphicsContext gc) {
    gc.setFill(Color.GREEN);
    gc.setStroke(Color.BLUE);
    gc.setLineWidth(5);
    gc.strokeLine(40, 10, 10, 40);
    gc.fillOval(10, 60, 30, 30);
    gc.strokeOval(60, 60, 30, 30);
    gc.fillRoundRect(110, 60, 30, 30, 10, 10);
    gc.strokeRoundRect(160, 60, 30, 30, 10, 10);
    gc.fillArc(10, 110, 30, 30, 45, 240, ArcType.OPEN);
    gc.fillArc(60, 110, 30, 30, 45, 240, ArcType.CHORD);
    gc.fillArc(110, 110, 30, 30, 45, 240, ArcType.ROUND);
    gc.strokeArc(10, 160, 30, 30, 45, 240, ArcType.OPEN);
    gc.strokeArc(60, 160, 30, 30, 45, 240, ArcType.CHORD);
    gc.strokeArc(110, 160, 30, 30, 45, 240, ArcType.ROUND);
    gc.fillPolygon(new double[]{10, 40, 10, 40},
                   new double[]{210, 210, 240, 240}, 4);
    gc.strokePolygon(new double[]{60, 90, 60, 90},
                     new double[]{210, 210, 240, 240}, 4);
    gc.strokePolyline(new double[]{110, 140, 110, 140},
                      new double[]{210, 210, 240, 240}, 4);
}
项目:medusademo    文件:InteractiveGaugeSkin.java   
private void drawGradientBar() {
    double     xy     = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.115 * size : 0.0515 * size;
    double     wh     = TickLabelLocation.OUTSIDE == tickLabelLocation ? size * 0.77 : size * 0.897;
    double     offset = 90 - startAngle;
    List<Stop> stops  = getSkinnable().getGradientBarStops();
    Map<Double, Color> stopAngleMap     = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * angleRange, stop.getColor()); }
    double                  offsetFactor        = ScaleDirection.CLOCKWISE == scaleDirection ? (startAngle - 90) : (startAngle + 180);
    AngleConicalGradient    gradient            = new AngleConicalGradient(size * 0.5, size * 0.5, offsetFactor, stopAngleMap, getSkinnable().getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? getSkinnable().getRange() * angleStep : -getSkinnable().getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * size, xy - 0.026 * size, wh + 0.052 * size, wh + 0.052 * size)));
    tickMarkCtx.setLineWidth(size * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy, xy, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:openjfx-8u-dev-tests    文件:CanvasShapePathElements2App.java   
@Override
public Node drawNode() {
    Pane slot = new Pane();
    final Canvas canvas = new Canvas(120, 120);
    GraphicsContext gc = canvas.getGraphicsContext2D();

    effect.setEffect(gc, slot);

    gc.setLineCap(StrokeLineCap.ROUND);
    gc.fillArc(DEFAULT_ARC_X /2 , DEFAULT_ARC_Y /2 ,
            2*DEFAULT_ARC_RADIUS_X, 2*DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH,ArcType.CHORD);
    gc.stroke();

    return slot;

}
项目:openjfx-8u-dev-tests    文件:CanvasShapePathElements2App.java   
@Override
public Node drawNode() {
    Pane slot = new Pane();
    final Canvas canvas = new Canvas(120, 120);
    GraphicsContext gc = canvas.getGraphicsContext2D();

    effect.setEffect(gc, slot);

    gc.setLineCap(StrokeLineCap.ROUND);
    gc.fillArc(DEFAULT_ARC_X /2 , DEFAULT_ARC_Y /2,
            2*DEFAULT_ARC_RADIUS_X, 2*DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH, ArcType.ROUND);
    gc.stroke();

    return slot;

}
项目:openjfx-8u-dev-tests    文件:CanvasShapePathElements2App.java   
@Override
public Node drawNode() {
    Pane slot = new Pane();
    final Canvas canvas = new Canvas(120, 120);
    GraphicsContext gc = canvas.getGraphicsContext2D();

    effect.setEffect(gc, slot);

    gc.setLineCap(StrokeLineCap.ROUND);
    gc.fillArc(DEFAULT_ARC_X /2 , DEFAULT_ARC_Y /2,
            2*DEFAULT_ARC_RADIUS_X, 2*DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH, ArcType.ROUND);
    gc.arc(DEFAULT_ARC_X  , DEFAULT_ARC_Y ,
            DEFAULT_ARC_RADIUS_X, DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH);
    gc.stroke();

    return slot;
}
项目:openjfx-8u-dev-tests    文件:CanvasEffects2App.java   
@Override
public Node drawNode() {
    group = new Group();

    final Canvas canvas = new Canvas(70, 70);
    GraphicsContext gc = canvas.getGraphicsContext2D();

    gc.stroke();
    gc.setFill(Color.rgb(0, 50, 255));
    gc.fillRect(10, 10, 35, 35);

    gc.setGlobalBlendMode(operation);
    gc.setFill(Color.rgb(255, 150, 0, 1));
    gc.stroke();
    gc.fillArc(20d, 20d, 45d, 45d, 20d, 360d, ArcType.ROUND);

    group.getChildren().add(canvas);
    return group;
}
项目:openjfx-8u-dev-tests    文件:CanvasEffects2App.java   
@Override
public Node drawNode() {
    group = new Group();

    final Canvas canvas = new Canvas(90, 90);
    GraphicsContext gc = canvas.getGraphicsContext2D();
    group.getChildren().add(canvas);

    gc.stroke();
    double angle = 0;
    for (final Color color : new Color[] {Color.RED, Color.GREEN, Color.BLUE}) {
        gc.setFill(color);
        double d1 = 120d*angle++;
        gc.fillArc(0d, 0d, 75d, 75d, d1, 120, ArcType.ROUND);
    }
    gc.applyEffect(namedeffect.effect);

    return group;
}
项目:CircuitSim    文件:XorGatePeer.java   
@Override
public void paint(GraphicsContext graphics, CircuitState circuitState) {
    super.paint(graphics, circuitState);

    int x = getScreenX();
    int y = getScreenY();
    int width = 4 * GuiUtils.BLOCK_SIZE;
    int height = 4 * GuiUtils.BLOCK_SIZE;

    graphics.beginPath();
    graphics.moveTo(x + width * 0.1, y + height);
    graphics.arc(x + width * 0.1, y + height * 0.5, width * 0.25, height * 0.5, 270, 180);
    graphics.arcTo(x + width * 0.66, y, x + width * 1.25, y + height, width);
    graphics.arcTo(x + width * 0.66, y + height, x + width * 0.1, y + height, width);
    graphics.closePath();

    graphics.setFill(Color.WHITE);
    graphics.setStroke(Color.BLACK);
    graphics.fill();
    graphics.stroke();

    graphics.strokeArc(x - width * 0.3, y, width * 0.5, height, 270, 180, ArcType.OPEN);
}
项目:CircuitSim    文件:XnorGatePeer.java   
@Override
public void paint(GraphicsContext graphics, CircuitState circuitState) {
    super.paint(graphics, circuitState);

    int x = getScreenX();
    int y = getScreenY();
    int width = 4 * GuiUtils.BLOCK_SIZE;
    int height = 4 * GuiUtils.BLOCK_SIZE;

    graphics.beginPath();
    graphics.moveTo(x + width * 0.1, y + height);
    graphics.arc(x + width * 0.1, y + height * 0.5, width * 0.25, height * 0.5, 270, 180);
    graphics.arcTo(x + width * 0.66, y, x + width, y + height * 1.3, width * 0.7);
    graphics.arcTo(x + width * 0.66, y + height, x + width * 0.1, y + height, width * 0.7);
    graphics.closePath();

    graphics.setFill(Color.WHITE);
    graphics.setStroke(Color.BLACK);
    graphics.fill();
    graphics.stroke();

    graphics.strokeArc(x - width * 0.3, y, width * 0.5, height, 270, 180, ArcType.OPEN);

    graphics.fillOval(x + width * 0.8, y + height * 0.5 - width * 0.1, width * 0.2, width * 0.2);
    graphics.strokeOval(x + width * 0.8, y + height * 0.5 - width * 0.1, width * 0.2, width * 0.2);
}
项目:Medusa    文件:HSkin.java   
private void drawGradientBar() {
    double     scaledWidth = width * 0.9;
    double     xy          = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.1705 * scaledWidth : 0.107 * scaledWidth;
    double     wh          = TickLabelLocation.OUTSIDE == tickLabelLocation ? scaledWidth * 0.77 : scaledWidth * 0.897;
    double     offsetY     = -0.1 * height;
    double     offset      = 90 - startAngle;
    List<Stop> stops       = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * angleRange, stop.getColor()); }
    double               offsetFactor = ScaleDirection.CLOCKWISE == scaleDirection ? startAngle - angleRange + 180 : (startAngle + 180);
    AngleConicalGradient gradient     = new AngleConicalGradient(width * 0.5, width * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * width, xy - 0.026 * width + offsetY, wh + 0.052 * width, wh + 0.052 * width)));
    tickMarkCtx.setLineWidth(scaledWidth * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy, xy + offsetY, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:Medusa    文件:RoundLcdClockSkin.java   
private void drawHours(final ZonedDateTime TIME) {
    int hourCounter = 1;
    int hour        = TIME.getHour();
    double strokeWidth = size * 0.06;
    hoursCtx.setLineCap(StrokeLineCap.BUTT);
    hoursCtx.clearRect(0, 0, size, size);
    for (int i = 450 ; i >= 90 ; i--) {
        hoursCtx.save();
        if (i % 30 == 0) {
            //draw hours
            hoursCtx.setStroke(hourColor);
            hoursCtx.setLineWidth(strokeWidth);
            if (hour == 0 || hour == 12) {
                hoursCtx.strokeArc(strokeWidth * 0.5, strokeWidth * 0.5, size - strokeWidth, size - strokeWidth, i + 1 - 30, 28, ArcType.OPEN);
            } else if (hourCounter <= (TIME.get(ChronoField.AMPM_OF_DAY) == 1 ? hour - 12 : hour)) {
                hoursCtx.strokeArc(strokeWidth * 0.5, strokeWidth * 0.5, size - strokeWidth, size - strokeWidth, i + 1 - 30, 28, ArcType.OPEN);
                hourCounter++;
            }
        }
        hoursCtx.restore();
    }
}
项目:Medusa    文件:RoundLcdClockSkin.java   
private void drawMinutes(final ZonedDateTime TIME) {
    int minCounter  = 1;
    double strokeWidth = size * 0.06;
    minutesCtx.clearRect(0, 0, size, size);
    minutesCtx.setLineCap(StrokeLineCap.BUTT);
    for (int i = 450 ; i >= 90 ; i--) {
        minutesCtx.save();
        if (i % 6 == 0) {
            // draw minutes
            if (minCounter <= TIME.getMinute()) {
                minutesCtx.setStroke(minCounter % 5 == 0 ? fiveMinuteColor : minuteColor);
                minutesCtx.setLineWidth(strokeWidth);
                minutesCtx.strokeArc(strokeWidth * 0.5 + strokeWidth * 1.1, strokeWidth * 0.5 + strokeWidth * 1.1, size - strokeWidth - strokeWidth * 2.2, size - strokeWidth - strokeWidth * 2.2, i + 1 - 6, 4, ArcType.OPEN);
                minCounter++;
            }
        }
        minutesCtx.restore();
    }
}
项目:Medusa    文件:RoundLcdClockSkin.java   
private void drawSeconds(final ZonedDateTime TIME) {
    int secCounter  = 1;
    double strokeWidth = size * 0.06;
    secondsCtx.setLineCap(StrokeLineCap.BUTT);
    secondsCtx.clearRect(0, 0, size, size);
    for (int i = 450 ; i >= 90 ; i--) {
        secondsCtx.save();
        if (i % 6 == 0) {
            // draw seconds
            if (secCounter <= TIME.getSecond() + 1) {
                secondsCtx.setStroke(secondColor);
                secondsCtx.setLineWidth(strokeWidth * 0.25);
                secondsCtx.strokeArc(strokeWidth * 0.5 + strokeWidth * 1.8, strokeWidth * 0.5 + strokeWidth * 1.8, size - strokeWidth - strokeWidth * 3.6, size - strokeWidth - strokeWidth * 3.6, i + 1 - 6, 4, ArcType.OPEN);
                secCounter++;
            }
        }
        secondsCtx.restore();
    }
}
项目:Medusa    文件:QuarterSkin.java   
private void drawGradientBar() {
    Pos                knobPosition      = gauge.getKnobPosition();
    TickLabelLocation  tickLabelLocation = gauge.getTickLabelLocation();
    double             scaledSize        = size * 1.9;
    double             xy                = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.105 * scaledSize : 0.03875 * scaledSize;
    double             wh                = TickLabelLocation.OUTSIDE == tickLabelLocation ? scaledSize * 0.79 : scaledSize * 0.925;
    double             offsetX           = Pos.TOP_LEFT == knobPosition || Pos.BOTTOM_LEFT == knobPosition ? -scaledSize * 0.475 : 0;
    double             offsetY           = Pos.TOP_LEFT == knobPosition || Pos.TOP_RIGHT == knobPosition ? -scaledSize * 0.475 : 0;
    double             offset            = 90 - startAngle;
    ScaleDirection     scaleDirection    = gauge.getScaleDirection();
    List<Stop>         stops             = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap      = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * ANGLE_RANGE, stop.getColor()); }
    double               offsetFactor = ScaleDirection.CLOCKWISE == scaleDirection ? (Pos.TOP_LEFT == knobPosition || Pos.BOTTOM_RIGHT == knobPosition ? startAngle : 180 - startAngle) : (startAngle + 180);
    AngleConicalGradient gradient     = new AngleConicalGradient(scaledSize * 0.5, scaledSize * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * scaledSize + offsetX, xy - 0.026 * scaledSize + offsetY, wh + 0.052 * scaledSize, wh + 0.052 * scaledSize)));
    tickMarkCtx.setLineWidth(scaledSize * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy + offsetX, xy + offsetY, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:Medusa    文件:VSkin.java   
private void drawGradientBar() {
    TickLabelLocation  tickLabelLocation     = gauge.getTickLabelLocation();
    double             scaledHeight          = height * 0.9;
    double             xy                    = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.1705 * scaledHeight : 0.107 * scaledHeight;
    double             wh                    = TickLabelLocation.OUTSIDE == tickLabelLocation ? scaledHeight * 0.77 : scaledHeight * 0.897;
    double             offset                = 90 - startAngle;
    double             offsetX               = -0.1 * width;
    double             knobPositionOffsetCW  = Pos.CENTER_LEFT == gauge.getKnobPosition() ? 90 : 270;
    double             knobPositionOffsetCCW = Pos.CENTER_LEFT == gauge.getKnobPosition() ? 180 : 0;
    ScaleDirection     scaleDirection        = gauge.getScaleDirection();
    List<Stop>         stops                 = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap          = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * angleRange, stop.getColor()); }
    double               offsetFactor = ScaleDirection.CLOCKWISE == scaleDirection ? knobPositionOffsetCW - angleRange * 0.5 : angleRange - (angleRange / 180 * angleRange) + knobPositionOffsetCCW;
    AngleConicalGradient gradient     = new AngleConicalGradient(width * 0.5, width * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * height + offsetX, xy - 0.026 * height, wh + 0.052 * height, wh + 0.052 * height)));
    tickMarkCtx.setLineWidth(scaledHeight * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy + offsetX, xy, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:Medusa    文件:GaugeSkin.java   
private void drawGradientBar() {
    double     xy     = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.115 * size : 0.0515 * size;
    double     wh     = TickLabelLocation.OUTSIDE == tickLabelLocation ? size * 0.77 : size * 0.897;
    double     offset = 90 - startAngle;
    List<Stop> stops  = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap     = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * angleRange, stop.getColor()); }
    double                  offsetFactor        = ScaleDirection.CLOCKWISE == scaleDirection ? (startAngle - 90) : (startAngle + 180);
    AngleConicalGradient    gradient            = new AngleConicalGradient(size * 0.5, size * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * size, xy - 0.026 * size, wh + 0.052 * size, wh + 0.052 * size)));
    tickMarkCtx.setLineWidth(size * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy, xy, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:Medusa    文件:TinySkin.java   
private void drawGradientBar() {
    double             xy           = size * 0.1875;
    double             wh           = size * 0.625;
    double             offset       = -ANGLE_RANGE * 0.5 - 90;
    double             startAngle   = 315;
    List<Stop>         stops        = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * ANGLE_RANGE, stop.getColor()); }
    double               offsetFactor = startAngle - 90;
    AngleConicalGradient gradient     = new AngleConicalGradient(size * 0.5, size * 0.5, offsetFactor, stopAngleMap, ScaleDirection.CLOCKWISE);

    double barStartAngle  = 0;
    double barAngleExtend = 270;
    sectionCtx.save();
    sectionCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.09191176 * size, xy - 0.09191176 * size, wh + 0.18382353 * size, wh + 0.18382353 * size)));
    sectionCtx.setLineWidth(size * 0.18382353);
    sectionCtx.setLineCap(StrokeLineCap.BUTT);
    sectionCtx.strokeArc(xy, xy, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    sectionCtx.restore();    
}
项目:Medusa    文件:IndicatorSkin.java   
private void drawSections() {
    if (sections.isEmpty()) return;
    sectionLayer.getChildren().clear();

    double    centerX     = width * 0.5;
    double    centerY     = height * 0.85;
    double    barRadius   = height * 0.54210526;
    double    barWidth    = width * 0.28472222;
    List<Arc> sectionBars = new ArrayList<>(sections.size());
    for (Section section : sections) {
        Arc sectionBar = new Arc(centerX, centerY, barRadius, barRadius, angleRange * 0.5 + 90 - (section.getStart() * angleStep), -((section.getStop() - section.getStart()) - minValue) * angleStep);
        sectionBar.setType(ArcType.OPEN);
        sectionBar.setStroke(section.getColor());
        sectionBar.setStrokeWidth(barWidth);
        sectionBar.setStrokeLineCap(StrokeLineCap.BUTT);
        sectionBar.setFill(null);
        Tooltip sectionTooltip = new Tooltip(new StringBuilder(section.getText()).append("\n").append(String.format(Locale.US, "%.2f", section.getStart())).append(" - ").append(String.format(Locale.US, "%.2f", section.getStop())).toString());
        sectionTooltip.setTextAlignment(TextAlignment.CENTER);
        Tooltip.install(sectionBar, sectionTooltip);
        sectionBars.add(sectionBar);
    }
    sectionLayer.getChildren().addAll(sectionBars);
}
项目:FXImgurUploader    文件:SimpleGaugeSkin.java   
private final void drawMeasuredRange() {        
    final double MIN_VALUE    = getSkinnable().getMinValue();        
    final double OFFSET       = getSkinnable().getStartAngle() - 90;
    final double START_ANGLE  = (getSkinnable().getMinMeasuredValue() - MIN_VALUE) * angleStep;
    final double ANGLE_EXTEND = (getSkinnable().getMaxMeasuredValue() - getSkinnable().getMinMeasuredValue()) * angleStep;
    final double RANGE_OFFSET = size * 0.015;
    final double RANGE_SIZE   = size - (size * 0.03);        

    measuredRangeCtx.save();
    measuredRangeCtx.clearRect(0, 0, size, size);
    measuredRangeCtx.setFill(getSkinnable().getRangeFill());
    measuredRangeCtx.fillArc(RANGE_OFFSET, RANGE_OFFSET, RANGE_SIZE, RANGE_SIZE, (OFFSET - START_ANGLE), -ANGLE_EXTEND, ArcType.ROUND);
    measuredRangeCtx.setStroke(Color.WHITE);
    measuredRangeCtx.setLineWidth(size * 0.032);
    measuredRangeCtx.strokeArc(RANGE_OFFSET, RANGE_OFFSET, RANGE_SIZE, RANGE_SIZE, (OFFSET - START_ANGLE), -ANGLE_EXTEND, ArcType.ROUND);
    measuredRangeCtx.restore();
}
项目:dnainator    文件:Pie.java   
@SuppressWarnings("unused")
private void onChange(SetChangeListener.Change<? extends String> change) {
    slices.getChildren().clear();
    if (styles.isEmpty()) {
        return;
    }

    int start = 0;
    int delta = FULLCIRCLE / styles.size();
    for (String style : styles) {
        Arc arc = new Arc(0, 0, radius, radius, start, delta);
        arc.setType(ArcType.ROUND);
        arc.getStyleClass().add(style);
        slices.getChildren().add(arc);

        start += delta;
    }
}
项目:fr.xs.jtk    文件:CompassFX.java   
private void drawShapes(GraphicsContext gc) {
    gc.setFill(Color.GREEN);
    gc.setStroke(Color.BLUE);
    gc.setLineWidth(5);
    gc.strokeLine(40, 10, 10, 40);
    gc.fillOval(10, 60, 30, 30);
    gc.strokeOval(60, 60, 30, 30);
    gc.fillRoundRect(110, 60, 30, 30, 10, 10);
    gc.strokeRoundRect(160, 60, 30, 30, 10, 10);
    gc.fillArc(10, 110, 30, 30, 45, 240, ArcType.OPEN);
    gc.fillArc(60, 110, 30, 30, 45, 240, ArcType.CHORD);
    gc.fillArc(110, 110, 30, 30, 45, 240, ArcType.ROUND);
    gc.strokeArc(10, 160, 30, 30, 45, 240, ArcType.OPEN);
    gc.strokeArc(60, 160, 30, 30, 45, 240, ArcType.CHORD);
    gc.strokeArc(110, 160, 30, 30, 45, 240, ArcType.ROUND);
    gc.fillPolygon(new double[]{10, 40, 10, 40},
                   new double[]{210, 210, 240, 240}, 4);
    gc.strokePolygon(new double[]{60, 90, 60, 90},
                     new double[]{210, 210, 240, 240}, 4);
    gc.strokePolyline(new double[]{110, 140, 110, 140},
                      new double[]{210, 210, 240, 240}, 4);
}
项目:EE422C-Coldboot    文件:MotorBlock.java   
@Override
public void render(GraphicsContext gc) {
    super.render(gc);

    double detailLevel = getWidth() / 10;
    if(isPowered())gc.setStroke(team.getTeamColor()); else gc.setStroke(team.getTeamColor().grayscale());
    gc.strokeRect(getXViewport() + detailLevel, getYViewport() + detailLevel, getWidth() - (detailLevel * 2), getHeight() - (detailLevel * 2));

    if(isPowered() && getRobot().getTorqueUtilization() > 1)
        gc.setStroke(team.getTeamColor().grayscale());

    gc.strokeOval(getXViewport() + (3 * detailLevel), getYViewport() + (3 * detailLevel), getWidth() - (detailLevel * 6), getHeight() - (detailLevel * 6));

    gc.setStroke(team.getTeamAlternate1Color());
    gc.strokeArc(getXViewport()+(3*detailLevel),getYViewport()+(3*detailLevel),getWidth() - (detailLevel * 6),getHeight() - (detailLevel * 6),motorTick, 90, ArcType.OPEN);

}
项目:Intro-to-Java-Programming    文件:FanPane.java   
/** Add four arcs to a pane and place them in a stack pane */
private void getBlades() {
    double angle = 0;
    for (int i = 0; i < 4; i++) {
        arc = new Arc(); 
        arc.centerXProperty().bind(widthProperty().divide(2));
        arc.centerYProperty().bind(heightProperty().divide(2));
        arc.radiusXProperty().bind(circle.radiusProperty().multiply(.90));
        arc.radiusYProperty().bind(circle.radiusProperty().multiply(.90));
        arc.setStartAngle(angle + 90);
        arc.setLength(50);
        arc.setFill(Color.BLACK);
        arc.setType(ArcType.ROUND);
        paneForBlades.getChildren().add(arc);
        angle += 90;
    }
}
项目:Intro-to-Java-Programming    文件:FanPane.java   
/** Add four arcs to a pane and place them in a stack pane */
private void getBlades() {
    double angle = 0;
    for (int i = 0; i < 4; i++) {
        arc = new Arc(); 
        arc.centerXProperty().bind(widthProperty().divide(2));
        arc.centerYProperty().bind(heightProperty().divide(2));
        arc.radiusXProperty().bind(circle.radiusProperty().multiply(.90));
        arc.radiusYProperty().bind(circle.radiusProperty().multiply(.90));
        arc.setStartAngle(angle + 90);
        arc.setLength(50);
        arc.setFill(Color.BLACK);
        arc.setType(ArcType.ROUND);
        paneForBlades.getChildren().add(arc);
        angle += 90;
    }
}
项目:teamearth    文件:GameWorldInitializer.java   
private void initItems() {
    Arc arc = new Arc();
    arc.setRadiusX(5.0f);
    arc.setRadiusY(5.0f);
    arc.setStartAngle(45.0f);
    arc.setLength(270.0f);
    arc.setVisible(false);
    arc.setId("Cup");
    arc.setType(ArcType.ROUND);

    List<Node> itemsList = new ArrayList<Node>();
    itemsList.add(arc);

    List<GameObject> objectsList = new ArrayList<GameObject>();


    GameObject item = new Cup();
    item.setNode(arc);
    item.setPosition(new Point2D(200, 200));
    objectsList.add(item);
    getGameObjectManager().addObjects(objectsList);
    root.getChildren().addAll(itemsList);
}
项目:Enzo    文件:SimpleGaugeSkin.java   
private final void drawMeasuredRange() {        
    final double MIN_VALUE    = getSkinnable().getMinValue();        
    final double OFFSET       = getSkinnable().getStartAngle() - 90;
    final double START_ANGLE  = (getSkinnable().getMinMeasuredValue() - MIN_VALUE) * angleStep;
    final double ANGLE_EXTEND = (getSkinnable().getMaxMeasuredValue() - getSkinnable().getMinMeasuredValue()) * angleStep;
    final double RANGE_OFFSET = size * 0.015;
    final double RANGE_SIZE   = size - (size * 0.03);        

    measuredRangeCtx.save();
    measuredRangeCtx.clearRect(0, 0, size, size);
    measuredRangeCtx.setFill(getSkinnable().getRangeFill());
    measuredRangeCtx.fillArc(RANGE_OFFSET, RANGE_OFFSET, RANGE_SIZE, RANGE_SIZE, (OFFSET - START_ANGLE), -ANGLE_EXTEND, ArcType.ROUND);
    measuredRangeCtx.setStroke(Color.WHITE);
    measuredRangeCtx.setLineWidth(size * 0.032);
    measuredRangeCtx.strokeArc(RANGE_OFFSET, RANGE_OFFSET, RANGE_SIZE, RANGE_SIZE, (OFFSET - START_ANGLE), -ANGLE_EXTEND, ArcType.ROUND);
    measuredRangeCtx.restore();
}
项目:marathonv5    文件:ImagePanel.java   
private void drawGraphics() {
    graphics.clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
    graphics.drawImage(image, 0, 0);
    if (annotations.size() > 0) {
        for (int i = 0; i < annotations.size(); i++) {
            Annotation annotationFX = annotations.get(i);
            double x = annotationFX.getX();
            double y = annotationFX.getY();
            graphics.setFill(ANNOTATION_COLOR);
            graphics.fillRect(x, y, annotationFX.getWidth(), annotationFX.getHeight());
            graphics.setFill(Color.RED);
            graphics.fillArc(x - 25, y - 25, 50, 50, 270, 90, ArcType.ROUND);
            graphics.setFill(Color.WHITE);
            graphics.setFont(Font.font(null, FontWeight.EXTRA_BOLD, 14));
            if (i > 8) {
                graphics.fillText(Integer.toString(i + 1), x + 5, y + 15);
            } else {
                graphics.fillText(Integer.toString(i + 1), x + 5, y + 15);
            }
        }
    }
}
项目:HotaruFX    文件:ArcNode.java   
private ArcNode(Arc arc) {
    super(arc);
    this.arc = arc;
    arc.setType(ArcType.ROUND);
    centerX = PropertyTimelineHolder.empty();
    centerY = PropertyTimelineHolder.empty();
    radiusX = PropertyTimelineHolder.empty();
    radiusY = PropertyTimelineHolder.empty();
    startAngle = PropertyTimelineHolder.empty();
    length = PropertyTimelineHolder.empty();
    type = PropertyTimelineHolder.empty();
}
项目:ccu-historian    文件:FXGraphics2D.java   
private ArcType intToArcType(int t) {
    if (t == Arc2D.CHORD) {
        return ArcType.CHORD;
    } else if (t == Arc2D.OPEN) {
        return ArcType.OPEN;
    } else if (t == Arc2D.PIE) {
        return ArcType.ROUND;
    }
    throw new IllegalArgumentException("Unrecognised t: " + t);
}
项目:tilesfx    文件:GaugeSparkLineTileSkin.java   
private void drawHighLightSections(final double VALUE) {
    highlightSectionCtx.setLineCap(StrokeLineCap.BUTT);
    highlightSectionCtx.clearRect(0, 0, width, height);

    if (tile.getSectionsVisible() && !sections.isEmpty()) {
        double  x         = (width - size * 0.7) * 0.5;
        double  y         = (height - size * 0.7) * 0.5;
        double  wh        = size * 0.7;
        double  minValue  = tile.getMinValue();
        double  maxValue  = tile.getMaxValue();
        double  angleStep = tile.getAngleStep();
        highlightSectionCtx.setLineWidth(size * 0.01);
        highlightSectionCtx.setLineCap(StrokeLineCap.BUTT);
        for (int i = 0; i < sections.size(); i++) {
            Section section = sections.get(i);
            double sectionStartAngle;
            if (Double.compare(section.getStart(), maxValue) <= 0 && Double.compare(section.getStop(), minValue) >= 0) {
                if (Double.compare(section.getStart(), minValue) < 0 && Double.compare(section.getStop(), maxValue) < 0) {
                    sectionStartAngle = 15;
                } else {
                    sectionStartAngle = (section.getStart() - minValue) * angleStep + 15;
                }
                double sectionAngleExtend;
                if (Double.compare(section.getStop(), maxValue) > 0) {
                    sectionAngleExtend = (maxValue - section.getStart()) * angleStep;
                } else if (Double.compare(section.getStart(), minValue) < 0) {
                    sectionAngleExtend = (section.getStop() - minValue) * tile.getAngleStep();
                } else {
                    sectionAngleExtend = (section.getStop() - section.getStart()) * angleStep;
                }
                highlightSectionCtx.save();
                highlightSectionCtx.setStroke(section.contains(VALUE) ? section.getColor() : section.getColor().darker().darker());
                highlightSectionCtx.strokeArc(x, y, wh, wh, -(120 + sectionStartAngle), -sectionAngleExtend, ArcType.OPEN);
                highlightSectionCtx.restore();
            }
        }
    }
}
项目:ARS    文件:RadarView.java   
private void draw() {
    Canvas canvas = new Canvas(radar.getWidth() + 2, radar.getHeight() + 2); // +2 to avoid stroke cutoff
    GraphicsContext graphicsContext = canvas.getGraphicsContext2D();
    graphicsContext.setFill(Color.web("#546E7A", 0.3));
    graphicsContext.setStroke(Color.web("#455A64", 0.3));
    graphicsContext.setLineWidth(1);
    graphicsContext.fillOval(1, 1, radar.getWidth(), radar.getHeight()); // Draw at (1, 1) to avoid stroke cutoff
    graphicsContext.strokeOval(1, 1, radar.getWidth(), radar.getHeight());
    graphicsContext.strokeArc(1, 1, radar.getWidth(), radar.getHeight(), radar.getScanAngle(), 360 - radar.getScanAngle(), ArcType.ROUND);
    getChildren().clear();
    getChildren().add(canvas);
}
项目:SimpleSectionGauge    文件:SimpleSectionGauge.java   
private void initGraphics() {
    sectionCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    sectionCtx    = sectionCanvas.getGraphicsContext2D();

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.4, PREFERRED_HEIGHT * 0.4, model.getStartAngle() + 150, 300);
    barBackground.setType(ArcType.OPEN);
    barBackground.setStroke(model.getBarBackgroundColor());
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.125);
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setFill(null);

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.4, PREFERRED_HEIGHT * 0.4, model.getStartAngle() + 90, 0);
    bar.setType(ArcType.OPEN);
    bar.setStroke(model.getBarColor());
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.125);
    bar.setStrokeLineCap(StrokeLineCap.BUTT);
    bar.setFill(null);

    titleText = new Text(model.getTitle());
    titleText.setFill(model.getTitleColor());
    Helper.enableNode(titleText, !model.getTitle().isEmpty());

    valueText = new Text();
    valueText.setStroke(null);
    valueText.setFill(model.getValueColor());
    Helper.enableNode(valueText, model.isValueVisible());

    unitText = new Text();
    unitText.setStroke(null);
    unitText.setFill(model.getUnitColor());
    Helper.enableNode(unitText, model.isValueVisible() && !model.getUnit().isEmpty());

    pane = new Pane(barBackground, sectionCanvas, titleText, valueText, unitText, bar);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(borderWidth))));

    getChildren().setAll(pane);
}
项目:MoodFX    文件:ColorRegulator.java   
private void drawBar(final GraphicsContext CTX, final double VALUE) {
    CTX.clearRect(0, 0, size, size);
    double barXY          = size * 0.04;
    double barWH          = size * 0.92;
    double barAngleExtend = (VALUE - MIN_VALUE) * angleStep;
    CTX.save();
    CTX.strokeArc(barXY, barXY, barWH, barWH, BAR_START_ANGLE, -barAngleExtend, ArcType.OPEN);
    CTX.restore();
}
项目:aya-lang    文件:FXGraphics2D.java   
private ArcType intToArcType(int t) {
    if (t == Arc2D.CHORD) {
        return ArcType.CHORD;
    } else if (t == Arc2D.OPEN) {
        return ArcType.OPEN;
    } else if (t == Arc2D.PIE) {
        return ArcType.ROUND;
    }
    throw new IllegalArgumentException("Unrecognised t: " + t);
}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    Arc arc = new Arc(DEFAULT_ARC_X, DEFAULT_ARC_Y, DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_RADIUS_X, DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.OPEN);
    arc.setStrokeLineCap(StrokeLineCap.SQUARE);
    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    //VBox vbox = baseFill(new VBox());
    Arc arc = new Arc(DEFAULT_ARC_X, DEFAULT_ARC_Y, DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_RADIUS_X, DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.OPEN);
    arc.setStrokeLineCap(StrokeLineCap.ROUND);
    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    Arc arc = new Arc();
    arc.setCenterX(DEFAULT_ARC_X);
    arc.setCenterY(DEFAULT_ARC_Y);
    arc.setRadiusX(DEFAULT_ARC_RADIUS_X);
    arc.setRadiusY(DEFAULT_ARC_RADIUS_Y);
    arc.setStartAngle(DEFAULT_ARC_START_ANGLE);
    arc.setLength(DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.OPEN);
    arc.setStrokeLineCap(StrokeLineCap.BUTT);

    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    Arc arc = new Arc();
    arc.setCenterX(DEFAULT_ARC_X);
    arc.setCenterY(DEFAULT_ARC_Y);
    arc.setRadiusX(DEFAULT_ARC_RADIUS_X);
    arc.setRadiusY(DEFAULT_ARC_RADIUS_Y);
    arc.setStartAngle(DEFAULT_ARC_START_ANGLE);
    arc.setLength(DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.CHORD);

    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    Arc arc = new Arc(DEFAULT_ARC_X, DEFAULT_ARC_Y, DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_RADIUS_X, DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.ROUND);

    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}
项目:Medusa    文件:TinySkin.java   
private void drawSections() {
    if (sections.isEmpty()) return;
    sectionCtx.clearRect(0, 0, size, size);
    double xy       = size * 0.1875;
    double wh       = size * 0.625;
    double offset   = -ANGLE_RANGE * 0.5 - 90;
    int    listSize = sections.size();
    for (int i = 0 ; i < listSize ; i++) {
        Section section = sections.get(i);
        double sectionStartAngle;
        if (Double.compare(section.getStart(), maxValue) <= 0 && Double.compare(section.getStop(), minValue) >= 0) {
            if (Double.compare(section.getStart(), minValue) < 0 && Double.compare(section.getStop(), maxValue) < 0) {
                sectionStartAngle = 0;
            } else {
                sectionStartAngle = (section.getStart() - minValue) * angleStep;
            }
            double sectionAngleExtend;
            if (Double.compare(section.getStop(), maxValue) > 0) {
                sectionAngleExtend = (maxValue - section.getStart()) * angleStep;
            } else if (Double.compare(section.getStart(), minValue) < 0) {
                sectionAngleExtend = (section.getStop() - minValue) * angleStep;
            } else {
                sectionAngleExtend = (section.getStop() - section.getStart()) * angleStep;
            }
            sectionCtx.save();
            sectionCtx.setStroke(section.getColor());
            sectionCtx.setLineWidth(size * 0.18382353);
            sectionCtx.setLineCap(StrokeLineCap.BUTT);
            sectionCtx.strokeArc(xy, xy, wh, wh, -(offset + sectionStartAngle), -sectionAngleExtend, ArcType.OPEN);
            sectionCtx.restore();
        }
    }
}