Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Canvas Rendering Degrades Proportionally With Size?

ShindohApr 18 2014 — edited Apr 21 2014

Can someone explain to me how I can avoid the performance decline of drawing on a Canvas, as it's size gets bigger?
What's the reason for this?

The same stroke on a Canvas is executed more and more slowly, as the size of the Canvas increases.

It also seems that, despite "dirty-area" rendering techniques used by JavaFX, rendering of the scene becomes slower as the size of Nodes increases (ex.: the Canvas),
even when the bulk of it is offscreen. Speed is acceptable when the Canvas completely fills my screen with it's size, so the whole screen already needs to be redrawn,
but as I increase the size, so the Node/Canvas already extends outside of the Window, rendering performance continually decreases as the Node gets bigger.

This is remedied, when setCache(true) is applied.
This does however NOT improve drawing performance on the Canvas, where low latencies are critical for a Painting App.
Which seems to be implied, as the documentation advises NOT to Cache, if the Node changes frequently.
Surprisingly then, still setting Cache to True on the currently drawn on Canvas, plus CacheHint = SPEED, seems to improve speed a little.

Anyway, back to the question: Why is drawing on a Canvas becoming slower with size, although the same stroke, covering the same amount of area, is executed?

Apologies if I sound confusing or repeated myself, I am extremely tired. Thank You in advance, and good night.

This post has been answered by jsmith on Apr 20 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 19 2014
Added on Apr 18 2014
4 comments
6,703 views