ADLineShapeObject Class Reference


Detailed Description

Maintains its own end-points for each end of the line so future versions can have directionally rendered lines (eg: arrows).

Thus mXPos and mYPos are maintained as top-left, mWidth and mHeight define the enclosing rectangle and the line ends are mX1, mY1 to mX2, mY2 where one of these pair of points will correspond to mXPos and mYPos.

Hit Testing
The line class uses a different approach to hit testing than other classes due to simple bounds testing not having a fine enough degree of granularity. The approach is a technique that can be used for other complex shapes where complex equations may be required. The technique involves drawing the line within a picture mask then comparing the colour of the pixel at the required co-ordinates. By limiting the drawing to the mask we ensure that we are simply testing for either black or white pixels. If the pixel at the co-ordinates in question is black then the co-ordinates do NOT lie on the line, if the pixel is white then the co-ordinates are within the line.
A degree of 'slop' can also be applied by expanding the size of shape drawn within the mask. The simplest way to achieve this is by increasing the size of the PenWdith and PenHeight by a 'slop' amount. Then normal drawing can occur without any extra calculations required. Pixel colour testing occurs as normal. There is also no need for extra code to handle slop conditions. This technique can be used for complex shapes with no extra overhead or complex calculations as we are simply testing the colour value of a co-ordinate in the shape mask. This technique also works with shapes which may have holes in them without the need for complex raster algorithms.
Currently this technique is only used for lines but could easily be expanded to handle any shapes implemented.
The only possible issue with this technique is that memory requirements increase due to the masks being created and destroyed. It is a very simple, reliable and fast technique which does not require solving any complex equations which would be complex and time consuming for arbitrary shapes.


The documentation for this class was generated from the following file:
Generated on Sat Nov 11 10:52:57 2006 for mf2 by  doxygen 1.5.1