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 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.
 ~Image ()
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).
void drawRotFlip (double x, double y, ZPos z, RotFlip rf, double factorX=1, double factorY=1, Color c=Color::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
 Provides access to the underlying image data object.


Detailed Description

Provides functionality for drawing rectangular images.

Definition at line 16 of file Image.hpp.


Constructor & Destructor Documentation

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.

Gosu::Image::Image ( Graphics graphics,
const Bitmap source,
bool  tileable = 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  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]

Creates an Image from a user-supplied instance of the ImageData interface.

Gosu::Image::~Image (  ) 


Member Function Documentation

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!

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.

void Gosu::Image::drawRotFlip ( double  x,
double  y,
ZPos  z,
RotFlip  rf,
double  factorX = 1,
double  factorY = 1,
Color  c = Color::WHITE,
AlphaMode  mode = amDefault 
) const

void Gosu::Image::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 ImageData& Gosu::Image::getData (  )  const

Provides access to the underlying image data object.

unsigned Gosu::Image::height (  )  const

unsigned Gosu::Image::width (  )  const


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