AW: Blurry strokes and zooming via scale transforms
rfisher at tesis.de
Thu Jun 12 10:10:08 UTC 2014
Well suppose I have a Rectangle with a size of 100x100 and stroke-width of 1, and I apply a scale transform to zoom in to 150%.
Then I would like to see a size of 150x150 pixels and still see a sharp border stroke, let's say with a width of 2 pixels.
I'm not sure how I could apply a snapping transformation to just correct stroke widths and not disturb the size of the shapes themselves.
Von: openjfx-dev [mailto:openjfx-dev-bounces at openjdk.java.net] Im Auftrag von Tom Eugelink
Gesendet: Donnerstag, 12. Juni 2014 11:42
An: openjfx-dev at openjdk.java.net
Betreff: Re: Blurry strokes and zooming via scale transforms
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.
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?
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.
More information about the openjfx-dev