We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maybe I can help you with your snapshot problem.
public static WritableImage renderScaleAwareSnapshot(Canvas canvas, double renderScale) { return renderScaleAwareSnapshot(canvas, renderScale, null, 0.0, 0.0, canvas.getWidth(), canvas.getHeight()); } public static WritableImage renderScaleAwareCanvasSnapshot(Canvas canvas, double renderScale, WritableImage writableImage) { return renderScaleAwareSnapshot(canvas, renderScale, writableImage, 0.0, 0.0, canvas.getWidth(), canvas.getHeight()); } public static WritableImage renderScaleAwareSnapshot(Node node, double renderScale, WritableImage writableImage, double x, double y, double width, double height) { int renderWidth = (int) Math.rint(renderScale * width); int renderHeight = (int) Math.rint(renderScale * height); if (writableImage == null || (int) Math.rint(writableImage.getWidth()) != renderWidth || (int) Math.rint(writableImage.getHeight()) != renderHeight) { writableImage = new WritableImage(renderWidth, renderHeight); } SnapshotParameters spa = new SnapshotParameters(); spa.setViewport(new Rectangle2D(x * renderScale, y * renderScale, width, height)); spa.setTransform(Transform.scale(renderScale, renderScale)); return node.snapshot(spa, writableImage); }
This code does a canvas snapshot but the principle is the same for any kind of node. You can see how I handle the renderScale (2.0 for Retina).
The text was updated successfully, but these errors were encountered:
Thanks @mipastgt for this nice proposal. I will explore this, it looks as if it should work well!
Sorry, something went wrong.
No branches or pull requests
Maybe I can help you with your snapshot problem.
This code does a canvas snapshot but the principle is the same for any kind of node. You can see how I handle the renderScale (2.0 for Retina).
The text was updated successfully, but these errors were encountered: