#include <bitmap.h>
Inheritance diagram for Bitmap:
A bitmap can be resized, converted, copied, painted on, etc. Ultimately it will usually be passed to blit()
.
Public Types | |
enum | ColorSpace { CS_RGB, CS_RGBA, CS_BGR, CS_ABGR, CS_YV12, CS_YV12A } |
All known color spaces. | |
Public Member Functions | |
Bitmap (int width=0, int height=0) | |
Constructor; width and height can be optionally specified. | |
int | w () const |
Returns width. | |
int | h () const |
Returns height. | |
int | get_space () const |
Returns the number of bytes in the buffer returned by get_buf() . | |
int | get_space (int width, int height) const |
Returns how many bytes the image would take up if it were width x height pixels. | |
unsigned char * | get_buf () const |
Returns the internal buffer of the image, the actual pixels. | |
virtual Bitmap * | create () const=0 |
"Virtual constructor". | |
virtual Bitmap * | clone () const |
"virtual copy constructor". | |
virtual void | set_size (int width, int height) |
Resizes the buffer. | |
virtual void | clear () |
Sets all bytes in the buffer to zero. | |
virtual enum ColorSpace | get_color_space () const=0 |
Used for identifying the type of a Bitmap at runtime. | |
virtual void | convert (Bitmap &target) const |
Convert to a different color space, if possible. | |
virtual Bitmap * | unify_csp (Bitmap &bitmap) const |
Convert bitmap to the same color space as this , or fail with an exception. | |
void | resize (int left=0, int right=0, int top=0, int bottom=0) |
Crops or expands the bitmap. | |
Bitmap * | resize_copy (int left=0, int right=0, int top=0, int bottom=0) const |
Works like Bitmap::resize, except that it doesn't modify the bitmap, it resizes into a copy that it returns. | |
virtual void | blend (const Bitmap &source, int xoff=0, int yoff=0, int alpha=0) |
Alpha blends source onto this . | |
virtual void | put (const Bitmap &source, int xoff=0, int yoff=0) |
Identical to blend , except that target pixels in this will be overwritten completely. | |
Protected Member Functions | |
void | alloc (int width, int height) |
virtual void | resize_into (int left, int right, int top, int bottom, Bitmap *target) const=0 |
virtual int | channel_count () const |
virtual int | get_pixel_alpha (int pixel) const=0 |
virtual void | set_pixel_alpha (int pixel, int value)=0 |
virtual int | get_pixel_val (int pixel, int channel) const=0 |
virtual void | set_pixel_val (int pixel, int channel, int value)=0 |
Protected Attributes | |
int | _bpp |
|
Alpha blends
The
This Reimplemented in RGBA. |
|
"virtual copy constructor".
Returns a copy of |
|
Convert to a different color space, if possible.
The |
|
"Virtual constructor".
Returns an empty bitmap of the same derived class as |
|
Returns the internal buffer of the image, the actual pixels.
The size of this buffer can be found with |
|
Identical to
Has better performance than
This Reimplemented in RGBA. |
|
Crops or expands the bitmap. A positive value for one of the directions will expand the image by adding black transparent pixels. A negative value will crop it. |
|
Works like Bitmap::resize, except that it doesn't modify the bitmap, it resizes into a copy that it returns.
|
|
Resizes the buffer. The contents of the buffer will be preserved if scaling up, but the width/height will no longer be correct. Usually used when discarding the buffer contents anyway. |
|
Convert May return the same object it was given if the color spaces already match. |