Some questions

Edu García arcnorj at
Mon Aug 11 21:21:28 UTC 2014

On Aug 12, 2014 6:59 AM, "Jim Graham" <james.graham at> wrote:
> On 8/9/14 3:19 PM, Edu García wrote:
>> Hi, I have a few questions about JavaFX usage, I hope this is the right
>> place to ask them:
>> 1. I'm creating a Pane with a lot of shapes and resizing it to 128x128.
>> saving it as an image with snapshot() and SwingFXUtils.fromFXImage() (is
>> there any other way?). Why is my saved image 129x129, instead of 128x128?
> That's the only way currently.  When does it become 129x129?  Is the
output of snapshot that size?  If it was positioned not on a pixel
boundary, then it might go from 10.5 to 138.5 and we'd capture all pixels
from 10 to 139 and get a size of 129.  Is something like that happening?
I'll need to check again, but my pane is not positioned anywhere, it might
be at 0,0 (is the only JFX object I'm creating)

>> 2. With the same Pane and image, when working on a "Retina" system, the
>> output is clearly pixelated, like the real resolution of the image should
>> be 64x64. Is this a bug?
> That would be a bug.  Is the resulting image 64x64, or 128x128?  We may
be mis-applying the screen scale when we aren't talking to the screen.
The output image is 129x129, but it's pixelated, like it was rendered at
64x64 and then scaled at 2x.
>> 3. Non related to the previous, I want to have pixelated rendering (on
>> screen, not to a file) when I modify the scale of my pane or shapes. Is
>> there a way of forcing JavaFX to do something like that? Or do I have to
>> render to an image at 1:1 resolution, scale that and replace my pane with
>> it? I'm assuming that will be a bit slow.
> What do you mean by pixelated rendering?  I don't think we provide that,
but I'm not 100% sure what you want there...
I want to simulate what will happen when saving my shapes to an image and
then zooming in, like the pixelated output of Illustrator, or the look of
an old videogame. So what I want is JFX to always render at the same
resolution internally, and then scale that when showing it to the screen
>                         ...jim

Thank you!

More information about the openjfx-dev mailing list