Misc. Grayscale Support Routines
"Gray..." names reflect the new TIGCCLIB naming convention, "...Gray" names are left for compatibility
void GrayClearScreen();
void GrayClearScreen2B(void* lightplane,void *darkplane);
void ClearGrayScreen();
void ClearGrayScreen2B(void* lightplane,void *darkplane);
GrayClearScreen/ClearGrayScreen clears both standard grayplanes at once whereas
GrayClearScreen2B/ClearGrayScreen2B clears the specified buffers.
Internally it is implemented using a very fast ASM loop which outweights any other approach
(memset() for example - especially on PedroM, since to date, the PedroM memset is extremely slow) in speed.
Note that lightplane and darkplane have to be of size 240 x 128 pixels
and they have to start at an even address (buffers allocated with malloc always starts at
an even address).
void GrayDrawRect(short x0,short y0,short x1,short y1,short color,short fill);
void GrayDrawRect2B(short x0,short y0,short x1,short y1,short color,short fill,void* lightplane,void *darkplane);
void DrawGrayRect(short x0,short y0,short x1,short y1,short color,short fill);
void DrawGrayRect2B(short x0,short y0,short x1,short y1,short color,short fill,void* lightplane,void *darkplane);
void GrayFastFillRect_R(register void* dest1 asm("%a0"),register void* dest2 asm("%a1"), register short x1 asm("%d0"),register short y1 asm("%d1"),register short x2 asm("%d2"),register short y2 asm("%d3"),short color) __attribute__((__stkparm__));
DrawGrayRect/DrawGrayRect2B/GrayDrawRect/GrayDrawRect2B draws a rectangle with vertices at
(x0,y0), (x1,y0),
(x0,y1), and (x1,y1).
Parameter color specifies the color of the rectangle.
Valid color values are defined by enumeration GrayColors.
Parameter fill specifies whether the rect
is filled (solid) or just the outline of a rectangle (hollow).
Valid arguments for fill are define
by enumeration FillAttrs.
GrayDrawRect/DrawGrayRect uses the results of GrayGetPlane(LIGHT_PLANE) and
GrayGetPlane(DARK_PLANE) as destination planes whereas GrayDrawRect2B/DrawGrayRect2B uses
the given parameters lightplane and darkplane as destination planes.
GrayFastFillRect_R is the two-plane version of FastFillRect_R, with parameter color
having the same meaning as in GrayDrawRect*.
NOTE: This function uses PortSet internally, the previously active plane is
therefore no longer valid after calling it.
void GrayInvertRect(short x0,short y0,short x1,short y1);
void GrayInvertRect2B(short x0,short y0,short x1,short y1,void* lightplane,void *darkplane);
void InvertGrayRect(short x0,short y0,short x1,short y1);
void InvertGrayRect2B(short x0,short y0,short x1,short y1,void* lightplane,void *darkplane);
InvertGrayRect/InvertGrayRect2B/GrayInvertRect/GrayInvertRect2B
inverts (switches pixels, which are off, on and those, which are on, off) a rectangle
with vertices at (x0,y0), (x1,y0), (x0,y1),
and (x1,y1).
These functions may be useful in menus where the rect inverted by GrayInvertRect can
act as the menu selection bar.
GrayInvertRect/InvertGrayRect uses the results of GrayGetPlane(LIGHT_PLANE) and
GrayGetPlane(DARK_PLANE) as destination planes whereas GrayInvertRect2B/InvertGrayRect2B
uses the given parameters lightplane and darkplane as destination planes.
NOTE: This function uses PortSet internally, the previously active plane is
therefore no longer valid after calling it.
void GrayDrawLine(short x0,short y0,short x1,short y1,short color);
void GrayDrawLine2B(short x0,short y0,short x1,short y1,short color,void* lightplane,void *darkplane);
void DrawGrayLine(short x0,short y0,short x1,short y1,short color);
void DrawGrayLine2B(short x0,short y0,short x1,short y1,short color,void* lightplane,void *darkplane);
GrayDrawLine/GrayDrawLine2B/DrawGrayLine/DrawGrayLine2B draws a line with color color
from (x0, y0) to (x1, y1) using the standard
AMS routine DrawLine.
Valid values of color are defined by enumeration GrayColors.
GrayDrawLine/DrawGrayLine uses the results of GrayGetPlane(LIGHT_PLANE) and
GrayGetPlane(DARK_PLANE) as destination planes whereas GrayDrawLine2B/DrawGrayLine2B uses
the given parameters lightplane and darkplane as destination planes.
NOTE: This function uses PortSet internally, the previously active plane is
therefore no longer valid after calling it.
void GrayFastDrawLine(short x0,short y0,short x1, short y1, short color);
void GrayFastDrawLine(short x0,short y0,short x1, short y1, short color);
void FastDrawGrayLine2B(short x0,short y0,short x1,short y1,short color,void* lightplane,void *darkplane);
void FastDrawGrayLine2B(short x0,short y0,short x1,short y1,short color,void* lightplane,void *darkplane);
GrayFastDrawLine/GrayFastDrawLine2B/FastDrawGrayLine/FastDrawGrayLine2B is a grayscale
version of the FastDrawLine function in this library, which is a replacement for the AMS
DrawLine function.
FastDrawLine is almost 500 percent faster than DrawLine which carries over to the grayscale
version. GrayFastDrawLine/FastDrawGrayLine draws a line with color color from
(x0, y0) to (x1, y1).Valid values of color
are defined by enumeration GrayColors.
GrayFastDrawLine/FastDrawGrayLine uses the results of GrayGetPlane(LIGHT_PLANE) and
GrayGetPlane(DARK_PLANE) as destination planes whereas GrayFastDrawLine2B/FastDrawGrayLine2B
uses the given parameters lightplane and darkplane as destination planes.
NOTE: This function uses PortSet internally, the previously active plane is
therefore no longer valid after calling it.
void GrayFastDrawHLine(short x0,short x1, short y, short color);
void GrayFastDrawHLine2B(short x0,short x1,short y,short color,void* lightplane,void *darkplane);
void FastDrawGrayHLine(short x0,short x1, short y, short color);
void FastDrawGrayHLine2B(short x0,short x1,short y,short color,void* lightplane,void *darkplane);
GrayFastDrawGrayHLine/GrayFastDrawHLine2B/FastDrawGrayHLine/FastDrawGrayHLine2B is a
grayscale version of the FastDrawHLine function in this library.
GrayFastDrawHLine/FastDrawGrayHLine draws a horizontal line with color color
from (x0, y) to (x1, y).Valid values of color
are defined by enumeration GrayColors.
GrayFastDrawHLine/FastDrawGrayHLine uses the results of GrayGetPlane(LIGHT_PLANE) and
GrayGetPlane(DARK_PLANE) as destination planes whereas
GrayFastDrawHLine2B/FastDrawGrayHLine2B uses the given parameters lightplane and
darkplane as destination planes.
NOTE: This function uses PortSet internally, the previously active plane is
therefore no longer valid after calling it.
void GrayDrawChar(short x,short y,char c,short attr);
void GrayDrawChar2B(short x,short y,char c,short attr,void* lightplane,void *darkplane);
void DrawGrayChar(short x,short y,char c,short attr);
void DrawGrayChar2B(short x,short y,char c,short attr,void* lightplane,void *darkplane);
GrayDrawChar/GrayDrawChar2B/DrawGrayChar/DrawGrayChar2B draws character c at a
specific (x, y) location to both grayscale planes producing a black
character. See DrawChar for a description of attribute
attr.
GrayDrawChar/DrawGrayChar uses the results of GrayGetPlane(LIGHT_PLANE) and
GrayGetPlane(DARK_PLANE) as destination planes whereas GrayDrawChar2B/DrawGrayChar2B uses
the given parameters lightplane and darkplane as destination planes.
NOTE: This function uses PortSet internally, the previously active plane is
therefore no longer valid after calling it.
void GrayDrawStr(short x,short y,char* s,short attr);
void GrayDrawStr2B(short x,short y,char* s,short attr,void* lightplane,void *darkplane);
void DrawGrayStr(short x,short y,char* s,short attr);
void DrawGrayStr2B(short x,short y,char* s,short attr,void* lightplane,void *darkplane);
GrayDrawStr/GrayDrawStr2B/DrawGrayStr/DrawGrayStr2B draws a string s at a specific
(x, y) location to both grayscale planes producing a black string.
See DrawChar for a description of attribute attr.
GrayDrawStr/DrawGrayStr uses the results of GrayGetPlane(LIGHT_PLANE) and
GrayGetPlane(DARK_PLANE) as destination planes whereas GrayDrawStr2B/DrawGrayStr2B uses the
given parameters lightplane and darkplane as destination planes.
NOTE: This function uses PortSet internally, the previously active plane is
therefore no longer valid after calling it.
void GrayDrawStrExt(short x,short y,char* s,short attr,short font);
void GrayDrawStrExt2B(short x,short y,char* s,short attr,short font,void* lightplane,void *darkplane);
void DrawGrayStrExt(short x,short y,char* s,short attr,short font);
void DrawGrayStrExt2B(short x,short y,char* s,short attr,short font,void* lightplane,void *darkplane);
GrayDrawStrExt/GrayDrawStrExt2B/DrawGrayStrExt/DrawGrayStrExt2B draws a string s
at a specific (x, y) location to both grayscale planes producing a
black string using the font font.
See DrawChar for a description of attribute attr.
GrayDrawStrExt/GrayDrawStrExt2B/DrawGrayStrExt/DrawGrayStrExt2B additonally supports the
attributes A_CENTERED and A_SHADOWED, which can be OR’ed (|) to the normal Attributes.
If A_CENTERED is used the string will be drawn then centered using the given font to
evaluate its length. When A_SHADOWED is used a lightgray shadow will be drawn with +1 pixel
offset in all two directions.
For example,
GrayDrawStrExt(0,50,"Welcome!",A_REPLACE | A_CENTERED,F_4x6);
will draw "Welcome!" horizontally centered at line 50 with font F_4x6.
GrayDrawStrExt/DrawGrayStrExt uses the results of GrayGetPlane(LIGHT_PLANE) and
GrayGetPlane(DARK_PLANE) as destination planes whereas GrayDrawStrExt2B/DrawGrayStrExt2B
uses the given parameters lightplane and darkplane as destination planes.
NOTE: This function uses PortSet internally, the previously active plane is
therefore no longer valid after calling it.