# WoopsiUI::GraphicsPort Class Reference

`#include <graphicsport.h>`

List of all members.

## Public Member Functions
| GraphicsPort (Gadget *const gadget, const s16 x, const s16 y, const u16 width, const u16 height, u16 *const bitmap, const u16 bitmapWidth, const u16 bitmapHeight, const WoopsiArray< Gadget::Rect > *clipRectList, const Gadget::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)
void | drawFilledCircle (s16 x0, s16 y0, u16 radius, u16 colour)
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, 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 u16 *bitmap, s16 bitmapX, s16 bitmapY, u16 bitmapWidth, u16 bitmapHeight)
void | drawBitmap (s16 x, s16 y, u16 width, u16 height, const u16 *bitmap, s16 bitmapX, s16 bitmapY, u16 bitmapWidth, u16 bitmapHeight, 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< Gadget::Rect > *revealedRects)
void | dim (s16 x, s16 y, u16 width, u16 height)

## Detailed Description

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.

## Constructor & Destructor Documentation

GraphicsPort::GraphicsPort | ( | Gadget *const | gadget,
|  | const s16 | x,
|  | const s16 | y,
|  | const u16 | width,
|  | const u16 | height,
|  | u16 *const | bitmap,
|  | const u16 | bitmapWidth,
|  | const u16 | bitmapHeight,
|  | const WoopsiArray< Gadget::Rect > * | clipRectList,
|  | const Gadget::Rect * | clipRect |
| ) |  |  |

Constructor.

Parameters:

  | 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.
  | bitmapWidth | The width of the bitmap being drawn to.
  | bitmapHeight | The height of the bitmap being drawn 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.

## Member Function Documentation

void GraphicsPort::clear | ( |  | ) |

Erases the graphics port's output by redrawing its gadget.

void 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.

Parameters:

  | 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.

void GraphicsPort::dim | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height |
| ) |  |  |

Halve the brightness of a specified region.

Parameters:

  | 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.

void 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.

Parameters:

  | 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 GraphicsPort::drawBevelledRect | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | u16 | shineColour,
|  | u16 | shadowColour |
| ) |  |  |

Draw a bevelled rectangle to the bitmap.

Parameters:

  | 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 GraphicsPort::drawBitmap | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | const u16 * | bitmap,
|  | s16 | bitmapX,
|  | s16 | bitmapY,
|  | u16 | bitmapWidth,
|  | u16 | bitmapHeight,
|  | u16 | transparentColour |
| ) |  |  |

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.

Parameters:

  | 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.
  | bitmapWidth | The width of the supplied bitmap.
  | bitmapHeight | The height of the supplied bitmap.
  | transparentColour | The transparent colour used in the bitmap.

void GraphicsPort::drawBitmap | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | const u16 * | bitmap,
|  | s16 | bitmapX,
|  | s16 | bitmapY,
|  | u16 | bitmapWidth,
|  | u16 | bitmapHeight |
| ) |  |  |

Draw a bitmap to the port's bitmap.

Parameters:

  | 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.
  | bitmapWidth | The width of the supplied bitmap.
  | bitmapHeight | The height of the supplied bitmap.

void GraphicsPort::drawFilledCircle | ( | s16 | x0,
|  | s16 | y0,
|  | u16 | radius,
|  | u16 | colour |
| ) |  |  |

Draw a filled circle to the bitmap.

Parameters:

  | 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.

void GraphicsPort::drawFilledRect | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | u16 | colour |
| ) |  |  |

Draw a filled rectangle to the bitmap.

Parameters:

  | 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.

void GraphicsPort::drawFilledXORRect | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height |
| ) |  |  |

Invert the colour of an filled rectangle of pixels.

Parameters:

  | 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 GraphicsPort::drawHorizLine | ( | s16 | x,
|  | s16 | y,
|  | s16 | width,
|  | u16 | colour |
| ) |  |  |

Draw a horizontal line to the bitmap

Parameters:

  | 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 GraphicsPort::drawLine | ( | s16 | x1,
|  | s16 | y1,
|  | s16 | x2,
|  | s16 | y2,
|  | u16 | colour |
| ) |  |  |

Draw a line to the port's bitmap.

Parameters:

  | 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.

void GraphicsPort::drawPixel | ( | s16 | x,
|  | s16 | y,
|  | u16 | colour |
| ) |  |  |

Draw a pixel to the bitmap.

Parameters:

  | x | The x co-ordinate of the pixel.
  | y | The y co-ordinate of the pixel.
  | colour | The colour of the pixel.

void GraphicsPort::drawRect | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | u16 | colour |
| ) |  |  |

Draw an unfilled rectangle to the bitmap

Parameters:

  | 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.

void GraphicsPort::drawText | ( | s16 | x,
|  | s16 | y,
|  | FontBase * | font,
|  | char | letter,
|  | u16 | colour |
| ) |  |  |

Draw a single character to the bitmap in a specific colour.

Parameters:

  | 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.

void GraphicsPort::drawText | ( | s16 | x,
|  | s16 | y,
|  | FontBase * | font,
|  | const char * | string,
|  | u16 | colour |
| ) |  |  |

Draw a string to the bitmap in a specific colour.

Parameters:

  | 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.

void GraphicsPort::drawText | ( | s16 | x,
|  | s16 | y,
|  | FontBase * | font,
|  | char | letter |
| ) |  |  |

Draw a single character to the bitmap.

Parameters:

  | 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.

void GraphicsPort::drawText | ( | s16 | x,
|  | s16 | y,
|  | FontBase * | font,
|  | u16 | length,
|  | const char * | string |
| ) |  |  |

Draw a particular length of a string to the bitmap.

Parameters:

  | 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.

void GraphicsPort::drawText | ( | s16 | x,
|  | s16 | y,
|  | FontBase * | font,
|  | const char * | string |
| ) |  |  |

Draw a string to the bitmap.

Parameters:

  | 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.

void GraphicsPort::drawVertLine | ( | s16 | x,
|  | s16 | y,
|  | s16 | height,
|  | u16 | colour |
| ) |  |  |

Draw a vertical line to the bitmap

Parameters:

  | 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 GraphicsPort::drawXORHorizLine | ( | s16 | x,
|  | s16 | y,
|  | s16 | width |
| ) |  |  |

Invert the colour of a horizontal line of pixels.

Parameters:

  | x | The x co-ordinate of the line.
  | y | The y co-ordinate of the line.
  | width | The width of the line.

void WoopsiUI::GraphicsPort::drawXORPixel | ( | s16 | x,
|  | s16 | y |
| ) |  |  |

Invert the colour of the pixel at the specified co-ordinates.

Parameters:

  | x | The x co-ordinate of the pixel.
  | y | The y co-ordinate of the pixel.

void GraphicsPort::drawXORRect | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height |
| ) |  |  |

Invert the colour of an unfilled rectangle of pixels.

Parameters:

  | 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 GraphicsPort::drawXORVertLine | ( | s16 | x,
|  | s16 | y,
|  | s16 | height |
| ) |  |  |

Invert the colour of a vertical line of pixels.

Parameters:

  | 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.

Returns:
  The x co-ordinate of the graphics port.

const s16 WoopsiUI::GraphicsPort::getY | ( |  | ) | const`[inline]`

Return the y co-ordinate of the graphics port.

Returns:
  The y co-ordinate of the graphics port.

void GraphicsPort::scroll | ( | s16 | x,
|  | s16 | y,
|  | s16 | xDistance,
|  | s16 | yDistance,
|  | u16 | width,
|  | u16 | height,
|  | WoopsiArray< Gadget::Rect > * | revealedRects |
| ) |  |  |

Scroll a region by a specified distance in two dimensions. Performs a clipped copy to achieve scroll effect.

Parameters:

  | 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.

The documentation for this class was generated from the following files:

- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/graphicsport.h
- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/graphicsport.cpp

All Classes Functions Variables Enumerations Enumerator