Datasheet

8
Graphics Quick Reference Guide
Graphics Library Quick Reference Guide
Primitive Layer
Primitive Layer Description
void InitGraph()
Initialize the display controller, sets the
screen to BLACK, sets current color to
WHITE, sets the cursor at (0,0), sets the
line type to SOLID_LINE and sets the
active page and visual page to 0.
void ClearDevice()
Clears the screen with the current color
and sets the cursor at (0,0).
SHORT GetX() Returns the graphic cursor x coordinates.
SHORT GetY() Returns the graphic cursor y coordinates.
void MoveTo(SHORT x, SHORT y)
Moves the graphic cursor to the new x, y
location.
void MovetoRel(SHORT x, SHORT y)
Moves the graphic cursor relative to the
current location.
void SetFont(void *pFont)
Sets the current font to be used when
rendering characters.
void SetFontOrientation(WORD orient)
Sets the font orientation to vertical or
horizontal orientation.
orient definition
ORIENT_HOR horizontal
ORIENT_VER vertical
BYTE GetFontOrientation()
Returns the current font orientation (vertical
or horizontal). See SetFontOrientation().
WORD OutChar(XCHAR ch)
Renders the character represented by the
character ID ch on the current graphic cursor
position using the current set font and color.
WORD OutText(XCHAR *pString)
Renders a string of characters pointed to
by pString on the current graphic cursor
location using the current set font and color.
WORD OutTextXY(
SHORT x,
SHORT y,
XCHAR *pString)
Renders the specified string pointed to
by pString on the location specified by x,y
using the current set font and color.
SHORT GetTextHeight(void *pFont) Returns the height of the specified font.
SHORT GetTextWidth(
XCHAR pString,
void *pFont)
Returns the width of the specified string for
the specified font.
void SetLineType(WORD lnType)
Sets the line type to render.
lnType definition
SOLID_LINE Solid line
DASHED_LINE Dashed line
void SetLineThickness(WORD
lnThickness)
Sets the line thickness to render.
lnThickness definition
NORMAL_LINE 1 pixel thick
THICK_LINE 3 pixel thick
WORD Line(
SHORT x1,
SHORT y1,
SHORT x2,
SHORT y2)
Renders a line using the current set line
type, line thickness and color from x1, y1
to x2, y2.
WORD LineRel(
SHORT x,
SHORT y)
Renders a line using the current set line
type, line thickness and color from the
current graphic cursor position to the
relative position specified by the given x
and y displacement.
WORD LineTo(
SHORT x,
SHORT y)
Renders a line using the current set line
type, line thickness and color from the
current graphic cursor position to the given
x,y position.
Primitive Layer (Continued)
Primitive Layer Description
WORD Circle(
SHORT x,
SHORT y,
SHORT r)
Renders a circle using the current set line
type, line size and color located at center
on x, y with a radius r.
WORD FillCircle(
SHORT x,
SHORT y,
SHORT r)
Renders a filled circle using the current
set color located at center on x, y with a
radius r.
WORD DrawPoly(
SHORT numPoints,
SHORT *polyPoints)
Renders a polygon with the current line
type, line size and color where the number
of points is given by numPoints and the
polygon points is given by the array pointed
to by polyPoints.
PolyPoints[n] = x0,y0,x1,y1,…xn,yn;
n = numPoints
WORD Arc(
SHORT xL,
SHORT yR,
SHORT xR,
SHORT yB,
SHORT r1,
SHORT r2,
BYTE octant)
Draws the octant arc of the beveled figure
with the given centers, radii and octant
mask.
WORD PutImage(
SHORT left,
SHORT top,
void *pBitmap,
BYTE stretch)
Renders the image pointed to by pBitmap
starting from left, top position.
SHORT GetImageHeight(
void *pBitmap)
Returns the image height.
SHORT GetImageWidth(
void *pBitmap)
Returns the image width.
SHORT GetSineCosine(
SHORT v,
WORD type)
Returns the sine or cosine (type = GETSINE
or GETCOSINE) values of the given angle v.
Return values are normalized to 256.
SHORT Sine(
SHORT v)
Returns the sine value of the given angle v.
Return values are normalized to 256.
SHORT Cosine(
SHORT v)
Returns the cosine value of the given angle
v. Return values are normalized to 256.
WORD AlphaBlendWindow(
DWORD
foregroundWindowAddr,
DWORD
backgroundWindowAddr,
DWORD
destinationWindowAddr,
WORD width,
WORD height,
BYTE alphaPercentage)
Alpha blends the foreground and the
background images with the dimension
specified by width and height and writes
the result to the destination.
Graphics Config: USE_ALPHA_BLEND(1)
DWORD GFXGetPageXYAddress(
SHORT pageNumber,
WORD x,
WORD y)
Calculates the address of the pixel located
in x, y position inside the buffer specified
by pageNumber.
Graphics Config: USE_ALPHA_BLEND(1)
DWORD GFXGetPageOriginAddress(
SHORT pageNumber)
Calculates the address of the buffer
specified by pageNumber.
Graphics Config: USE_ALPHA_BLEND(1)
WORD ExternalMemoryCallback(
GFX_EXTDATA *memory,
LONG offset,
WORD nCount,
void *buffer)
When using external memory, this function
must be implemented in the application
code and will contain code to access
external memory with the appropriate
external memory drivers.
Graphics Config: USE_FONT_EXTERNAL or
USE_BITMAP_EXTERNAL
Note:
1. This is an optional feature and is implemented only if the display controller supports alpha blending.