Re: Blurry strokes and zooming via scale transforms
Thanks for the links, I'll take a look. Rob -Ursprüngliche Nachricht- Von: John Smith [mailto:john_sm...@symantec.com] Gesendet: Donnerstag, 12. Juni 2014 22:05 An: Robert Fisher; openjfx-dev@openjdk.java.net Betreff: RE: Blurry strokes and zooming via scale transforms A couple of related stackoverflow questions won't solve your problem, but will provide some background info: http://stackoverflow.com/questions/16089304/javafx-imageview-without-any-smoothing http://stackoverflow.com/questions/11886230/how-to-draw-a-crisp-opaque-hairline-in-javafx-2-2 http://stackoverflow.com/questions/11881834/what-are-a-lines-exact-dimensions-in-javafx-2 -Original Message- From: openjfx-dev [mailto:openjfx-dev-boun...@openjdk.java.net] On Behalf Of Robert Fisher Sent: Thursday, June 12, 2014 3:10 AM To: openjfx-dev@openjdk.java.net Subject: AW: Blurry strokes and zooming via scale transforms 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. Cheers, Rob -Ursprüngliche Nachricht- Von: openjfx-dev [mailto:openjfx-dev-boun...@openjdk.java.net] Im Auftrag von Tom Eugelink Gesendet: Donnerstag, 12. Juni 2014 11:42 An: openjfx-dev@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. 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
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. 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
RE: Blurry strokes and zooming via scale transforms
A couple of related stackoverflow questions won't solve your problem, but will provide some background info: http://stackoverflow.com/questions/16089304/javafx-imageview-without-any-smoothing http://stackoverflow.com/questions/11886230/how-to-draw-a-crisp-opaque-hairline-in-javafx-2-2 http://stackoverflow.com/questions/11881834/what-are-a-lines-exact-dimensions-in-javafx-2 -Original Message- From: openjfx-dev [mailto:openjfx-dev-boun...@openjdk.java.net] On Behalf Of Robert Fisher Sent: Thursday, June 12, 2014 3:10 AM To: openjfx-dev@openjdk.java.net Subject: AW: Blurry strokes and zooming via scale transforms 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. Cheers, Rob -Ursprüngliche Nachricht- Von: openjfx-dev [mailto:openjfx-dev-boun...@openjdk.java.net] Im Auftrag von Tom Eugelink Gesendet: Donnerstag, 12. Juni 2014 11:42 An: openjfx-dev@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. 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