Blurry strokes and zooming via scale transforms

Tom Eugelink tbee at tbee.org
Thu Jun 12 09:42:12 UTC 2014


I recently had a similar situation, but then because certain properties were calculated-via-binding and the resulting value was not "snapped" to good values either.

This resulted in my suggestion to allow custom calculations in bindings, which would then snap the value.
https://javafx-jira.kenai.com/browse/RT-37255

And transformations on such values have the same effect of course. I was wondering, similar to the binding suggestion, would it be possible to apply a snapping transformation as the last transformation?

Tom


On 2014-6-12 10:56, Robert Fisher wrote:
> Hi all,
>   
> I'm trying to avoid the blurry strokes you can get in JavaFX in some cases, e.g. for a non-integer stroke width, or a stroke width of 1 and StrokeType.CENTERED.
>   
> So far my 'solution' to this problem has been to round layout values to integers, or to round and add 0.5 in the StrokeType.CENTERED case.
>   
> However this approach is pretty useless if I apply a scale transform afterwards, which is the simplest way I know to create a zooming mechanism.
>   
> So my question is: is there any way I can round things to integer values *after* transforms have been applied? Or tell the renderer to not try to approximate strokes drawn 'off-pixel' but instead to round & move them to the nearest pixel so that lines look sharp and clean?
>   
> Any tips would be appreciated.
>   
> Cheers,
> Rob




More information about the openjfx-dev mailing list