use of javafx.scene.image.WritableImage in project JFoenix by jfoenixadmin.
the class JFXColorPickerUI method getSLCricle.
private Image getSLCricle(int width, int height) {
WritableImage raster = new WritableImage(width, height);
PixelWriter pixelWriter = raster.getPixelWriter();
Point2D center = new Point2D((double) width / 2, (double) height / 2);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
double dy = x - center.getX();
double dx = y - center.getY();
pixelWriter.setColor(x, y, getColor(dx, dy));
}
}
return raster;
}
use of javafx.scene.image.WritableImage in project jgnash by ccavanaugh.
the class ChartUtilities method takeSnapshot.
private static WritableImage takeSnapshot(final Pane pane) {
Map<Chart, Boolean> animationMap = new HashMap<>();
// Need to disable chart animations for printing
pane.getChildren().stream().filter(node -> node instanceof Chart).forEach(node -> {
animationMap.put((Chart) node, ((Chart) node).getAnimated());
// Need to disable animation for printing
((Chart) node).setAnimated(false);
});
final SnapshotParameters snapshotParameters = new SnapshotParameters();
snapshotParameters.setTransform(new Scale(SNAPSHOT_SCALE_FACTOR, SNAPSHOT_SCALE_FACTOR));
final WritableImage image = pane.snapshot(snapshotParameters, null);
// Restore animation
for (Map.Entry<Chart, Boolean> entry : animationMap.entrySet()) {
entry.getKey().setAnimated(entry.getValue());
}
return image;
}
use of javafx.scene.image.WritableImage in project testing-video by testing-av.
the class FxImage method overlay.
public static void overlay(Consumer<WritableImage> consumer, FrameBuffer fb) {
WritableImage image = new WritableImage(fb.Y.width, fb.Y.height);
runAndWait(() -> consumer.accept(image));
overlay(image, fb);
}
use of javafx.scene.image.WritableImage in project jvarkit by lindenb.
the class SimplePlot method saveImageAs.
/**
* save char in file
*/
private void saveImageAs(final Chart chart, final File file) throws IOException {
final WritableImage image = chart.snapshot(new SnapshotParameters(), null);
final String format = (file.getName().toLowerCase().endsWith(".png") ? "png" : "jpg");
ImageIO.write(SwingFXUtils.fromFXImage(image, null), format, file);
}
Aggregations