本文整理匯總了Java中javafx.scene.shape.ArcType類的典型用法代碼示例。如果您正苦於以下問題:Java ArcType類的具體用法?Java ArcType怎麽用?Java ArcType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ArcType類屬於javafx.scene.shape包,在下文中一共展示了ArcType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawShapes
import javafx.scene.shape.ArcType; //導入依賴的package包/類
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);
}
示例2: drawGradientBar
import javafx.scene.shape.ArcType; //導入依賴的package包/類
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();
}
示例3: drawNode
import javafx.scene.shape.ArcType; //導入依賴的package包/類
@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;
}
示例4: drawNode
import javafx.scene.shape.ArcType; //導入依賴的package包/類
@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;
}
示例5: paint
import javafx.scene.shape.ArcType; //導入依賴的package包/類
@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);
}
示例6: paint
import javafx.scene.shape.ArcType; //導入依賴的package包/類
@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);
}
示例7: drawGradientBar
import javafx.scene.shape.ArcType; //導入依賴的package包/類
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();
}
示例8: drawHours
import javafx.scene.shape.ArcType; //導入依賴的package包/類
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();
}
}
示例9: drawMinutes
import javafx.scene.shape.ArcType; //導入依賴的package包/類
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();
}
}
示例10: drawSeconds
import javafx.scene.shape.ArcType; //導入依賴的package包/類
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();
}
}
示例11: drawGradientBar
import javafx.scene.shape.ArcType; //導入依賴的package包/類
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();
}
示例12: drawGradientBar
import javafx.scene.shape.ArcType; //導入依賴的package包/類
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();
}
示例13: drawGradientBar
import javafx.scene.shape.ArcType; //導入依賴的package包/類
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();
}
示例14: drawGradientBar
import javafx.scene.shape.ArcType; //導入依賴的package包/類
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();
}
示例15: drawSections
import javafx.scene.shape.ArcType; //導入依賴的package包/類
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);
}