#include <graphics.h>
Public Member Functions | |
Graphics (MutableBitmapBase *bitmap) | |
virtual | ~Graphics () |
const u16 | getPixel (s16 x, s16 y) const |
virtual void | drawPixel (s16 x, s16 y, u16 colour) |
virtual void | drawFilledRect (s16 x, s16 y, u16 width, u16 height, u16 colour) |
virtual void | drawHorizLine (s16 x, s16 y, u16 width, u16 colour) |
virtual void | drawVertLine (s16 x, s16 y, u16 height, u16 colour) |
virtual void | drawXORPixel (s16 x, s16 y) |
virtual void | drawXORHorizLine (s16 x, s16 y, u16 width) |
virtual void | drawXORVertLine (s16 x, s16 y, u16 height) |
virtual void | drawBitmap (s16 x, s16 y, u16 width, u16 height, const BitmapBase *bitmap, s16 bitmapX, s16 bitmapY) |
virtual void | drawBitmap (s16 x, s16 y, u16 width, u16 height, const BitmapBase *bitmap, s16 bitmapX, s16 bitmapY, u16 transparentColour) |
virtual void | floodFill (s16 x, s16 y, u16 newColour) |
void | copy (s16 sourceX, s16 sourceY, s16 destX, s16 destY, u16 width, u16 height) |
void | dim (s16 x, s16 y, u16 width, u16 height) |
virtual void | drawLine (s16 x1, s16 y1, s16 x2, s16 y2, u16 colour) |
Protected Member Functions | |
bool | clipBitmapCoordinates (s16 *x, s16 *y, u16 *width, u16 *height) |
bool | popStack (s16 *x, s16 *y, WoopsiArray< s32 > *stack) |
void | pushStack (s16 x, s16 y, WoopsiArray< s32 > *stack) |
u8 | getClipLineOutCode (s16 x, s16 y, s16 xMin, s16 yMin, s16 xMax, s16 yMax) |
Graphics (const Graphics &graphics) |
Class providing bitmap manipulation (drawing, etc) functions. Functions are all clipped to the size of the bitmap being drawn to.
WoopsiUI::Graphics::Graphics | ( | MutableBitmapBase * | bitmap | ) |
Constructor.
bitmap | The bitmap that will be drawn to. |
virtual WoopsiUI::Graphics::~Graphics | ( | ) | [inline, virtual] |
Destructor.
WoopsiUI::Graphics::Graphics | ( | const Graphics & | graphics | ) | [inline, protected] |
Copy constructor is protected to prevent usage.
bool WoopsiUI::Graphics::clipBitmapCoordinates | ( | s16 * | x, | |
s16 * | y, | |||
u16 * | width, | |||
u16 * | height | |||
) | [protected] |
Clip the supplied rectangular dimensions to the size of the internal bitmap.
x | The x co-ordinate of the rectangle to clip (modified by the function). | |
y | The y co-ordinate of the rectangle to clip (modified by the function). | |
width | The width of the rectangle to clip (modified by the function). | |
height | The height of the rectangle to clip (modified by the function). |
void WoopsiUI::Graphics::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::Graphics::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.
virtual void WoopsiUI::Graphics::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.
virtual void WoopsiUI::Graphics::drawBitmap | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height, | |||
const BitmapBase * | bitmap, | |||
s16 | bitmapX, | |||
s16 | bitmapY | |||
) | [virtual] |
Draw an external bitmap to the internal 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::Graphics::drawFilledRect | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height, | |||
u16 | colour | |||
) | [virtual] |
Draw a filled rectangle to the internal 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.
virtual void WoopsiUI::Graphics::drawHorizLine | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | colour | |||
) | [virtual] |
Draw a horizontal line to the internal 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. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
virtual void WoopsiUI::Graphics::drawLine | ( | s16 | x1, | |
s16 | y1, | |||
s16 | x2, | |||
s16 | y2, | |||
u16 | colour | |||
) | [virtual] |
Draw a line to the internal 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.
virtual void WoopsiUI::Graphics::drawPixel | ( | s16 | x, | |
s16 | y, | |||
u16 | colour | |||
) | [virtual] |
Draw a pixel to the internal 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.
virtual void WoopsiUI::Graphics::drawVertLine | ( | s16 | x, | |
s16 | y, | |||
u16 | height, | |||
u16 | colour | |||
) | [virtual] |
Draw a vertical line to the internal 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. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
virtual void WoopsiUI::Graphics::drawXORHorizLine | ( | s16 | x, | |
s16 | y, | |||
u16 | width | |||
) | [virtual] |
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. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
virtual void WoopsiUI::Graphics::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.
virtual void WoopsiUI::Graphics::drawXORVertLine | ( | s16 | x, | |
s16 | y, | |||
u16 | height | |||
) | [virtual] |
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. |
Reimplemented from WoopsiUI::GraphicsUnclipped.
virtual void WoopsiUI::Graphics::floodFill | ( | s16 | x, | |
s16 | y, | |||
u16 | newColour | |||
) | [virtual] |
Fill a region of the internal bitmap with the specified colour.
x | The x co-ordinate to use as the starting point of the fill. | |
y | The y co-ordinate to use as the starting point of the fill. | |
newColour | The colour to fill with. |
u8 WoopsiUI::Graphics::getClipLineOutCode | ( | s16 | x, | |
s16 | y, | |||
s16 | xMin, | |||
s16 | yMin, | |||
s16 | xMax, | |||
s16 | yMax | |||
) | [protected] |
Get the clipping code for the given co-ordinates based on the given clipping region.
x | X co-ordinate to clip. | |
y | Y co-ordinate to clip. | |
xMin | Minimum x value. | |
yMin | Minimum y value. | |
xMax | Maximum x value. | |
yMax | Maximum y value. |
const u16 WoopsiUI::Graphics::getPixel | ( | s16 | x, | |
s16 | y | |||
) | const [virtual] |
Get 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.
bool WoopsiUI::Graphics::popStack | ( | s16 * | x, | |
s16 * | y, | |||
WoopsiArray< s32 > * | stack | |||
) | [protected] |
Remove the last item from the flood fill stack and insert its properties into the supplied x and y variables.
x | The x co-ordinate of the pixel from the stack (output by the function). | |
y | The y co-ordinate of the pixel from the stack (output by the function). | |
stack | Pointer to the stack to pop from. |
void WoopsiUI::Graphics::pushStack | ( | s16 | x, | |
s16 | y, | |||
WoopsiArray< s32 > * | stack | |||
) | [protected] |
Push new co-ordinates onto the stack.
x | The x co-ordinate of the pixel to add to the stack. | |
y | The y co-ordinate of the pixel to add to the stack. | |
stack | The stack to add a new value to. |