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

BImage Class Reference

#include <BImage.h>

List of all members.


Detailed Description

Image class.

Images are the final target of all graphics commands. Images can reside on the heap or be references to VRAM banks.

Images are commonly 15bpp RGB images, with bit 15 indicating alpha. For some special purposes (font bitmaps, for example), images can also be 8bpp greyscale.


Public Types

enum  ImageFormat { FMT_RGB15, FMT_GREY5 }

Public Member Functions

 BImage (char **xpmData)
 Construct an image from an XPM-encoded data string.

 BImage (int width, int height, ImageFormat format=FMT_RGB15)
 Construct an image of the given size.

 BImage (int width, int height, uint8 *image, ImageFormat format=FMT_RGB15, bool copy=false)
 Construct an image of the given size from the given data.

 BImage (const BImage &img)
virtual ~BImage ()
void operator= (const BImage &img)
virtual int width () const
 Return the image's width.

virtual int height () const
 Return the image's height.

virtual int format () const
 Return the image's format.

virtual void blit (const BPoint &pt, uint16 *screenStart)
 Blit the data onto the given point.

uint8 * bytes ()
 Return the image storage.

const uint8 * bytes () const
 Return the image storage.

void fill (uint16 color)
 Fill the (RGB15) image with the given color.

Drawing commands
These operate on RGB15 images only, currently. They also do not observe image boundaries, with the exception of drawText(). Use with caution!

void drawPixel (const BPoint &pt, uint16 color)
 Draw a pixel at the given point.

void drawPixel (int x, int y, uint16 color)
 Draw a pixel at the given point.

void drawLine (const BPoint &pt1, const BPoint &pt2, uint16 color)
 Draw a line between the given points (not anti-aliased).

void drawRect (const BRect &rect, uint16 color)
 Draw a rectangle outline.

BPoint drawText (BFont *font, const std::string &text, int cursorPos, const BRect &clip, const BWidget &widget, uint16 color)
 Draw a section of text.


Member Enumeration Documentation

enum BImage::ImageFormat
 

Enumeration values:
FMT_RGB15 
FMT_GREY5 


Constructor & Destructor Documentation

BImage::BImage char **    xpmData
 

Construct an image from an XPM-encoded data string.

See the XPM data format for details.

BImage::BImage int    width,
int    height,
ImageFormat    format = FMT_RGB15
 

Construct an image of the given size.

This will allocate as much data as needed.

BImage::BImage int    width,
int    height,
uint8 *    image,
ImageFormat    format = FMT_RGB15,
bool    copy = false
 

Construct an image of the given size from the given data.

If copy is true, this will allocate enough data (and free the data when the image is deleted). If copy is false, this will reference the given data and not free it. Use, for example, with VRAM banks.

BImage::BImage const BImage &    img
 

virtual BImage::~BImage   [virtual]
 


Member Function Documentation

virtual void BImage::blit const BPoint   pt,
uint16 *    screenStart
[virtual]
 

Blit the data onto the given point.

If format is not FMT_RGB15, this does nothing currently.

const uint8* BImage::bytes   const [inline]
 

Return the image storage.

uint8* BImage::bytes   [inline]
 

Return the image storage.

void BImage::drawLine const BPoint   pt1,
const BPoint   pt2,
uint16    color
 

Draw a line between the given points (not anti-aliased).

void BImage::drawPixel int    x,
int    y,
uint16    color
 

Draw a pixel at the given point.

void BImage::drawPixel const BPoint   pt,
uint16    color
 

Draw a pixel at the given point.

void BImage::drawRect const BRect   rect,
uint16    color
 

Draw a rectangle outline.

BPoint BImage::drawText BFont   font,
const std::string &    text,
int    cursorPos,
const BRect   clip,
const BWidget   widget,
uint16    color
 

Draw a section of text.

void BImage::fill uint16    color
 

Fill the (RGB15) image with the given color.

virtual int BImage::format   const [inline, virtual]
 

Return the image's format.

virtual int BImage::height   const [inline, virtual]
 

Return the image's height.

void BImage::operator= const BImage &    img
 

virtual int BImage::width   const [inline, virtual]
 

Return the image's width.


The documentation for this class was generated from the following file:
Generated on Sat Dec 29 10:00:28 2007 for DSGUI by doxygen1.3-rc3