Gosu
|
Provides functionality for drawing rectangular images. More...
Public Member Functions | |
Image () | |
Creates an empty image. It will have a width and height of 0, and not contain anything. More... | |
Image (const std::string &filename, unsigned image_flags=IF_SMOOTH) | |
Loads an image from a given filename. More... | |
Image (const std::string &filename, int src_x, int src_y, int src_width, int src_height, unsigned image_flags=IF_SMOOTH) | |
Loads a portion of the the image at the given filename. More... | |
Image (const Bitmap &source, unsigned image_flags=IF_SMOOTH) | |
Converts the given bitmap into an image. More... | |
Image (const Bitmap &source, int src_x, int src_y, int src_width, int src_height, unsigned image_flags=IF_SMOOTH) | |
Converts a portion of the given bitmap into an image. More... | |
Image (std::unique_ptr< ImageData > &&data) | |
Creates an Image from a user-supplied instance of the ImageData interface. More... | |
unsigned | width () const |
unsigned | height () const |
void | draw (double x, double y, ZPos z=0, double scale_x=1, double scale_y=1, Color c=Color::WHITE, AlphaMode mode=AM_DEFAULT) const |
Draws the image so its upper left corner is at (x; y). More... | |
void | draw_mod (double x, double y, ZPos z, double scale_x, double scale_y, Color c1, Color c2, Color c3, Color c4, AlphaMode mode=AM_DEFAULT) const |
Like draw(), but with modulation colors for all four corners. More... | |
void | draw_rot (double x, double y, ZPos z=0, double angle=0, double center_x=0.5, double center_y=0.5, double scale_x=1, double scale_y=1, Color c=Color::WHITE, AlphaMode mode=AM_DEFAULT) const |
Draws the image rotated by the given angle so that its rotation center is at (x; y). More... | |
ImageData & | data () const |
Provides access to the underlying image data object. More... | |
Gosu::Image::Image | ( | ) |
Creates an empty image. It will have a width and height of 0, and not contain anything.
|
explicit |
Loads an image from a given filename.
A color key of #ff00ff is automatically applied to BMP image files. For more flexibility, use the corresponding constructor that uses a Bitmap object.
Gosu::Image::Image | ( | const std::string & | filename, |
int | src_x, | ||
int | src_y, | ||
int | src_width, | ||
int | src_height, | ||
unsigned | image_flags = IF_SMOOTH |
||
) |
Loads a portion of the the image at the given filename.
A color key of #ff00ff is automatically applied to BMP image files. For more flexibility, use the corresponding constructor that uses a Bitmap object.
Converts the given bitmap into an image.
Gosu::Image::Image | ( | const Bitmap & | source, |
int | src_x, | ||
int | src_y, | ||
int | src_width, | ||
int | src_height, | ||
unsigned | image_flags = IF_SMOOTH |
||
) |
Converts a portion of the given bitmap into an image.
|
explicit |
ImageData& Gosu::Image::data | ( | ) | const |
Provides access to the underlying image data object.
void Gosu::Image::draw | ( | double | x, |
double | y, | ||
ZPos | z = 0 , |
||
double | scale_x = 1 , |
||
double | scale_y = 1 , |
||
Color | c = Color::WHITE , |
||
AlphaMode | mode = AM_DEFAULT |
||
) | const |
Draws the image so its upper left corner is at (x; y).
void Gosu::Image::draw_mod | ( | double | x, |
double | y, | ||
ZPos | z, | ||
double | scale_x, | ||
double | scale_y, | ||
Color | c1, | ||
Color | c2, | ||
Color | c3, | ||
Color | c4, | ||
AlphaMode | mode = AM_DEFAULT |
||
) | const |
Like draw(), but with modulation colors for all four corners.
void Gosu::Image::draw_rot | ( | double | x, |
double | y, | ||
ZPos | z = 0 , |
||
double | angle = 0 , |
||
double | center_x = 0.5 , |
||
double | center_y = 0.5 , |
||
double | scale_x = 1 , |
||
double | scale_y = 1 , |
||
Color | c = Color::WHITE , |
||
AlphaMode | mode = AM_DEFAULT |
||
) | const |
Draws the image rotated by the given angle so that its rotation center is at (x; y).
Note that this is different from how all the other drawing functions work!
unsigned Gosu::Image::height | ( | ) | const |
unsigned Gosu::Image::width | ( | ) | const |