use of javafx.scene.paint.ImagePattern in project Board-Instrumentation-Framework by intel.
the class ConicalGradient method apply.
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 * 0.5, height * 0.5);
return new ImagePattern(getImage(width, height), x, y, width, height, false);
}
use of javafx.scene.paint.ImagePattern in project Board-Instrumentation-Framework by intel.
the class RadialBargraphSkin method resize.
private void resize() {
size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight();
centerX = size * 0.5;
centerY = size * 0.5;
if (size > 0) {
pane.setMaxSize(size, size);
pane.relocate((getSkinnable().getWidth() - size) * 0.5, (getSkinnable().getHeight() - size) * 0.5);
final double RADIUS = size * 0.5 - 2;
valueBlendBottomShadow.setOffsetY(0.005 * size);
valueBlendTopShadow.setOffsetY(0.005 * size);
valueBlendTopShadow.setRadius(0.005 * size);
dropShadow.setRadius(0.015 * size);
dropShadow.setOffsetY(0.015 * size);
background.setPrefSize(size, size);
ticksAndSectionsCanvas.setWidth(size);
ticksAndSectionsCanvas.setHeight(size);
ticksAndSections.clearRect(0, 0, size, size);
drawSections(ticksAndSections);
drawTickMarks(ticksAndSections);
ticksAndSectionsCanvas.setCache(true);
ticksAndSectionsCanvas.setCacheHint(CacheHint.QUALITY);
drawMarkers();
minMeasuredValue.setPrefSize(0.03 * size, 0.03 * size);
minMeasuredValue.relocate((size - minMeasuredValue.getPrefWidth()) * 0.5, size * 0.11);
minMeasuredValueRotate.setPivotX(minMeasuredValue.getPrefWidth() * 0.5);
minMeasuredValueRotate.setPivotY(size * 0.39);
minMeasuredValueRotate.setAngle(getSkinnable().getMinMeasuredValue() * angleStep - 180 - getSkinnable().getStartAngle());
maxMeasuredValue.setPrefSize(0.03 * size, 0.03 * size);
maxMeasuredValue.relocate((size - maxMeasuredValue.getPrefWidth()) * 0.5, size * 0.11);
maxMeasuredValueRotate.setPivotX(maxMeasuredValue.getPrefWidth() * 0.5);
maxMeasuredValueRotate.setPivotY(size * 0.39);
maxMeasuredValueRotate.setAngle(getSkinnable().getMaxMeasuredValue() * angleStep - 180 - getSkinnable().getStartAngle());
threshold.setPrefSize(0.06 * size, 0.055 * size);
threshold.relocate((size - threshold.getPrefWidth()) * 0.5, size * 0.08);
thresholdRotate.setPivotX(threshold.getPrefWidth() * 0.5);
thresholdRotate.setPivotY(size * 0.42);
thresholdRotate.setAngle(getSkinnable().getThreshold() * angleStep - 180 - getSkinnable().getStartAngle());
bar.setCenterX(centerX);
bar.setCenterY(centerY);
bar.setRadiusX(RADIUS);
bar.setRadiusY(RADIUS);
if (getSkinnable().isBarGradientEnabled()) {
recalculateBarGradient();
Image image = barGradient.getImage(size, size);
bar.setFill(new ImagePattern(image, 0, 0, size, size, false));
} else {
bar.setFill(new RadialGradient(0, 0, centerX, centerY, RADIUS, false, CycleMethod.NO_CYCLE, new Stop(0.0, barColor), // -5 for on the barColorHue)
new Stop(0.76, barColor.deriveColor(-5, 1, 1, 1)), new Stop(0.79, barColor), new Stop(0.97, barColor), // -5 for on the barColorHue)
new Stop(1.0, barColor.deriveColor(-5, 1, 1, 1))));
}
knob.setPrefSize(size * 0.75, size * 0.75);
knob.setTranslateX((size - knob.getPrefWidth()) * 0.5);
knob.setTranslateY((size - knob.getPrefHeight()) * 0.5);
resizeText();
}
}
Aggregations