this thread is almost what I need: Creating a GraphicsPath from a semi-transparent bitmap
but he is drawing an outline AROUND the image - I need to draw one just a couple of pixels INSIDE the image. basically I'm trying to draw a "Focus Rectangle" (except it's not a rectangle) the result needs to be in the form of a GraphicsPath so i can fit it right into my current code.
private function GetImagePath(img as Image) as GraphicsPath ... end function
[EDIT] ok, first of all i cant even get the code from the other post to work. i keep getting index out of range at this line:
*byte alpha = originalBytes[y * bitmapData.Stride + 4 * x + 3];*
that's IF it even gets past the other stuff first. alot of times it comes out of the first loop having not found a non-transparent point - when most of the image is non-transparent.
the newst problem is that it creates a list of point that dont make any sense. the image is 68x68 my list of points has points like 290x21 and even crazier ones like 2316x-15
this is my original image:
[wont let me upload cause im new]
its the background image of a button that is 70x70 - if that matters at all.
I would think to use the routine provided in the link, get the output from it, and add your own wrapper around it modifying the path pushing it in the couple pixels you want. You could even make the amount of pixels to move in an input parameter so that you can play around with it.
Else you could add the second pass directly into the routine provided. Either way I think this is a 2 pass approach. You need to find the outer bounds of the object, that is what is provided. Then you need to essentially move around the path yourself, understand the derivative of the path so that you can move your path in perpendicularly to the derivative at the current point you are looking at. You will also have to recognize inside from outside (i.e. which direction to move the line).
An Algorithm might look something like this (remember just algorithm):
Image of the geometry I am performing: