25 #ifndef SFML_IMAGE_HPP
26 #define SFML_IMAGE_HPP
31 #include <SFML/Graphics/Export.hpp>
32 #include <SFML/Graphics/Color.hpp>
33 #include <SFML/Graphics/Rect.hpp>
72 void create(
unsigned int width,
unsigned int height,
const Color& color =
Color(0, 0, 0));
87 void create(
unsigned int width,
unsigned int height,
const Uint8* pixels);
199 void copy(
const Image& source,
unsigned int destX,
unsigned int destY,
const IntRect& sourceRect =
IntRect(0, 0, 0, 0),
bool applyAlpha =
false);
267 std::vector<Uint8> m_pixels;
Utility class for manipulating RGBA colors.
Class for loading, manipulating and saving images.
void create(unsigned int width, unsigned int height, const Uint8 *pixels)
Create the image from an array of pixels.
bool loadFromStream(InputStream &stream)
Load the image from a custom stream.
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.
bool saveToFile(const std::string &filename) const
Save the image to a file on disk.
void flipHorizontally()
Flip the image horizontally (left <-> right)
void flipVertically()
Flip the image vertically (top <-> bottom)
Vector2u getSize() const
Return the size (width and height) of the image.
bool loadFromFile(const std::string &filename)
Load the image from a file on disk.
void setPixel(unsigned int x, unsigned int y, const Color &color)
Change the color of a pixel.
bool loadFromMemory(const void *data, std::size_t size)
Load the image from a file in memory.
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.
Image()
Default constructor.
Color getPixel(unsigned int x, unsigned int y) const
Get the color of a pixel.
const Uint8 * getPixelsPtr() const
Get a read-only pointer to the array of pixels.