Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members

Canvas Class Reference

List of all members.

Detailed Description

Canvas represents a drawing area.


An instance of Canvas has properties, such as width and height, and a few basic drawing operations.
It can save/restore parts of itself.
It may provide access to its screen memory, to enable drawing through direct memory manipulations.

Definition at line 100 of file Canvas.h.

Public Types

enum  CoordSystem { COORDS_STANDARD = 1, COORDS_NATIVE = 2 }

Public Member Functions

Construction / Destruction
 Canvas (Coord width, Coord height, CoordSystem coordSystem) SEC_RAZOR_INIT
 Construct a new Canvas.

virtual ~Canvas () SEC_RAZOR_INIT
 Destroy the Canvas.

Coordinate systems
virtual void setCoordSystem (CoordSystem coordSystem) SEC_RAZOR_INIT
Draw operations
const BitmapArrayprepareTransparentBitmaps (UInt16 numBitmaps, DmResID bitmapID, DmResID maskID) const SEC_RAZOR_INIT
const BitmapArrayprepareTransparentBitmap (DmResID bitmapID, DmResID maskID) const SEC_RAZOR_INIT
const BitmapArrayprepareSolidBitmaps (UInt16 numBitmaps, DmResID bitmapID) const SEC_RAZOR_INIT
const BitmapArrayprepareSolidBitmap (DmResID bitmapID) const SEC_RAZOR_INIT
void drawBitmap (UInt16 index, const BitmapArray *bitmapArray, Coord x, Coord y) const SEC_RAZOR
 Draw the indexth bitmap from an array of bitmaps.

void drawBitmap (const BitmapArray *bitmapArray, Coord x, Coord y) const SEC_RAZOR
 Draw the first bitmap (index=0) from an array of bitmaps.

void drawText (Color textColor, Color bgColor, FontID font, const Char *chars, Int16 len, Coord x, Coord y) const SEC_RAZOR
 Draw a text string.

void fillRectangle (Color color, Coord topX, Coord topY, Coord bottomX, Coord bottomY) const SEC_RAZOR
void drawPolygon (const xy *e, int edgeCount, const Color color) const SEC_RAZOR
Save/Restore Area operations
SaveBufferArrayprepareSaveBuffers (UInt16 numBuffers, Coord width, Coord height) const SEC_RAZOR_INIT
void saveBitmap (UInt16 index, SaveBufferArray *bufferArray, Coord x, Coord y) const SEC_RAZOR
void restoreBitmap (UInt16 index, SaveBufferArray *bufferArray) const SEC_RAZOR
OS interaction
virtual void setOSCanvas () const=0
 Use this Canvas as the default canvas for OS drawing operations.

virtual Boolean setForegroundColor (const Color color) const=0
 Make the underlying OS use the color as foreground color.

virtual Boolean setBackgroundColor (const Color color) const=0
 Make the underlying OS use the color as background color.


Public Attributes

Coord width
Coord height
Coord rows
Coord cols
Int8 shiftFactor
CoordSystem coordSystem
WinHandle drawWindow
 The handle to the Canvas' window.

BitmapType * _drawBitmap
 The pointer to the Canvas' bitmap.

void * drawBits
 The pointer to the Canvas' bitmap bits.

UInt16 rowBytes
 The number of bytes in a row of the Canvas.


Protected Attributes

Blitter * blitter
 Blitter that can be used to draw to the Canvas.


Member Enumeration Documentation

enum Canvas::CoordSystem
 

Enumeration values:
COORDS_STANDARD 
COORDS_NATIVE 

Definition at line 104 of file Canvas.h.


Constructor & Destructor Documentation

Canvas::Canvas Coord    width,
Coord    height,
CoordSystem    coordSystem
 

Construct a new Canvas.

virtual Canvas::~Canvas   [virtual]
 

Destroy the Canvas.


Member Function Documentation

virtual void Canvas::setCoordSystem CoordSystem    coordSystem [virtual]
 

const BitmapArray* Canvas::prepareTransparentBitmaps UInt16    numBitmaps,
DmResID    bitmapID,
DmResID    maskID
const
 

const BitmapArray* Canvas::prepareTransparentBitmap DmResID    bitmapID,
DmResID    maskID
const
 

const BitmapArray* Canvas::prepareSolidBitmaps UInt16    numBitmaps,
DmResID    bitmapID
const
 

const BitmapArray* Canvas::prepareSolidBitmap DmResID    bitmapID const
 

void Canvas::drawBitmap UInt16    index,
const BitmapArray   bitmapArray,
Coord    x,
Coord    y
const
 

Draw the indexth bitmap from an array of bitmaps.

Parameters:
index the index into the array of bitmaps. Must be 0..elements-1
bitmapArray the array of bitmaps. Must have at least index+1 elements
x the logical x coordinate
y the logical y coordinate

void Canvas::drawBitmap const BitmapArray   bitmapArray,
Coord    x,
Coord    y
const
 

Draw the first bitmap (index=0) from an array of bitmaps.

Parameters:
bitmapArray the array of bitmaps. Must have at least 1 element
x the logical x coordinate
y the logical y coordinate

void Canvas::drawText Color    textColor,
Color    bgColor,
FontID    font,
const Char *    chars,
Int16    len,
Coord    x,
Coord    y
const
 

Draw a text string.

Parameters:
textColor the color of the text
bgColor the color of the background
font the font (TODO: Which ones are supported on all devices)
chars the text
len the length of the text (TODO: Why is this signed int?)
x the logical x coordinate of the topleft corner of the first character
y the logical y coordinate of the topleft corner of the first character

void Canvas::fillRectangle Color    color,
Coord    topX,
Coord    topY,
Coord    bottomX,
Coord    bottomY
const
 

void Canvas::drawPolygon const xy   e,
int    edgeCount,
const Color    color
const
 

SaveBufferArray* Canvas::prepareSaveBuffers UInt16    numBuffers,
Coord    width,
Coord    height
const
 

void Canvas::saveBitmap UInt16    index,
SaveBufferArray   bufferArray,
Coord    x,
Coord    y
const
 

void Canvas::restoreBitmap UInt16    index,
SaveBufferArray   bufferArray
const
 

virtual void Canvas::setOSCanvas   const [pure virtual]
 

Use this Canvas as the default canvas for OS drawing operations.

virtual Boolean Canvas::setForegroundColor const Color    color const [pure virtual]
 

Make the underlying OS use the color as foreground color.

Returns a special indicator for 1bpp devices.

Returns:
true = color is dark, false = color is light.

virtual Boolean Canvas::setBackgroundColor const Color    color const [pure virtual]
 

Make the underlying OS use the color as background color.

Returns a special indicator for 1bpp devices.

Returns:
true = color is dark, false = color is light.


Member Data Documentation

Coord Canvas::width
 

Definition at line 201 of file Canvas.h.

Coord Canvas::height
 

Definition at line 202 of file Canvas.h.

Coord Canvas::rows
 

Definition at line 203 of file Canvas.h.

Coord Canvas::cols
 

Definition at line 204 of file Canvas.h.

Int8 Canvas::shiftFactor
 

Definition at line 206 of file Canvas.h.

CoordSystem Canvas::coordSystem
 

Definition at line 207 of file Canvas.h.

WinHandle Canvas::drawWindow
 

The handle to the Canvas' window.

Definition at line 213 of file Canvas.h.

BitmapType* Canvas::_drawBitmap
 

The pointer to the Canvas' bitmap.

Definition at line 218 of file Canvas.h.

void* Canvas::drawBits
 

The pointer to the Canvas' bitmap bits.

Definition at line 223 of file Canvas.h.

UInt16 Canvas::rowBytes
 

The number of bytes in a row of the Canvas.

Definition at line 228 of file Canvas.h.

Blitter* Canvas::blitter [protected]
 

Blitter that can be used to draw to the Canvas.

Definition at line 235 of file Canvas.h.


The documentation for this class was generated from the following file:
Razor! Engine Developer's Guide. Copyright © by Tilo Christ. All Rights Reserved. Last updated: 31 May 2003