Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

oversized graphics.newOutline() shape when detecting and using the @2x @4x image suffixes
Started by javoru Mar 21 2015 11:58 AM

No replies to this topic
outlinephysics newimage suffixes
This topic has been archived. This means that you cannot reply to this topic.
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Observer

  • 1 posts
  • Corona SDK

Hi all,

the function newOutline is working ok when no suffixes on the images are used. Having the two versions of an image file (triangle.png and triangle@2x.png) the created shape used for the collider is twice the size it should be. It looks like it's taking the @2x image to create the outline and also duplicating it's size. 


I saw something similar reported in other post, but in that case the outline kept the same size while changing the image (http://forums.coronalabs.com/topic/44103-fixed-how-can-i-use-graphicsnewoutline-with-2x-and-4x-image-substitution/).


I'm using build 2589, last one at this moment.


This is the code to reproduce this, and a picture attached to show how the colliders are seen in the two situations:


local imagefile="triangle.png"
triangle = display.newImage(imagefile);
newOutline = graphics.newOutline( 2, imagefile )
physics.addBody( triangle, {outline=newOutline } )
Attached File  capture.jpg   86.22KB   0 downloads
An interesting thing is that if I create another image duplicating the 1x image, with another name and not created the @2x image of it, and, use this new x1 image to get the outline, then it works ok at 1x and 2x. 
Thanks for your help.