Problem with stroke in image rotated?

Hi.

I just noticed that if I apply a stroke to a image and then rotated it, the stroke line loses definition (i.e, it not appears to be linear anymore).

As example, see the picture where in the left i have an image with stroke without rotation and in the right I have the same image, with the same stroke but the image is rotated by 3.

Link to the image: https://www.dropbox.com/s/ncuie1e5ak2c0jw/stroke_image_rotated.png

[import]uid: 181011 topic_id: 33824 reply_id: 333824[/import]

Hello,
This happens because, by default, Corona does not apply anti-aliasing to vector objects, including lines. This is to save processor effort in apps where it’s not needed, for example, those with strict horizontal and vertical-oriented shapes.

You can turn anti-aliasing ON by adding this line to the “content” table of you config.lua file:

antialias = true,

That’s it! The rotated line should look much smoother after you do that, but remember, it costs a bit more processor effort with that feature turned on.

Brent [import]uid: 200026 topic_id: 33824 reply_id: 134462[/import]

Thanks Bret.

I turned it on and in fact the stroke became more smoother (although it is not 100%).

I found other post (http://developer.coronalabs.com/forum/2010/08/31/antialias) where Tom (staff) said about 1 month ago that antialias was not working well. Do you think that problem is already fixed? (i.e, besides processor effort issue, do you recommend to not use it?)

Tom: “Antialias does not work correctly in Corona and should not be used (or set to false). If you set it to true, it can cause problems with some display objects. We are looking at ways to make it work in the future.” [import]uid: 181011 topic_id: 33824 reply_id: 134466[/import]

Hello @rsc,
You’re correct, it appears the feature was “disabled” since I last used it, and it isn’t now recommended. I had some luck with it in the past, but I suppose the effect was minimal.

So, in general I suggest you don’t use it until the feature is fixed, and it’s probably low priority. On most device screens, users won’t notice it, especially on a “Retina” screen or similar because the pixel density is so high (2048 pixels crammed into a 8-inch-tall screen on the Retina iPad). If it still concerns you, it might be worth creating 2 overlapping strokes around the same image, one in white and another opaque white (perhaps 0.5 alpha), just slightly thicker (one pixel thicker on both sides). That might give the impression that the border is “smoother” without using true anti-aliasing.

Brent
[import]uid: 200026 topic_id: 33824 reply_id: 134504[/import]

Nice suggestion Brent. Thank you very much. [import]uid: 181011 topic_id: 33824 reply_id: 134518[/import]

Hello,
This happens because, by default, Corona does not apply anti-aliasing to vector objects, including lines. This is to save processor effort in apps where it’s not needed, for example, those with strict horizontal and vertical-oriented shapes.

You can turn anti-aliasing ON by adding this line to the “content” table of you config.lua file:

antialias = true,

That’s it! The rotated line should look much smoother after you do that, but remember, it costs a bit more processor effort with that feature turned on.

Brent [import]uid: 200026 topic_id: 33824 reply_id: 134462[/import]

Thanks Bret.

I turned it on and in fact the stroke became more smoother (although it is not 100%).

I found other post (http://developer.coronalabs.com/forum/2010/08/31/antialias) where Tom (staff) said about 1 month ago that antialias was not working well. Do you think that problem is already fixed? (i.e, besides processor effort issue, do you recommend to not use it?)

Tom: “Antialias does not work correctly in Corona and should not be used (or set to false). If you set it to true, it can cause problems with some display objects. We are looking at ways to make it work in the future.” [import]uid: 181011 topic_id: 33824 reply_id: 134466[/import]

Hello @rsc,
You’re correct, it appears the feature was “disabled” since I last used it, and it isn’t now recommended. I had some luck with it in the past, but I suppose the effect was minimal.

So, in general I suggest you don’t use it until the feature is fixed, and it’s probably low priority. On most device screens, users won’t notice it, especially on a “Retina” screen or similar because the pixel density is so high (2048 pixels crammed into a 8-inch-tall screen on the Retina iPad). If it still concerns you, it might be worth creating 2 overlapping strokes around the same image, one in white and another opaque white (perhaps 0.5 alpha), just slightly thicker (one pixel thicker on both sides). That might give the impression that the border is “smoother” without using true anti-aliasing.

Brent
[import]uid: 200026 topic_id: 33824 reply_id: 134504[/import]

Nice suggestion Brent. Thank you very much. [import]uid: 181011 topic_id: 33824 reply_id: 134518[/import]