Gosu::Image Class Reference

Provides functionality for drawing rectangular images. More...

List of all members.

Public Member Functions

 Image (Graphics &graphics, const std::wstring &filename, bool hardBorders=false)
 Image (Graphics &graphics, const std::wstring &filename, unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight, bool hardBorders=false)
 Image (Graphics &graphics, const Bitmap &source, bool hardBorders=false)
 Image (Graphics &graphics, const Bitmap &source, unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight, bool hardBorders=false)
unsigned width () const
unsigned height () const
void draw (double x, double y, ZPos z, double factorX=1, double factorY=1, Color c=Colors::white, AlphaMode mode=amDefault) const
void drawMod (double x, double y, ZPos z, double factorX, double factorY, Color c1, Color c2, Color c3, Color c4, AlphaMode mode=amDefault) const
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=Colors::white, AlphaMode mode=amDefault) const
void drawRotFlip (double x, double y, ZPos z, RotFlip rf, double factorX=1, double factorY=1, Color c=Colors::white, AlphaMode mode=amDefault) const
void drawRotFlipMod (double x, double y, ZPos z, RotFlip rf, double factorX, double factorY, Color c1, Color c2, Color c3, Color c4, AlphaMode mode=amDefault) const
const ImageDatagetData () const


Detailed Description

Provides functionality for drawing rectangular images.

Constructor & Destructor Documentation

Gosu::Image::Image ( Graphics graphics,
const std::wstring &  filename,
bool  hardBorders = 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  hardBorders = 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.

Gosu::Image::Image ( Graphics graphics,
const Bitmap source,
bool  hardBorders = false 
)

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  hardBorders = false 
)

Converts a portion of the given bitmap into an image that can be drawn onto graphics.


Member Function Documentation

void Gosu::Image::draw ( double  x,
double  y,
ZPos  z,
double  factorX = 1,
double  factorY = 1,
Color  c = Colors::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 = Colors::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!

Parameters:
angle See Math.hpp for an explanation of how Gosu interprets angles.
centerX Relative horizontal position of the rotation center on the image. 0 is the left border, 1 is the right border, 0.5 is the center (and default).
centerY See centerX.

const ImageData& Gosu::Image::getData (  )  const

Provides access to the underlying image data object.


The documentation for this class was generated from the following file:

Generated on Sat Dec 6 03:53:17 2008 for Gosu by  doxygen 1.5.5