Gosu
|
A two-dimensional array area of pixels, each represented by a Color value. More...
Public Member Functions | |
Bitmap ()=default | |
Bitmap (int width, int height, Color c=Color::NONE) | |
int | width () const |
int | height () const |
void | swap (Bitmap &other) |
void | resize (int width, int height, Color c=Color::NONE) |
Color | get_pixel (int x, int y) const |
Returns the color at the specified position without any bounds checking. More... | |
void | set_pixel (int x, int y, Color c) |
Sets the pixel at the specified position without any bounds checking. More... | |
void | blend_pixel (int x, int y, Color c) |
This updates a pixel using the "over" alpha compositing operator, see: https://en.wikipedia.org/wiki/Alpha_compositing. More... | |
void | insert (int x, int y, const Bitmap &source) |
Inserts a bitmap at the given position. More... | |
void | insert (int x, int y, const Bitmap &source, int src_x, int src_y, int src_width, int src_height) |
Inserts a portion of a bitmap at the given position. More... | |
const Color * | data () const |
Direct access to the array of color values. More... | |
Color * | data () |
Direct access to the array of color values. More... | |
A two-dimensional array area of pixels, each represented by a Color value.
Bitmaps are typically created only as an intermediate step between loading image files, and creating Gosu::Image objects from them (i.e. transferring the image into video RAM). Has (expensive) value semantics.
Definition at line 14 of file Bitmap.hpp.
|
default |
Gosu::Bitmap::Bitmap | ( | int | width, |
int | height, | ||
Color | c = Color::NONE |
||
) |
void Gosu::Bitmap::blend_pixel | ( | int | x, |
int | y, | ||
Color | c | ||
) |
This updates a pixel using the "over" alpha compositing operator, see: https://en.wikipedia.org/wiki/Alpha_compositing.
Referenced by set_pixel().
const Color* Gosu::Bitmap::data | ( | ) | const |
Direct access to the array of color values.
The return value is undefined if this bitmap is empty.
Definition at line 65 of file Bitmap.hpp.
Color* Gosu::Bitmap::data | ( | ) |
Direct access to the array of color values.
The return value is undefined if this bitmap is empty.
Definition at line 72 of file Bitmap.hpp.
References Gosu::apply_border_flags(), Gosu::apply_color_key(), Gosu::load_image_file(), and Gosu::save_image_file().
Color Gosu::Bitmap::get_pixel | ( | int | x, |
int | y | ||
) | const |
Returns the color at the specified position without any bounds checking.
Definition at line 39 of file Bitmap.hpp.
int Gosu::Bitmap::height | ( | ) | const |
Definition at line 29 of file Bitmap.hpp.
References Gosu::Color::NONE, resize(), and swap().
void Gosu::Bitmap::insert | ( | int | x, |
int | y, | ||
const Bitmap & | source | ||
) |
Inserts a bitmap at the given position.
Parts of the inserted bitmap that would be outside of the target bitmap will be clipped away.
Referenced by set_pixel().
void Gosu::Bitmap::insert | ( | int | x, |
int | y, | ||
const Bitmap & | source, | ||
int | src_x, | ||
int | src_y, | ||
int | src_width, | ||
int | src_height | ||
) |
Inserts a portion of a bitmap at the given position.
Parts of the inserted bitmap that would be outside of the target bitmap will be clipped away.
void Gosu::Bitmap::resize | ( | int | width, |
int | height, | ||
Color | c = Color::NONE |
||
) |
Referenced by height().
void Gosu::Bitmap::set_pixel | ( | int | x, |
int | y, | ||
Color | c | ||
) |
Sets the pixel at the specified position without any bounds checking.
Definition at line 45 of file Bitmap.hpp.
References blend_pixel(), and insert().
int Gosu::Bitmap::width | ( | ) | const |
Definition at line 24 of file Bitmap.hpp.