WoopsiGfx 1.4
Nintendo DS 2D Graphics Library
|
#include <libwoopsigfx/include/bufferedbitmap.h>
Public Member Functions | |
BufferedBitmap (u16 width, u16 height) | |
virtual | ~BufferedBitmap () |
const u16 | getPixel (s16 x, s16 y) const |
void | setPixel (const s16 x, const s16 y, const u16 colour) |
const u16 * | getData () const |
const u16 * | getData (s16 x, s16 y) const |
Graphics * | newGraphics () |
void | blit (const s16 x, const s16 y, const u16 *data, const u32 size) |
void | blitFill (const s16 x, const s16 y, const u16 colour, const u32 size) |
void | copy (s16 x, s16 y, u32 size, u16 *dest) const |
void | buffer () |
void | unbuffer () |
const u16 | getWidth () const |
const u16 | getHeight () const |
Protected Member Functions | |
u16 *_bitmap | __attribute__ ((aligned(4))) |
u16 *_buffer | __attribute__ ((aligned(4))) |
BufferedBitmap (const BufferedBitmap &bitmap) | |
Protected Attributes | |
u16 | _width |
u16 | _height |
Class providing a bitmap that can be drawn to. Creates two new internal bitmap data arrays, one of which represents the bitmap, and one of which is a buffered copy of the bitmap. Calling buffer() before drawing to the bitmap allows unbuffer() to be called later to restore the original state of the bitmap.
The most obvious use for this is if animated drawing is being done to a picture (for example, a box is being moved across a background image) and the picture must be restored to its original state before the next animated frame is drawn.
BufferedBitmap::BufferedBitmap | ( | u16 | width, |
u16 | height | ||
) |
Constructor.
width | The width of the bitmap. |
height | The height of the bitmap. |
virtual WoopsiGfx::BufferedBitmap::~BufferedBitmap | ( | ) | [inline, virtual] |
Destructor.
WoopsiGfx::BufferedBitmap::BufferedBitmap | ( | const BufferedBitmap & | bitmap | ) | [inline, protected] |
Copy constructor is protected to prevent usage.
u16* _bitmap WoopsiGfx::BufferedBitmap::__attribute__ | ( | (aligned(4)) | ) | [protected] |
u16* _buffer WoopsiGfx::BufferedBitmap::__attribute__ | ( | (aligned(4)) | ) | [protected] |
Buffer
void BufferedBitmap::blit | ( | const s16 | x, |
const s16 | y, | ||
const u16 * | data, | ||
const u32 | size | ||
) | [virtual] |
Blit data to the specified co-ordinates using the DMA hardware.
x | The x co-ordinate to blit to. |
y | The y co-ordinate to blit to. |
data | The data to blit. |
size | The number of u16s to blit. |
Implements WoopsiGfx::MutableBitmapBase.
void BufferedBitmap::blitFill | ( | const s16 | x, |
const s16 | y, | ||
const u16 | colour, | ||
const u32 | size | ||
) | [virtual] |
Fill at the specified co-ordinates using the DMA hardware.
x | The x co-ordinate to blit to. |
y | The y co-ordinate to blit to. |
colour | The colour to fill with. |
size | The number of u16s to blit. |
Implements WoopsiGfx::MutableBitmapBase.
void BufferedBitmap::buffer | ( | ) |
Create an internal copy of the bitmap's current state that can be restored later with unbuffer().
void BufferedBitmap::copy | ( | s16 | x, |
s16 | y, | ||
u32 | size, | ||
u16 * | dest | ||
) | const [virtual] |
Copies data from the supplied co-ordinates sequentially into dest. If the amount to be copied exceeds the available width of the bitmap, copying will wrap around from the right-hand edge of the bitmap to the left-hand edge. The dest parameter must point to an area of memory large enough to contain the copied data.
x | The x co-ordinate to copy from. |
y | The y co-ordinate to copy from. |
size | The number of pixels to copy. |
dest | Pointer to the memory that will be copied into. |
Implements WoopsiGfx::BitmapBase.
const u16 * BufferedBitmap::getData | ( | s16 | x, |
s16 | y | ||
) | const [virtual] |
Get a pointer to the internal bitmap data at the specified co-ordinates.
x | The x co-ord of the data. |
y | The y co-ord of the data. |
Implements WoopsiGfx::BitmapBase.
const u16* WoopsiGfx::BufferedBitmap::getData | ( | ) | const [inline, virtual] |
Get a pointer to the internal bitmap.
Implements WoopsiGfx::BitmapBase.
const u16 WoopsiGfx::BufferedBitmap::getHeight | ( | ) | const [inline, virtual] |
const u16 BufferedBitmap::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. |
Implements WoopsiGfx::BitmapBase.
const u16 WoopsiGfx::BufferedBitmap::getWidth | ( | ) | const [inline, virtual] |
Graphics * BufferedBitmap::newGraphics | ( | ) |
Get a new graphics object that can draw to this bitmap. Object must be deleted when it is no longer needed.
void BufferedBitmap::setPixel | ( | const s16 | x, |
const s16 | y, | ||
const u16 | colour | ||
) | [virtual] |
Set the colour of the specified pixel.
x | X co-ord of the pixel to set. |
y | Y co-ord of the pixel to set. |
colour | New colour of the pixel. |
Implements WoopsiGfx::MutableBitmapBase.
void BufferedBitmap::unbuffer | ( | ) |
Restores previously stored state of the bitmap created with the buffer() method.
u16 WoopsiGfx::BufferedBitmap::_height [protected] |
Height of the bitmap
u16 WoopsiGfx::BufferedBitmap::_width [protected] |
Width of the bitmap