Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum dimensions of canvas in JavaFX

Does anyone know the maximum dimensions of a canvas in JavaFX? From some tests it seams to be 8192 (the same of IE) and, by my side, this is strange. Maybe, is it modifiable?

like image 968
Luca Avatar asked Jul 10 '13 06:07

Luca


People also ask

What is Canvas in JavaFX?

Canvas class is a part of JavaFX. Canvas class basically creates an image that can be drawn on using a set of graphics commands provided by a GraphicsContext. Canvas has a specified height and width and all the drawing operations are clipped to the bounds of the canvas.

Can you add a button to a canvas JavaFX?

You can put your canvas into an AnchorPane and then you can add a Button to that too which will be shown on top of the canvas then. With the anchors you can place the button exactly where you want to have it.

What is GraphicsContext?

This class is used to issue draw calls to a Canvas using a buffer. Each call pushes the necessary parameters onto the buffer where they will be later rendered onto the image of the Canvas node by the rendering thread at the end of a pulse.

How do I add text to canvas JavaFX?

You can draw text using the fillText() and strokeText() methods of the GraphicsContext using the following snippets of code: void strokeText(String text, double x, double y) void strokeText(String text, double x, double y, double maxWidth) void fillText(String text, double x, double y)


1 Answers

Likely it depends upon the maximum texture size for your video card as I believe, using the most common hardware accelerated rendering pipeline, the canvas will ultimately be represented as a texture. (I don't know this exactly, but I think it is a pretty good guess).

You can cross-post to openjfx-dev to get a developer to confirm.

like image 150
jewelsea Avatar answered Sep 28 '22 03:09

jewelsea