#include <cascade/graphics/CascadeBitmap.h>
Inheritance diagram for CascadeBitmap:
Public Types | |
enum | RamType { kVRAMOnly = 0, kMainRAMOnly = 1, kEither = 2 } |
Public Member Functions | |
CascadeBitmap () | |
virtual | ~CascadeBitmap () |
virtual bool | Create (const CascadeDims &dims, RamType ramType=kEither) |
virtual bool | CreateFromBitmapFile (CascadeFile &bitmapFile, RamType ramType=kEither) |
virtual bool | Destroy () |
CascadeRect | GetClipRect () const |
void | SetClipRect (const CascadeRect &rect) |
virtual void | FrameRect (const CascadeRect &rect, const CascadeColor &color) |
virtual void | FillRect (const CascadeRect &rect, const CascadeColor &color) |
virtual void | DrawLine (const CascadePoint &start, const CascadePoint &end, const CascadeColor &color) |
virtual void | TextOut (const CascadePoint &point, const CascadeString &string, const CascadeFont &font, const CascadeColor &color, u32 nFlags=TEXTOUT_TOP) |
virtual bool | DrawText (CascadeFont &font, const CascadeRect &rect, const CascadeString &string, const CascadeColor &color, u32 nFlags) |
virtual void | Blit (const CascadePoint &point, const CascadeBitmap &source, const CascadeRect &sourceRect) |
virtual void | Blit (const CascadePoint &point, CascadeSharedMemZone &sourceZone, u32 nZoneOffset, u32 nPixelWidth, u32 nPixelHeight, u32 nBitDepth, const CascadeRect &sourceRect) |
virtual bool | GrabBits (const CascadeRect &sourceRect, CascadeSharedMemZone &destZone, u32 nZoneOffset) |
virtual void | GetPixel (const CascadePoint &point, CascadeColor &colorToSet) const |
virtual void | SetPixel (const CascadePoint &point, const CascadeColor &color) |
virtual CascadeDims | GetDims () const |
CascadeRect | GetRect () const |
virtual u8 | GetColorDepth () const |
virtual void * | GetMemory () |
virtual void | Flush () |
Protected Attributes | |
CascadeRect | m_clipRect |
Friends | |
class | CascadeScreen |
CascadeBitmap is the base class of drawable objects in Cascade. Clients draw directly onto CascadeBitmaps or their subclasses. The base class of CascadeBitmap implements in-memory bitmaps. These in-memory bitmaps are always created in the color format of the display. While non-traditional, this greatly simplifies both the interface and implementation and provides the functionality needed for the UI in the highest performance possible way while maximizing the ability to meet the schedule. Future versions of the Cascade library will likely support managing multiple formats of in-memory bitmap data, blitting between them etc. For now, clients need not worry about pixel format translation - the implementation handles and hides the actual pixel format from the client.
All drawing functions clip to the bitmap.
|
represents a type of RAM used for bitmap creation RamType is used as an argument to the Create() functions.
|
|
The CascadeBitmap constructor - lightweight. This base class constructor is lightweight. |
|
Destructor. This destructor will automatically Destroy() the bitmap if it has been Created(). |
|
copies bits from a shared memory zone to the bitmap This version of Blit() operates on a source bitmap that is contained in a CascadeSharedMemZone and defined by the following parameters:
Reimplemented in CascadeScreen. |
|
copies bits from bitmap to bitmap Blit does a simple SRCCOPY bit block transfer from the sourceRect on the bitmap described by source to the destination point.
Reimplemented in CascadeScreen. |
|
creates a bitmap Create() creates an in memory bitmap using the same color depth and format as the screen returning true if successful, false otherwise. The bitmap bits are left uninitialized. Create() returns true if successful, false otherwise. The ramType parameter allows you to specify what type of memory should be used for bitmap creation.
|
|
creates a bitmap from a file CreateFromBitmapFile() creates an in memory bitmap using the dimensions of the bitmap located in bitmapFile. The bitmap is created using the same color depth and format as the screen and is initialized with the bitmap data from bitmapFile. CreateFromBitmapFile() automatically converts the file data format into the CascadeBitmap in memory data format. Currently only JPEG image loading is supported. CreateFromBitmapFile() returns true if successful, false otherwise. The ramType parameter allows you to specify what type of memory should be used for bitmap creation.
|
|
destroys a previously created bitmap call Destroy() to destroy a previously created bitmap. Destroy() returns true if destruction was successful or not needed, false if destruction failed (leaving the bitmap in a created state).
Reimplemented in CascadeScreen. |
|
draws a 1 pixel line DrawLine() draws a 1 pixel width line from start to end in the color color
Reimplemented in CascadeScreen. |
|
formats and draws a text string on the bitmap DrawText() is a text rendering primitive that allows the client to specify alignment, clipping, and wrapping of the text string. The output text is positioned relative to rectangle rect. The following flags are supported: TEXT_CENTER_VERTICALLY TEXT_CENTER_HORIZONTALLY TEXT_JUSTIFY_LEFT TEXT_JUSTIFY_TOP TEXT_JUSTIFY_BOTTOM TEXT_JUSTIFY_RIGHT TEXT_WORD_WRAP TEXT_CLIP TEXT_CLIP_WITH_DOTDOTDOT TEXT_MEASURE_ONLY
Reimplemented in CascadeScreen. |
|
fills a rectangle with a color FillRect() fills the rectangle described by rect with the color color
Reimplemented in CascadeScreen. |
|
flushes the pipeline of graphics drawing calls Flush() flushes the pipeline of graphics calls. It should only be needed in certain circumstances when writing to graphics memory directly.
Reimplemented in CascadeScreen. |
|
draws a 1 pixel wide rectangle frame FrameRect() draws the 1-pixel outline of the rectangle described by rect with the color color
Reimplemented in CascadeScreen. |
|
gets the clipping rect for the bitmap CascadeBitmaps support a clipping rectangle. In Create() the clipping rectangle is initialized to the size of the entire bitmap. call GetClipRect() to get the current clipping rectangle of the bitmap. Note that in Cascade v. 1.0 clipping is not implemented, however the Cascade Windowing system uses the clipping rectangle of the screen so that it can optimize screen drawing.
|
|
gets the color depth of the bitmap in bits-per-pixel GetColorDepth() returns the color depth of the bitmap in bits per pixel.
Reimplemented in CascadeScreen. |
|
gets the dimensions of the bitmap GetDims() returns the dimensions of the bitmap.
Reimplemented in CascadeScreen. |
|
returns a pointer to the bitmap's memory GetMemory() is currently not implemented and always returns NULL. It will be implemented in the future.
Reimplemented in CascadeScreen. |
|
gets the color of a pixel located at a specific point GetPixel() sets colorToSet with the color value of the pixel located at point.
Reimplemented in CascadeScreen. |
|
returns the rectangle dimensions the bitmap GetRect() returns a rectangle the width and height of the bitmap located at (x = 0, y = 0).
|
|
copies bits from the bitmap to a shared memory zone GrabBits() copies bits from the sourceRect of this bitmap to the shared memory zone identified by destZone using the following parameters. If GrabBits() returns true, sourceRect.w * sourceRect.h 32bit RGBA words were copied to destZone starting at nZoneOffset.
Reimplemented in CascadeScreen. |
|
sets the clipping rect for the bitmap Call SetClipRect() to set the current clipping rectangle of the bitmap. All drawing will be clipped to this rectangle (though this is not implemented in Cascade v. 1.0). NOTE: good programming practices dicate that if you set the clip rect you should restore it to what it was before you set it when you are done with whatever you are doing. The rect passed in to SetClipRect will be normalized to the bounding rectangle of the bitmap. If the rect falls outside of the bitmap rectangle, The clip rect will be set to (0, 0, 0, 0).
|
|
sets the color for a pixel located at a specific point SetPixel() sets the pixel located at point with the color value of color.
Reimplemented in CascadeScreen. |
|
draws a text string on the bitmap TextOut() is a simple text output function that outputs the string string in the font font in the color color at the location point. Reimplemented in CascadeScreen. |
|
|
|
|