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. | |
| 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. | |
| Image (Graphics &graphics, const Bitmap &source, bool tileable=false) | |
| Converts the given bitmap into an image that can be drawn onto graphics. | |
| 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. | |
| Image (std::auto_ptr< ImageData > data) | |
| Creates an Image from a user-supplied instance of the ImageData interface. | |
| 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). | |
| 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. | |
| 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). | |
| ImageData & | getData () const |
| Provides access to the underlying image data object. | |
| 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.
| Gosu::Image::Image | ( | std::auto_ptr< ImageData > | data | ) | [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 |