Provides functionality for drawing rectangular images. More...
Public Member Functions | |
Image (Graphics &graphics, const std::wstring &filename, bool tileable=false) | |
Loads an image from a given filename that can be drawn onto graphics. More... | |
Image (Graphics &graphics, const std::wstring &filename, unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight, bool tileable=false) | |
Loads a portion of the the image at the given filename that can be drawn onto graphics. More... | |
Image (Graphics &graphics, const Bitmap &source, bool tileable=false) | |
Converts the given bitmap into an image that can be drawn onto graphics. More... | |
Image (Graphics &graphics, const Bitmap &source, unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight, bool tileable=false) | |
Converts a portion of the given bitmap into an image that can be drawn onto graphics. More... | |
Image (GOSU_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, double factorX=1, double factorY=1, Color c=Color::WHITE, AlphaMode mode=amDefault) const |
Draws the image so its upper left corner is at (x; y). More... | |
void | drawMod (double x, double y, ZPos z, double factorX, double factorY, Color c1, Color c2, Color c3, Color c4, AlphaMode mode=amDefault) const |
Like draw(), but allows to give modulation colors for all four corners. More... | |
void | drawRot (double x, double y, ZPos z, double angle, double centerX=0.5, double centerY=0.5, double factorX=1, double factorY=1, Color c=Color::WHITE, AlphaMode mode=amDefault) const |
Draws the image rotated by the given angle so that its rotation center is at (x; y). More... | |
ImageData & | getData () const |
Provides access to the underlying image data object. More... | |
Gosu::Image::Image | ( | Graphics & | graphics, |
const std::wstring & | filename, | ||
bool | tileable = false |
||
) |
Loads an image from a given filename that can be drawn onto graphics.
This constructor can handle PNG and BMP images. A color key of #ff00ff is automatically applied to BMP type images. For more flexibility, use the corresponding constructor that uses a Bitmap object.
Gosu::Image::Image | ( | Graphics & | graphics, |
const std::wstring & | filename, | ||
unsigned | srcX, | ||
unsigned | srcY, | ||
unsigned | srcWidth, | ||
unsigned | srcHeight, | ||
bool | tileable = false |
||
) |
Loads a portion of the the image at the given filename that can be drawn onto graphics.
This constructor can handle PNG and BMP images. A color key of #ff00ff is automatically applied to BMP type images. For more flexibility, use the corresponding constructor that uses a Bitmap object.
Converts the given bitmap into an image that can be drawn onto graphics.
Gosu::Image::Image | ( | Graphics & | graphics, |
const Bitmap & | source, | ||
unsigned | srcX, | ||
unsigned | srcY, | ||
unsigned | srcWidth, | ||
unsigned | srcHeight, | ||
bool | tileable = false |
||
) |
Converts a portion of the given bitmap into an image that can be drawn onto graphics.
|
explicit |
void Gosu::Image::draw | ( | double | x, |
double | y, | ||
ZPos | z, | ||
double | factorX = 1 , |
||
double | factorY = 1 , |
||
Color | c = Color::WHITE , |
||
AlphaMode | mode = amDefault |
||
) | const |
Draws the image so its upper left corner is at (x; y).
void Gosu::Image::drawMod | ( | double | x, |
double | y, | ||
ZPos | z, | ||
double | factorX, | ||
double | factorY, | ||
Color | c1, | ||
Color | c2, | ||
Color | c3, | ||
Color | c4, | ||
AlphaMode | mode = amDefault |
||
) | const |
Like draw(), but allows to give modulation colors for all four corners.
void Gosu::Image::drawRot | ( | double | x, |
double | y, | ||
ZPos | z, | ||
double | angle, | ||
double | centerX = 0.5 , |
||
double | centerY = 0.5 , |
||
double | factorX = 1 , |
||
double | factorY = 1 , |
||
Color | c = Color::WHITE , |
||
AlphaMode | mode = amDefault |
||
) | 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!
ImageData& Gosu::Image::getData | ( | ) | const |
Provides access to the underlying image data object.
unsigned Gosu::Image::height | ( | ) | const |
unsigned Gosu::Image::width | ( | ) | const |