|
||
class TLinearDDA;
Linear digital differential analyser.
This is used to calculate the pixels which most closely approximate a specified straight line, or when scaling a bitmap. Note that a line is infinitely thin, and can only be approximated by pixels with real width and height.
Functions are provided for: pixel line traversing; jumping to a rectangle or co-ordinate
Defined in TLinearDDA
:
Construct(const TPoint &,const TPoint &,TLineMode)
Constructs a linear DDA, setting the start and end points of the line.ECenter
Centres scan-lines in the pixel line ELeft
Starts at the beginning of a complete scan line. Used for bitmap scaling. JumpToRect(const TRect &)
Jumps to start of a clipping rectangle.JumpToXCoord(const TInt,TInt &)
Jumps to x co-ordinate.JumpToXCoord2(TInt,TInt &)
Jumps to x co-ordinate.JumpToYCoord(TInt &,const TInt)
Jumps to a y co-ordinate.JumpToYCoord2(TInt &,TInt)
Jumps to a y co-ordinate.NextStep(TPoint &)
Gets the pixel co-ordinates of the start of the next scan line.SingleScanline(TPoint &,TPoint &)
Gets the start and end pixel co-ordinates that define the next scan line.SingleStep(TPoint &)
Gets the pixel co-ordinates of the next pixel on the pixel line.TLineMode
LDDA Line mode. TLinearDDA()
Constructs the default linear DDA.TLinearDDA(const TLinearDDA &)
Copy constructs a linear DDA from the specified linear DDA.IMPORT_C TLinearDDA();
Constructs the default linear DDA.
No start or end point is defined for the line.
IMPORT_C TLinearDDA(const TLinearDDA &aLine);
Copy constructs a linear DDA from the specified linear DDA.
|
IMPORT_C void Construct(const TPoint &aStart, const TPoint &aFinish, TLineMode aMode=ECenter);
Constructs a linear DDA, setting the start and end points of the line.
|
IMPORT_C TBool SingleStep(TPoint &aPosition);
Gets the pixel co-ordinates of the next pixel on the pixel line.
The function is called repeatedly until the whole line has been traversed.
|
|
IMPORT_C TBool SingleScanline(TPoint &aStartPosition, TPoint &aEndPosition);
Gets the start and end pixel co-ordinates that define the next scan line.
The best line that joins the start and end points is formed from all the scan lines returned by this function.
The function is called repeatedly until the position of all scanlines has been returned.
The start and end points passed to the constructor of this object define the boundaries of the line. Successive scan lines move from the start point to the end point.
|
|
IMPORT_C TBool NextStep(TPoint &aPosition);
Gets the pixel co-ordinates of the start of the next scan line.
The best line that joins the start and end points is formed from all the scan lines returned by this function.
The function is called repeatedly until the start position of all scanlines has been returned.
The start and end points passed to the constructor of this object define the boundaries of the line. Successive scan lines move from the start point to the end point.
|
|
IMPORT_C void JumpToRect(const TRect &aRect);
Jumps to start of a clipping rectangle.
This will accelerate the linear DDA to the vicinity of the specified rectangle. It is NOT guaranteed to reach the rectangle, but will reduce co-ordinates that are 1000's out to co-ordinates that are 10's out. Because of this, failure to intersect the rectangle may not be detected. If it is, or the line has not been constructed or has been run to completion, then a subsequent call to the stepping functions returns ETrue.
|
IMPORT_C void JumpToXCoord(const TInt aXCoord, TInt &aYCoord);
Jumps to x co-ordinate.
The other co-ordinate of the intersection is returned through a reference argument. After a jump call, the line is ready to continue through calls to the stepping functions.
This function accelerates the Linear DDA stepping functions (e.g. TLinearDDA::SingleStep(TPoint &)
) making them return EFalse when they reach the specified co-ordinate. If the line does not cross the co-ordinate, has not
been constructed, has been run to completion or the intersection is the end point of the line then the stepping functions
will return ETrue.
|
IMPORT_C void JumpToYCoord(TInt &aXCoord, const TInt aYCoord);
Jumps to a y co-ordinate.
The other co-ordinate of the intersection is returned through a reference argument. After a jump call, the line is ready to continue through calls to the stepping functions.
This function accelerates the Linear DDA stepping functions (e.g. TLinearDDA::SingleStep(TPoint &)
) making them return EFalse when they reach the specified co-ordinate. If the line does not cross the co-ordinate, has not
been constructed, has been run to completion or the intersection is the end point of the line then they will return ETrue.
|
IMPORT_C void JumpToXCoord2(TInt aXCoord, TInt &aYCoord);
Jumps to x co-ordinate.
This works in the same way as TLinearDDA::JumpToXCoord(const TInt,TInt &)
except that it make sure that using the NextStep function does not return the same value twice.
|
TLinearDDA::JumpToXCoord(const TInt,TInt &)
Jumps to x co-ordinate.IMPORT_C void JumpToYCoord2(TInt &aXCoord, TInt aYCoord);
Jumps to a y co-ordinate.
This works in the same way as TLinearDDA::JumpToYCoord(TInt &,const TInt)
except that it make sure that using the NextStep function does not return the same value twice.
|
TLinearDDA::JumpToYCoord(TInt &,const TInt)
Jumps to a y co-ordinate.