Reputation: 538
Well from last few months, i am looking for one solution, but couldn't find the exact answer to this question
The problem is :
Suppose i have this image with me(shown below), and i have to show a inner border around this image and i think showing border around this would be best through graphics,
but graphics has some limited number of functions like drawRect, drawRoundedRect etc,
I also have seen Path.as from Senocular.com,
The thing which i want to know, is it possible to draw a inner border around this shape or any other irregular shape(through graphics, i need to find the border pixels around the image, i guess),
i don't want to use any dotted line(another image over this image) as a border, i know thats a solution, :-), but this time things are pretty based on calculation, so any one of you have any working algorithm or any things like that which could let me draw dotted border around any sort of shape, that would be much helpful,
I am flex developer, so i should tell you this image is in some canvas, i am drawing the bitmap data of this image in to the canvas
Thank You
Upvotes: 1
Views: 1429
Reputation: 3581
You could use the simple getBounds or getBoundsRect properties if your symbols are pretty basic (not masked). If they're more complex, you might find this useful:
public function getFullBounds ( displayObject:DisplayObject ) :Rectangle
{
var bounds:Rectangle, transform:Transform, toGlobalMatrix:Matrix, currentMatrix:Matrix;
transform = displayObject.transform;
currentMatrix = transform.matrix;
toGlobalMatrix = transform.concatenatedMatrix;
toGlobalMatrix.invert();
transform.matrix = toGlobalMatrix;
bounds = transform.pixelBounds.clone();
transform.matrix = currentMatrix;
return bounds;
}
Care of: http://usecake.com/lab/find-the-height-and-width-of-a-sprite-with-a-scrollrect.html
Upvotes: 1