When I draw rectangles etc in ActionScript, using the Flash Player's drawing API (i. e. the Graphics
class), is the border line of that shape drawn on the outside or the inside of the shape? I. e., which of the following diagrams correctly depicts a rectangle drawn a the border of a content area in a custom component?
I looked at the documentation for the Graphics
class and couldn't find any hints.
I wrote a short test, using a custom component with a fixed size, drawing some lines as reference, then drawing a rectangle with a 30-pixel wide border on a white background. This is how it looks like, see below for the code:
So, referring to the picture in the question, the second diagram ("centered") correctly depicts the way Flash Player draws.
Also note how the inner lines (at 45 pixels) are just inside the rectangle, while the outer lines (at 15 pixels) align with the rectangle's outer limits.
This is the code for the test application:
And this is the
TestCanvas
component: