#include <graphicsport.h>
Public Member Functions | |
GraphicsPort (Gadget *const gadget, const s16 x, const s16 y, const u16 width, const u16 height, FrameBuffer *bitmap, const WoopsiArray< Rect > *clipRectList, const Rect *clipRect) | |
~GraphicsPort () | |
const s16 | getX () const |
const s16 | getY () const |
void | drawPixel (s16 x, s16 y, u16 colour) |
void | drawFilledRect (s16 x, s16 y, u16 width, u16 height, u16 colour) |
void | drawHorizLine (s16 x, s16 y, s16 width, u16 colour) |
void | drawVertLine (s16 x, s16 y, s16 height, u16 colour) |
void | drawRect (s16 x, s16 y, u16 width, u16 height, u16 colour) |
void | drawBevelledRect (s16 x, s16 y, u16 width, u16 height, u16 shineColour, u16 shadowColour) |
void | drawBevelledRect (s16 x, s16 y, u16 width, u16 height) |
virtual void | drawCircle (s16 x0, s16 y0, u16 radius, u16 colour) |
void | drawFilledCircle (s16 x0, s16 y0, u16 radius, u16 colour) |
virtual void | drawXORPixel (s16 x, s16 y) |
void | drawXORHorizLine (s16 x, s16 y, s16 width) |
void | drawXORVertLine (s16 x, s16 y, s16 height) |
void | drawXORRect (s16 x, s16 y, u16 width, u16 height) |
void | drawFilledXORRect (s16 x, s16 y, u16 width, u16 height) |
void | drawText (s16 x, s16 y, FontBase *font, const char *string) |
void | drawText (s16 x, s16 y, FontBase *font, u16 length, const char *string) |
void | drawText (s16 x, s16 y, FontBase *font, u16 length, const char *string, u16 colour) |
void | drawText (s16 x, s16 y, FontBase *font, char letter) |
void | drawText (s16 x, s16 y, FontBase *font, const char *string, u16 colour) |
void | drawText (s16 x, s16 y, FontBase *font, char letter, u16 colour) |
void | drawBitmap (s16 x, s16 y, u16 width, u16 height, const BitmapBase *bitmap, s16 bitmapX, s16 bitmapY) |
void | drawBitmap (s16 x, s16 y, u16 width, u16 height, const BitmapBase *bitmap, s16 bitmapX, s16 bitmapY, u16 transparentColour) |
void | drawLine (s16 x1, s16 y1, s16 x2, s16 y2, u16 colour) |
void | clear () |
void | copy (s16 sourceX, s16 sourceY, s16 destX, s16 destY, u16 width, u16 height) |
void | scroll (s16 x, s16 y, s16 xDistance, s16 yDistance, u16 width, u16 height, WoopsiArray< Rect > *revealedRects) |
void | dim (s16 x, s16 y, u16 width, u16 height) |
GraphicsPort is the interface between a gadget and the framebuffer. It provides drawing tools that are clipped to the visible regions of a gadget. This class can only draw to one of the DS' framebuffers. It makes extensive use of the DMA hardware and does not call DC_FlushRange(), which will cause problems if it attempts to draw to anything other than VRAM.
WoopsiUI::GraphicsPort::GraphicsPort | ( | Gadget *const | gadget, | |
const s16 | x, | |||
const s16 | y, | |||
const u16 | width, | |||
const u16 | height, | |||
FrameBuffer * | bitmap, | |||
const WoopsiArray< Rect > * | clipRectList, | |||
const Rect * | clipRect | |||
) |
Constructor.
gadget | Pointer to the gadget that this port will draw into. | |
x | The x co-ordinate of the graphics port. | |
y | The y co-ordinate of the graphics port. | |
width | The width of the graphics port. | |
height | The height of the graphics port. | |
bitmap | The bitmap that the port will draw to. | |
clipRectList | An array of clipping regions within which the class must draw. If set, clipRect must be NULL. | |
clipRect | The clipping region within which the class must draw. If set, clipRectList must be NULL. |
WoopsiUI::GraphicsPort::~GraphicsPort | ( | ) | [inline] |
Destructor.
void WoopsiUI::GraphicsPort::clear | ( | ) |
Erases the graphics port's output by redrawing its gadget.
void WoopsiUI::GraphicsPort::copy | ( | s16 | sourceX, | |
s16 | sourceY, | |||
s16 | destX, | |||
s16 | destY, | |||
u16 | width, | |||
u16 | height | |||
) |
Copy a rectangular region from the source co-ordinates to the destination co-ordinates. Uses the DMA for speed. Worst-case scenario uses an off-screen buffer for situations wherein there is no vertical movement and the source and destination overlap, in which case two copies are performed for each row (source to buffer and buffer to destination). Does not clip.
sourceX | Source x co-ord. | |
sourceY | Source y co-ord. | |
destX | Destination x co-ord. | |
destY | Destination y co-ord. | |
width | Width of the rectangle to copy. | |
height | Height of the rectangle to copy. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::dim | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height | |||
) |
Halve the brightness of a specified region.
x | X co-ord of the region to dim. | |
y | Y co-ord of the region to dim. | |
width | Width of the region to dim. | |
height | Height of the region to dim. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawBevelledRect | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height | |||
) |
Draw a bevelled rectangle to the bitmap using the gadget's border details as the basis of the bevel colours.
x | The x co-ordinate of the rectangle. | |
y | The y co-ordinate of the rectangle. | |
width | The width of the rectangle. | |
height | The height of the rectangle. |
void WoopsiUI::GraphicsPort::drawBevelledRect | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height, | |||
u16 | shineColour, | |||
u16 | shadowColour | |||
) |
Draw a bevelled rectangle to the bitmap.
x | The x co-ordinate of the rectangle. | |
y | The y co-ordinate of the rectangle. | |
width | The width of the rectangle. | |
height | The height of the rectangle. | |
shineColour | The colour of the top/left sides. | |
shadowColour | The colour of the bottom/right sides. |
void WoopsiUI::GraphicsPort::drawBitmap | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height, | |||
const BitmapBase * | bitmap, | |||
s16 | bitmapX, | |||
s16 | bitmapY, | |||
u16 | transparentColour | |||
) | [virtual] |
Draw a bitmap to the port's bitmap, using the supplied transparent colour as an invisible colour. This is considerably slower than the standard bitmap drawing routine as it plots pixel-by-pixel instead of using a scanline DMA copy.
x | The x co-ordinate to draw the bitmap to. | |
y | The y co-ordinate to draw the bitmap to. | |
width | The width of the bitmap to draw. | |
height | The height of the bitmap to draw. | |
bitmap | Pointer to the bitmap to draw. | |
bitmapX | The x co-ordinate within the supplied bitmap to use as the origin. | |
bitmapY | The y co-ordinate within the supplied bitmap to use as the origin. | |
transparentColour | The transparent colour used in the bitmap. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawBitmap | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height, | |||
const BitmapBase * | bitmap, | |||
s16 | bitmapX, | |||
s16 | bitmapY | |||
) | [virtual] |
Draw a bitmap to the port's bitmap.
x | The x co-ordinate to draw the bitmap to. | |
y | The y co-ordinate to draw the bitmap to. | |
width | The width of the bitmap to draw. | |
height | The height of the bitmap to draw. | |
bitmap | Pointer to the bitmap to draw. | |
bitmapX | The x co-ordinate within the supplied bitmap to use as the origin. | |
bitmapY | The y co-ordinate within the supplied bitmap to use as the origin. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
virtual void WoopsiUI::GraphicsPort::drawCircle | ( | s16 | x0, | |
s16 | y0, | |||
u16 | radius, | |||
u16 | colour | |||
) | [virtual] |
Draw an unfilled circle to the internal bitmap.
x0 | The x co-ordinate of the circle. | |
y0 | The y co-ordinate of the circle. | |
radius | The radius of the circle. | |
colour | The colour of the circle. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawFilledCircle | ( | s16 | x0, | |
s16 | y0, | |||
u16 | radius, | |||
u16 | colour | |||
) | [virtual] |
Draw a filled circle to the bitmap.
x0 | The x co-ordinate of the circle. | |
y0 | The y co-ordinate of the circle. | |
radius | The radius of the circle. | |
colour | The colour of the circle. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawFilledRect | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height, | |||
u16 | colour | |||
) | [virtual] |
Draw a filled rectangle to the bitmap.
x | The x co-ordinate of the rectangle. | |
y | The y co-ordinate of the rectangle. | |
width | The width of the rectangle. | |
height | The height of the rectangle. | |
colour | The colour of the rectangle. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawFilledXORRect | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height | |||
) | [virtual] |
Invert the colour of an filled rectangle of pixels.
x | The x co-ordinate of the rectangle. | |
y | The y co-ordinate of the rectangle. | |
width | The width of the rectangle. | |
height | The height of the rectangle. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawHorizLine | ( | s16 | x, | |
s16 | y, | |||
s16 | width, | |||
u16 | colour | |||
) |
Draw a horizontal line to the bitmap
x | The x co-ordinate of the line. | |
y | The y co-ordinate of the line. | |
width | The width of the line. | |
colour | The colour of the line. |
void WoopsiUI::GraphicsPort::drawLine | ( | s16 | x1, | |
s16 | y1, | |||
s16 | x2, | |||
s16 | y2, | |||
u16 | colour | |||
) | [virtual] |
Draw a line to the port's bitmap.
x1 | The x co-ordinate of the start point of the line. | |
y1 | The y co-ordinate of the start point of the line. | |
x2 | The x co-ordinate of the end point of the line. | |
y2 | The y co-ordinate of the end point of the line. | |
colour | The colour of the line. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawPixel | ( | s16 | x, | |
s16 | y, | |||
u16 | colour | |||
) | [virtual] |
Draw a pixel to the bitmap.
x | The x co-ordinate of the pixel. | |
y | The y co-ordinate of the pixel. | |
colour | The colour of the pixel. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawRect | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height, | |||
u16 | colour | |||
) | [virtual] |
Draw an unfilled rectangle to the bitmap
x | The x co-ordinate of the rectangle. | |
y | The y co-ordinate of the rectangle. | |
width | The width of the rectangle. | |
height | The height of the rectangle. | |
colour | The colour of the rectangle. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawText | ( | s16 | x, | |
s16 | y, | |||
FontBase * | font, | |||
char | letter, | |||
u16 | colour | |||
) | [virtual] |
Draw a single character to the bitmap in a specific colour.
x | The x co-ordinate of the character. | |
y | The y co-ordinate of the character. | |
font | The font to draw with. | |
letter | The character to output. | |
colour | The colour of the character. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawText | ( | s16 | x, | |
s16 | y, | |||
FontBase * | font, | |||
const char * | string, | |||
u16 | colour | |||
) | [virtual] |
Draw a string to the bitmap in a specific colour.
x | The x co-ordinate of the string. | |
y | The y co-ordinate of the string. | |
font | The font to draw with. | |
string | The string to output. | |
colour | The colour of the string. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawText | ( | s16 | x, | |
s16 | y, | |||
FontBase * | font, | |||
char | letter | |||
) | [virtual] |
Draw a single character to the bitmap.
x | The x co-ordinate of the character. | |
y | The y co-ordinate of the character. | |
font | The font to draw with. | |
letter | The character to output. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawText | ( | s16 | x, | |
s16 | y, | |||
FontBase * | font, | |||
u16 | length, | |||
const char * | string, | |||
u16 | colour | |||
) | [virtual] |
Draw a particular length of a string to the bitmap in a secific colour.
x | The x co-ordinate of the string. | |
y | The y co-ordinate of the string. | |
font | The font to draw with. | |
length | The number of characters to output. | |
string | The string to output. | |
colour | The colour of the string. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawText | ( | s16 | x, | |
s16 | y, | |||
FontBase * | font, | |||
u16 | length, | |||
const char * | string | |||
) | [virtual] |
Draw a particular length of a string to the bitmap.
x | The x co-ordinate of the string. | |
y | The y co-ordinate of the string. | |
font | The font to draw with. | |
length | The number of characters to output. | |
string | The string to output. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawText | ( | s16 | x, | |
s16 | y, | |||
FontBase * | font, | |||
const char * | string | |||
) | [virtual] |
Draw a string to the bitmap.
x | The x co-ordinate of the string. | |
y | The y co-ordinate of the string. | |
font | The font to draw with. | |
string | The string to output. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawVertLine | ( | s16 | x, | |
s16 | y, | |||
s16 | height, | |||
u16 | colour | |||
) |
Draw a vertical line to the bitmap
x | The x co-ordinate of the line. | |
y | The y co-ordinate of the line. | |
height | The height of the line. | |
colour | The colour of the line. |
void WoopsiUI::GraphicsPort::drawXORHorizLine | ( | s16 | x, | |
s16 | y, | |||
s16 | width | |||
) |
Invert the colour of a horizontal line of pixels.
x | The x co-ordinate of the line. | |
y | The y co-ordinate of the line. | |
width | The width of the line. |
virtual void WoopsiUI::GraphicsPort::drawXORPixel | ( | s16 | x, | |
s16 | y | |||
) | [virtual] |
Invert the colour of the pixel at the specified co-ordinates.
x | The x co-ordinate of the pixel. | |
y | The y co-ordinate of the pixel. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawXORRect | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height | |||
) | [virtual] |
Invert the colour of an unfilled rectangle of pixels.
x | The x co-ordinate of the rectangle. | |
y | The y co-ordinate of the rectangle. | |
width | The width of the rectangle. | |
height | The height of the rectangle. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
void WoopsiUI::GraphicsPort::drawXORVertLine | ( | s16 | x, | |
s16 | y, | |||
s16 | height | |||
) |
Invert the colour of a vertical line of pixels.
x | The x co-ordinate of the line. | |
y | The y co-ordinate of the line. | |
height | The height of the line. |
const s16 WoopsiUI::GraphicsPort::getX | ( | ) | const [inline] |
Return the x co-ordinate of the graphics port.
const s16 WoopsiUI::GraphicsPort::getY | ( | ) | const [inline] |
Return the y co-ordinate of the graphics port.
void WoopsiUI::GraphicsPort::scroll | ( | s16 | x, | |
s16 | y, | |||
s16 | xDistance, | |||
s16 | yDistance, | |||
u16 | width, | |||
u16 | height, | |||
WoopsiArray< Rect > * | revealedRects | |||
) |
Scroll a region by a specified distance in two dimensions. Performs a clipped copy to achieve scroll effect.
x | X co-ord of the area to scroll. | |
y | Y co-ord of the area to scroll. | |
xDistance | Horizontal distance to scroll. | |
yDistance | Vertical distance to scroll. | |
width | Width of the area to scroll. | |
height | Height of the area to scroll. | |
revealedRects | Populated with rects representing the region uncovered by the scroll method. This should be empty when passed, and the regions should be drawn to once the scroll has finished. |