Woopsi 1.3
Nintendo DS Gui Framework
Public Member Functions | Protected Member Functions | Protected Attributes
WoopsiUI::Bitmap Class Reference

#include <libwoopsi/include/bitmap.h>

Inheritance diagram for WoopsiUI::Bitmap:
WoopsiUI::MutableBitmapBase WoopsiUI::BitmapBase

List of all members.

Public Member Functions

 Bitmap (u16 width, u16 height)
 Bitmap (const BitmapBase &bitmap)
virtual ~Bitmap ()
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
GraphicsnewGraphics ()
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
const u16 getWidth () const
const u16 getHeight () const
void setDimensions (u16 width, u16 height)

Protected Member Functions

u16 *_bitmap __attribute__ ((aligned(4)))

Protected Attributes

u16 _width
u16 _height

Detailed Description

Class providing bitmap manipulation (drawing, etc) functions. Creates a new internal bitmap data array and uses it to draw onto.


Constructor & Destructor Documentation

WoopsiUI::Bitmap::Bitmap ( u16  width,
u16  height 
)

Constructor.

Parameters:
widthThe width of the bitmap.
heightThe height of the bitmap.
WoopsiUI::Bitmap::Bitmap ( const BitmapBase bitmap)

Copy constructor. Creates an exact copy of the supplied bitmap.

Parameters:
bitmapThe bitmap top copy.
virtual WoopsiUI::Bitmap::~Bitmap ( ) [inline, virtual]

Destructor.


Member Function Documentation

u16* _bitmap WoopsiUI::Bitmap::__attribute__ ( (aligned(4))  ) [protected]
void WoopsiUI::Bitmap::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.

Parameters:
xThe x co-ordinate to blit to.
yThe y co-ordinate to blit to.
dataThe data to blit.
sizeThe number of u16s to blit.

Implements WoopsiUI::MutableBitmapBase.

void WoopsiUI::Bitmap::blitFill ( const s16  x,
const s16  y,
const u16  colour,
const u32  size 
) [virtual]

Fill at the specified co-ordinates using the DMA hardware.

Parameters:
xThe x co-ordinate to blit to.
yThe y co-ordinate to blit to.
colourThe colour to fill with.
sizeThe number of u16s to blit.

Implements WoopsiUI::MutableBitmapBase.

void WoopsiUI::Bitmap::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.

Parameters:
xThe x co-ordinate to copy from.
yThe y co-ordinate to copy from.
sizeThe number of pixels to copy.
destPointer to the memory that will be copied into.

Implements WoopsiUI::BitmapBase.

const u16* WoopsiUI::Bitmap::getData ( s16  x,
s16  y 
) const [virtual]

Get a pointer to the internal bitmap data at the specified co-ordinates.

Parameters:
xThe x co-ord of the data.
yThe y co-ord of the data.
Returns:
Pointer to the internal bitmap data.

Implements WoopsiUI::BitmapBase.

const u16* WoopsiUI::Bitmap::getData ( ) const [inline, virtual]

Get a pointer to the internal bitmap.

Returns:
Pointer to the internal bitmap.

Implements WoopsiUI::BitmapBase.

const u16 WoopsiUI::Bitmap::getHeight ( ) const [inline, virtual]

Get the bitmap's height.

Returns:
The bitmap's height.

Implements WoopsiUI::BitmapBase.

const u16 WoopsiUI::Bitmap::getPixel ( s16  x,
s16  y 
) const [virtual]

Get the colour of the pixel at the specified co-ordinates

Parameters:
xThe x co-ordinate of the pixel.
yThe y co-ordinate of the pixel.
Returns:
The colour of the pixel.

Implements WoopsiUI::BitmapBase.

const u16 WoopsiUI::Bitmap::getWidth ( ) const [inline, virtual]

Get the bitmap's width.

Returns:
The bitmap's width.

Implements WoopsiUI::BitmapBase.

Graphics* WoopsiUI::Bitmap::newGraphics ( )

Get a new graphics object that can draw to this bitmap. Object must be deleted when it is no longer needed.

Returns:
A new Graphics object.
void WoopsiUI::Bitmap::setDimensions ( u16  width,
u16  height 
)

Resizes the bitmap. Preserves the existing data whilst resizing, except for any data that gets cropped out if the new dimensions are smaller than the old. The data is always aligned to the top-left of the new bitmap.

Parameters:
widthThe new width for the bitmap.
heightThe new height for the bitmap.
void WoopsiUI::Bitmap::setPixel ( const s16  x,
const s16  y,
const u16  colour 
) [virtual]

Set the colour of the specified pixel.

Parameters:
xX co-ord of the pixel to set.
yY co-ord of the pixel to set.
colourNew colour of the pixel.

Implements WoopsiUI::MutableBitmapBase.


Member Data Documentation

u16 WoopsiUI::Bitmap::_height [protected]

Height of the bitmap.

u16 WoopsiUI::Bitmap::_width [protected]

Width of the bitmap.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Enumerations Enumerator