25 #ifndef CPP3DS_IMAGE_HPP
26 #define CPP3DS_IMAGE_HPP
31 #include <cpp3ds/Graphics/Color.hpp>
32 #include <cpp3ds/Graphics/Rect.hpp>
71 void create(
unsigned int width,
unsigned int height,
const Color& color =
Color(0, 0, 0));
86 void create(
unsigned int width,
unsigned int height,
const Uint8* pixels);
155 bool saveToFile(
const std::string& filename)
const;
198 void copy(
const Image& source,
unsigned int destX,
unsigned int destY,
const IntRect& sourceRect =
IntRect(0, 0, 0, 0),
bool applyAlpha =
false);
214 void setPixel(
unsigned int x,
unsigned int y,
const Color& color);
266 std::vector<Uint8> m_pixels;
void setPixel(unsigned int x, unsigned int y, const Color &color)
Change the color of a pixel.
Color getPixel(unsigned int x, unsigned int y) const
Get the color of a pixel.
Utility class for manpulating RGBA colors.
bool loadFromStream(InputStream &stream)
Load the image from a custom stream.
bool loadFromFile(const std::string &filename)
Load the image from a file on disk.
void copy(const Image &source, unsigned int destX, unsigned int destY, const IntRect &sourceRect=IntRect(0, 0, 0, 0), bool applyAlpha=false)
Copy pixels from another image onto this one.
bool loadFromMemory(const void *data, std::size_t size)
Load the image from a file in memory.
void flipHorizontally()
Flip the image horizontally (left <-> right)
const Uint8 * getPixelsPtr() const
Get a read-only pointer to the array of pixels.
bool saveToFile(const std::string &filename) const
Save the image to a file on disk.
Class for loading, manipulating and saving images.
Image()
Default constructor.
Vector2u getSize() const
Return the size (width and height) of the image.
void flipVertically()
Flip the image vertically (top <-> bottom)
void createMaskFromColor(const Color &color, Uint8 alpha=0)
Create a transparency mask from a specified color-key.
void create(unsigned int width, unsigned int height, const Color &color=Color(0, 0, 0))
Create the image and fill it with a unique color.