6-22
Using Using Graphics Tools
Programmer’s Manual
In the above example, a thick vertical line will be drawn as follow:
6.20
Draw a Line
STATUS
DrawLine
(U16 greyLevel, U16 xSrc U16 ySrc U16 xDest, U16
yDest U16 dotLine U16 style)
This routine will draw a line from (xSrc, ySrc) to (xDest, yDest).
If dot width is greater than 1, each dot on the specified line will be represented by
a thick square dot. Each of the thick square dot is generated by extending integer
truncated (dot width - 1)/2 pixels above, (dot width)/2 below, (dot width - 1)/2
pixels to the left and (dot width)/2 pixels to the right of the original dot. The thick
line is then generated by overlapping these thick dots accordingly.
Example 6-15 Draw a black line
STATUS ret;
/* draw a black line from (60, 240) to (630, 470) */
ret = DrawLine(BLACK, 60, 240, 630, 470, 0, REPLACE_STYLE);
Figure 6-12 Screen output for Example 6-14
(10, 11)
(10, 10)
Figure 6-13 Screen output for Example 6-15
LCD
Panning Screen
(50, 50)
(0, 0)
(60, 240)
(630, 470)
Personal Portable System Manager
Programmer’s Manual
6-23
In this example, the dot width is 1. The calling of DrawLine(BLACK, 60, 240, 630,
470, 0, REPLACE_STYLE) will draw a black line from (60, 240) to (630, 470) on
panning screen. However, only the portion of the line on LCD display screen will
be seen.
Example 6-16 Draw a thick line
STATUS ret;
/* set dot width to 4 */
ret = SetDotWidth(4, 0);
if (ret !=PPSM_OK)
return ret;
/* draw a black thick line from (10, 10) to (11, 11) */
ret = DrawLine(BLACK, 10, 10, 11, 11, 0, REPLACE_STYLE);
if (ret != PPSM_OK)
return ret;
In the above example, a thick horizontal line will be drawn as follow:
6.21
Draw a Rectangle
STATUS
DrawRec
(U16
yDest U16
)
This routine draws a rectangle with top left corner at (xSrc, ySrc) and bottom
corner at (xDest, yDest).
If the dot width is greater than 1, integer truncated (dot width - 1)/2 lines are drawn
inside the rectangle and (dot width)/2 lines drawn outside the rectangle.
If both fill pattern mode and border mode are set, those area inside the rectangle
which is not covered by the border will be filled.
If fill pattern mode is set and border mode is off, the area inside and on the
rectangle border will be filled.
Figure 6-14 Screen output for
(10, 10)
(11, 11)
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.