19 std::tr1::shared_ptr<ImageData> data;
28 bool tileable =
false);
34 Image(
Graphics& graphics,
const std::wstring& filename,
unsigned srcX,
35 unsigned srcY,
unsigned srcWidth,
unsigned srcHeight,
36 bool tileable =
false);
41 bool tileable =
false);
45 unsigned srcY,
unsigned srcWidth,
unsigned srcHeight,
46 bool tileable =
false);
49 explicit Image(GOSU_UNIQUE_PTR<ImageData> data);
51 unsigned width()
const;
55 void draw(
double x,
double y,
ZPos z,
56 double factorX = 1,
double factorY = 1,
62 double factorX,
double factorY,
76 double angle,
double centerX = 0.5,
double centerY = 0.5,
77 double factorX = 1,
double factorY = 1,
85 std::vector<Gosu::Image>
loadTiles(
Graphics& graphics,
const Bitmap& bmp,
int tileWidth,
int tileHeight,
bool tileable);
86 std::vector<Gosu::Image>
loadTiles(
Graphics& graphics,
const std::wstring& bmp,
int tileWidth,
int tileHeight,
bool tileable);
96 template<
typename Container>
99 std::vector<Gosu::Image> tiles =
loadTiles(graphics, filename, tileWidth, tileHeight, tileable);
100 for (
int i = 0, num = tiles.size(); i < num; ++i)
101 appendTo.push_back(
typename Container::value_type(
new Gosu::Image(tiles[i])));
112 template<
typename Container>
114 int tileWidth,
int tileHeight,
bool tileable, Container& appendTo)
116 std::vector<Gosu::Image> tiles =
loadTiles(graphics, bmp, tileWidth, tileHeight, tileable);
117 for (
int i = 0, num = tiles.size(); i < num; ++i)
118 appendTo.push_back(
typename Container::value_type(
new Gosu::Image(tiles[i])));
std::vector< Gosu::Image > loadTiles(Graphics &graphics, const Bitmap &bmp, int tileWidth, int tileHeight, bool tileable)
void imagesFromTiledBitmap(Graphics &graphics, const std::wstring &filename, int tileWidth, int tileHeight, bool tileable, Container &appendTo)
Convenience function that splits a BMP or PNG file into an array of small rectangles and creates imag...
Includes all parts of C++03 (TR1) that are relevant for Gosu.
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.
ImageData & getData() const
Provides access to the underlying image data object.
Contains declarations of all of Gosu's available classes.
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).
Represents an RGBA color value with 8 bits for each channel.
double ZPos
Represents the Z position of something drawn with Gosu's graphics system.
Rectangular area of pixels, each represented by a Color value.
The color's channels will be interpolated.
The ImageData class is an abstract base class for drawable images.
Image(Graphics &graphics, const std::wstring &filename, bool tileable=false)
Loads an image from a given filename that can be drawn onto graphics.
Serves as the target of all drawing and provides primitive drawing functionality. ...
AlphaMode
Determines the way colors are combined when one is drawn onto another.
Interface of the Color class.
Provides functionality for drawing rectangular images.
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).
double angle(double fromX, double fromY, double toX, double toY, double def=0)
Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.
Contains general typedefs and enums related to graphics.