Stroking with an Imagesheet Paint

Hi Everyone,

I found the documentation (https://docs.coronalabs.com/api/type/ShapeObject/stroke.html) that states that an ImageSheet can be used to stroke a ShapeObject.

When I apply the ImageSheet Paint to a LineObject, I’m getting weird results that don’t honor the strokeWidth or stroke property, mainly a thin transparent line.

When I take the same Paint object and apply it to a rectangle, the Paint works.

Is this a bug, or some unsupported behavior?

Thank you,

Albert

Can you post some code for us to look at?

Rob

Hi Rob,

Sorry for the delay, I didn’t see the forum notification.

Yes, the example in the feature’s documentation does not work in my tests.

https://docs.coronalabs.com/api/type/ShapeObject/stroke.html

local options = { width = 40, height = 100, numFrames = 8, sheetContentWidth = 160, -- width of original 1x size of entire sheet sheetContentHeight = 200 -- height of original 1x size of entire sheet } local imageSheet = graphics.newImageSheet( "textures.png", options ) local paint = { type = "image", sheet = imageSheet, frame = 2 } local rect = display.newRect( 200, 200, 300, 300 ) rect.stroke = paint rect.strokeWidth = 4

To make things simpler, here is some modified code and an attached image. 

local options = { frames = { { x = 165, y = 99, width = 28, height = 31 }, { x = 165, y = 122, width = 28, height = 31 } }, sheetContentWidth = 512, sheetContentHeight = 512 }; local imageSheet = graphics.newImageSheet("Image.png", options); local paint = { type = "image", sheet = imageSheet, frame = 2 }; local rect = display.newRect( 200, 200, 300, 300 ); rect.stroke = paint; --rect.fill = paint; -- Uncomment this to see that the paint is correct and works as a fill rect.strokeWidth = 31;

Image (excuse the white space, I cut the content out of the image)

Image.png

Thanks for looking at this, hopefully I’m just interpreting something wrong.

Albert

Hi Rob,

I was hoping you could look at my code, and let me know if I’m doing anything wrong. Is this something I should file a bug report for?

Albert

Just as an FYI, these are community forums and when you ask just me to respond, you’re missing out on having other people provide you their expertise and you miss out on more timely answers.

Since your project has artwork, no one can really take your code and run it. Perhaps posting some screen shots of what’s working and whats not and a better description of the problem would give the community a better chance to respond. Either that, or share a .zip file with a simple app that demonstrates the problem will be really helpful.  We certainly need to know what your expectations are.

Rob

Hi Rob,

Thanks for replying, noted for the future. I’ve determined to a reasonable extent that this is a bug in Corona and I submitted a bug report to bugs at corona. The sample project I attached is basically the same code/image I provided in my earlier post.

For anyone interested in reproducing the issue, take a look at this sample project file http://www.ionpixel.com/Corona/StrokeTest.zip

Thanks again,

Albert

Case 46329

Can you post some code for us to look at?

Rob

Hi Rob,

Sorry for the delay, I didn’t see the forum notification.

Yes, the example in the feature’s documentation does not work in my tests.

https://docs.coronalabs.com/api/type/ShapeObject/stroke.html

local options = { width = 40, height = 100, numFrames = 8, sheetContentWidth = 160, -- width of original 1x size of entire sheet sheetContentHeight = 200 -- height of original 1x size of entire sheet } local imageSheet = graphics.newImageSheet( "textures.png", options ) local paint = { type = "image", sheet = imageSheet, frame = 2 } local rect = display.newRect( 200, 200, 300, 300 ) rect.stroke = paint rect.strokeWidth = 4

To make things simpler, here is some modified code and an attached image. 

local options = { frames = { { x = 165, y = 99, width = 28, height = 31 }, { x = 165, y = 122, width = 28, height = 31 } }, sheetContentWidth = 512, sheetContentHeight = 512 }; local imageSheet = graphics.newImageSheet("Image.png", options); local paint = { type = "image", sheet = imageSheet, frame = 2 }; local rect = display.newRect( 200, 200, 300, 300 ); rect.stroke = paint; --rect.fill = paint; -- Uncomment this to see that the paint is correct and works as a fill rect.strokeWidth = 31;

Image (excuse the white space, I cut the content out of the image)

Image.png

Thanks for looking at this, hopefully I’m just interpreting something wrong.

Albert

Hi Rob,

I was hoping you could look at my code, and let me know if I’m doing anything wrong. Is this something I should file a bug report for?

Albert

Just as an FYI, these are community forums and when you ask just me to respond, you’re missing out on having other people provide you their expertise and you miss out on more timely answers.

Since your project has artwork, no one can really take your code and run it. Perhaps posting some screen shots of what’s working and whats not and a better description of the problem would give the community a better chance to respond. Either that, or share a .zip file with a simple app that demonstrates the problem will be really helpful.  We certainly need to know what your expectations are.

Rob

Hi Rob,

Thanks for replying, noted for the future. I’ve determined to a reasonable extent that this is a bug in Corona and I submitted a bug report to bugs at corona. The sample project I attached is basically the same code/image I provided in my earlier post.

For anyone interested in reproducing the issue, take a look at this sample project file http://www.ionpixel.com/Corona/StrokeTest.zip

Thanks again,

Albert

Case 46329