On Mon, 17 Aug 2026 00:39:38 GMT, Michael Strauß <[email protected]> wrote:

>> Pixel snapping is really hard to get right (in fact, it's so hard that even 
>> JavaFX itself gets it wrong in so many places).
>> I've compiled a list of things that I've learned, because there isn't really 
>> any good documentation as of yet.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   review changes

modules/javafx.graphics/src/main/java/javafx/scene/layout/package-info.java 
line 223:

> 221:  * <h2>Pixel Snapping</h2>
> 222:  *
> 223:  * In JavaFX, layout coordinates use {@code double} values, which means 
> that a position or size can be fractional.

I think it's the other way around: JavaFX supports fractional scale (example: 
125%) which means the logical coordinates cannot be integers.

modules/javafx.graphics/src/main/java/javafx/scene/layout/package-info.java 
line 245:

> 243:  *
> 244:  * At a render scale of {@code 1.0}, one logical unit is one pixel. At a 
> render scale of {@code 1.5}, one pixel is
> 245:  * {@code 1 / 1.5} ≈ {@code 0.6667}, logical units. A correctly snapped 
> value is therefore not necessarily an integer,

0.6666... mathematically, or 0.6666666666666666 in IEEE 754, or ~0.6667

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/2260#discussion_r3797775806
PR Review Comment: https://git.openjdk.org/jfx/pull/2260#discussion_r3797795649

Reply via email to