4 #ifndef GOSU_BITMAP_HPP
5 #define GOSU_BITMAP_HPP
23 std::vector<Color> pixels;
29 unsigned width()
const {
return w; }
30 unsigned height()
const {
return h; }
38 Color getPixel(
unsigned x,
unsigned y)
const {
return pixels[y * w + x]; }
42 void setPixel(
unsigned x,
unsigned y,
Color c) { pixels[y * w + x] = c; }
52 void insert(
const Bitmap& source,
int x,
int y,
unsigned srcX,
53 unsigned srcY,
unsigned srcWidth,
unsigned srcHeight);
66 void loadImageFile(Bitmap& bitmap,
const std::wstring& filename);
71 void saveImageFile(
const Bitmap& bitmap,
const std::wstring& filename);
74 const std::wstring& formatHint = L
"png");
86 unsigned srcX,
unsigned srcY,
unsigned srcWidth,
unsigned srcHeight,
87 unsigned borderFlags);
GOSU_DEPRECATED Reader loadFromBMP(Bitmap &bmp, Reader reader)
Contains declarations of all of Gosu's available classes.
void setPixel(unsigned x, unsigned y, Color c)
Sets the pixel at the specified position to a color.
void resize(unsigned width, unsigned height, Color c=Color::NONE)
Represents an RGBA color value with 8 bits for each channel.
void applyColorKey(Bitmap &bitmap, Color key)
Set the alpha value of all pixels which are equal to the color key to zero.
GOSU_DEPRECATED void fill(Color c)
GOSU_DEPRECATED Reader loadFromPNG(Bitmap &bmp, Reader reader)
GOSU_DEPRECATED void replace(Color oldColor, Color newColor)
void loadImageFile(Bitmap &bitmap, const std::wstring &filename)
Loads any supported image into a Bitmap.
Rectangular area of pixels, each represented by a Color value.
GOSU_DEPRECATED Writer saveToBMP(const Bitmap &bmp, Writer writer)
const Color * data() const
Direct access to the array of color values.
Bitmap(unsigned w, unsigned h, Color c=Color::NONE)
void saveImageFile(const Bitmap &bitmap, const std::wstring &filename)
Saves a Bitmap to a file.
void insert(const Bitmap &source, int x, int y)
Inserts a bitmap at the given position.
Utility class that points to a specific position in a resource and offers an interface for sequential...
Color getPixel(unsigned x, unsigned y) const
Returns the color at the specified position.
GOSU_DEPRECATED Writer saveToPNG(const Bitmap &bmp, Writer writer)
Interface of the Color class.
void unapplyColorKey(Bitmap &bitmap, Color background)
The reverse of applyColorKey.
Contains general typedefs and enums related to graphics.
void applyBorderFlags(Bitmap &dest, const Bitmap &source, unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight, unsigned borderFlags)