Displaying pixel-perfect images without blur when zooming

Jim Graham james.graham at oracle.com
Thu Aug 28 21:14:42 UTC 2014


Hi Nico,

snapshot can set a resolution in stone, but it doesn't - in and of 
itself - help with zooming that fixed resolution representation without 
antialiasing.  To get an aliased zoom of an image see the code that 
Felipe already posted in this thread.

To be clear, to get an aliased, zoomed pixel preview you would:

1. snapshot a node tree at the scale you want to preview

2. then use Felipe's example code to get a nearest-neighbor aliased zoom 
of that snapshot

When we offer filtering control on ImageView then the second part of 
that operation would no longer be necessary.

			...jim

On 8/27/14 11:51 PM, Nico Krebs | www.mensch-und-maschine.de wrote:
>
> Thank you both!
>
> i added a vote to the feature request. Could you provide a short sample,
> how snapshot(..) can help me zooming without antialiasing?
>
> Nico
>> Jim Graham <mailto:james.graham at oracle.com>
>> 28. August 2014 01:33
>> We have no plans at all for implementing "pixel preview" as a setting
>> on Shapes.  You can do that with snapshot if you want.
>>
>> The Shape.setSmooth() setting (currently stubbed out) is meant to
>> control antialiasing, not rendering resolution.
>>
>> There should be similar bugs for Shape.setSmooth() and the lack of
>> interpolation control on GraphicsContext.drawImage() methods as well,
>> but I don't recall any Jira issues that deal with "pixel preview"
>> capabilities (again, which can be achieved via snapshot)...
>>
>>             ...jim
>>
>>
>> Edu García <mailto:arcnorj at gmail.com>
>> 28. August 2014 00:36
>> Thank you Nico and Jim.
>>
>> Also Jim, that issue only talks about ImageView IIRC. Are you going to
>> implement something similar for shapes? I know it's not the same, but
>> I wanted to show pixelated shapes as well (think about zooming in past
>> 100% in Illustrator with pixel preview enabled). I don't keep my hopes
>> up, but it's free to ask :).
>>
>>
>>
>> Jim Graham <mailto:james.graham at oracle.com>
>> 28. August 2014 00:01
>> On 8/27/14 1:04 AM, Nico Krebs | www.mensch-und-maschine.de wrote:
>>> Question 1:
>>> I don't know why setSmooth(false) doesnt work. Perhaps am i using it the
>>> wrong way? I set it for each ImageView object i got in my list. the
>>> scrollpane can`t be "unsmoothed" because of the lack of the setSmooth()
>>> method.
>>> On the other hand, it could just be a bug of JavaFX.
>>
>> I repeat:
>>
>> On 8/26/14 4:35 PM, Jim Graham wrote:
>>> We simply haven't implemented this yet:
>>>
>>> https://javafx-jira.kenai.com/browse/RT-28629
>>>
>>>              ...jim
>>
>> setSmooth() is not hooked up to any mechanism at all.  Nothing
>> examines this property in the implementation (to be clear, the FX
>> object "passes it on" to the NG implementation object which receives
>> it with an empty method body).  This is true of ImageView and of
>> Shapes...
>>
>>             ...jim
>> Nico Krebs | www.mensch-und-maschine.de
>> <mailto:nicokrebs.dev at googlemail.com>
>> 27. August 2014 10:04
>> Hi Edu,
>>
>> short story: i built a very simple image file format: a zip file,
>> containing a meta.xml file and several png images. the xml defines the
>> position of each png in the image. this way i have a very basic
>> layered image file. I built the first version with Swing in JDK 7 but
>> switched to JavaFX8 last week. The swing-version workes and lets me
>> see and manipulate single pixels when i zoom.
>>
>> Question 1:
>> I don't know why setSmooth(false) doesnt work. Perhaps am i using it
>> the wrong way? I set it for each ImageView object i got in my list.
>> the scrollpane can`t be "unsmoothed" because of the lack of the
>> setSmooth() method.
>> On the other hand, it could just be a bug of JavaFX.
>>
>> Question 2:
>> i want to load the image with all it`s layers once and then be able to
>> zoom so far that i can see the pixels (as you can do in photoshop or
>> even paint). for example because i want to modify the image pixel by
>> pixel (think of icons, gif animations and other tiny images)
>>
>> It`s an image manipulation tool for artists, who want to do very basic
>> stuff like drawing single pixels, lines and do some effect magic. To
>> be able to do precise image manipulation manually it is indispensable
>> that you can work with the untouched image data. as you can in gimp,
>> paint, photoshop,...
>>
>> i hope I answered your questions. if not, tell me ;)
>>
>> Nico
>>
>> Edu García <mailto:arcnorj at gmail.com>
>> 26. August 2014 23:13
>>
>> I'm curious. Why setSmooth doesn't work?
>>
>> Also, do I really need to create an image in memory just to render
>> something showing the pixels?
>>
>
> --
> Nico Krebs
>
> Michelangelostraße 1
> 01217 Dresden
>
> web: www.mensch-und-maschine.de
> mobil: 0162 / 85 89 667
> mail: nicokrebs.dev at googlemail.com
> skype:    k-dottus
> icq:    324 143 104
> fax:    032 12 - 11 39 77 6
> twitter: nico_krebs


More information about the openjfx-dev mailing list