Canvas blowing up (was Re: JavaFX Media issues)

Richard Bair richard.bair at
Fri Aug 9 21:07:17 PDT 2013

Scale the imageview?

On Aug 9, 2013, at 8:57 PM, John Hendrikx <hjohn at> wrote:

> On 10/08/2013 05:46, John Hendrikx wrote:
>> On 9/08/2013 20:15, Richard Bair wrote:
>>>> Also the proposed clear() or empty() option only applies to Canvas correct?
>>>> i.e. WritableImages don't suffer from these kind of issues and don't require such methods?
>>> That is correct (WritableImage we don't provide a 2D API to use to fill the buffer, you just bash the pixels yourself however you like, so we don't have to buffer anything up).
>> Hm, I didn't realize WritableImage had the same kind PixelWriter interface.  For my usecase, where I just render full frames to a PixelWriter so JavaFX can display them in some fashion, why should I not use a WriteableImage instead?
>> Looking at the docs, I see that one limitation is that the WritableImage cannot be resized after construction (something that I do use with Canvas), but I think I could work around that by just recreating the Image when its size changes... I could just wrap a class around it that does this transparently.
>> Going to take a look if I can rip out the Canvas code and replace it with a resizable WritableImage and see what the results are for full screen video playback...
> Foiled before I even could get started :/
> I need the scaleX and scaleY properties of Canvas as well... basically, my input video data is always decoded at native size (say 1920x1080) and then scaled down or up to fit the screen.  Since I offer a feature that can switch to a different attached monitor at any time, even during playback, I cannot tell my video source to scale the video for me (it does not offer a way to alter this after playback starts).  I haven't given up entirely on WritableImage, but this complicates sufficiently that I cannot just create a drop-in replacement for Canvas that suits my usecase.
> --John

More information about the openjfx-dev mailing list