#include <BImage.h>
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. | |
|
|
|
|
|
Construct an image from an XPM-encoded data string. See the XPM data format for details. |
|
||||||||||||||||
|
Construct an image of the given size. This will allocate as much data as needed. |
|
||||||||||||||||||||||||
|
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. |
|
|
|
|
|
|
|
||||||||||||
|
Blit the data onto the given point. If format is not FMT_RGB15, this does nothing currently. |
|
|
Return the image storage.
|
|
|
Return the image storage.
|
|
||||||||||||||||
|
Draw a line between the given points (not anti-aliased).
|
|
||||||||||||||||
|
Draw a pixel at the given point.
|
|
||||||||||||
|
Draw a pixel at the given point.
|
|
||||||||||||
|
Draw a rectangle outline.
|
|
||||||||||||||||||||||||||||
|
Draw a section of text.
|
|
|
Fill the (RGB15) image with the given color.
|
|
|
Return the image's format.
|
|
|
Return the image's height.
|
|
|
|
|
|
Return the image's width.
|
1.3-rc3