60 void operator=(
const CImage &other) {}
104 bool Load(
const std::string &fileName);
107 bool SavePNG(
const std::string &fileName);
120 void BlitToNewRGBASurface(
int width,
int height);
void PadToNearestPowerOfTwo()
Pads the image to nearest power of 2 dimensions.
Definition: image.cpp:211
void SetPixelInt(Math::IntPoint pixel, Gfx::IntColor color)
Sets the precise color at given pixel.
Definition: image.cpp:313
Gfx::IntColor GetPixelInt(Math::IntPoint pixel)
Returns the precise color at given pixel.
Definition: image.cpp:253
Color with integer values.
Definition: color.h:97
void flipVertically()
Flips the image vertically.
Definition: image.cpp:434
void ConvertToRGBA()
Convert the image to RGBA surface.
Definition: image.cpp:224
void Fill(Gfx::IntColor color)
Fills the whole image with given color.
Definition: image.cpp:197
void Free()
Frees the allocated image data.
Definition: image.cpp:169
bool IsEmpty() const
Returns whether the image is empty (has null data)
Definition: image.cpp:164
Gfx::Color GetPixel(Math::IntPoint pixel)
Returns the color at given pixel.
Definition: image.cpp:301
void SetDataPixels(void *pixels)
sets/replaces the pixels from the surface
Definition: image.cpp:421
SDL_Surface * surface
SDL surface with image data.
Definition: image.h:42
Math::IntPoint GetSize() const
Returns the image size.
Definition: image.cpp:188
Color structs and related functions.
bool Load(const std::string &fileName)
Loads an image from the specified file.
Definition: image.cpp:375
Image loaded from file.
Definition: image.h:54
Implementation-specific image data.
Definition: image.h:39
ImageData * GetData()
Returns the image data; if empty - returns nullptr.
Definition: image.cpp:183
bool SavePNG(const std::string &fileName)
Saves the image to the specified file in PNG format.
Definition: image.cpp:402
void SetPixel(Math::IntPoint pixel, Gfx::Color color)
Sets the color at given pixel.
Definition: image.cpp:365
CImage()
Constructs empty image (with NULL data)
Definition: image.cpp:147
2D Point with integer coords
Definition: intpoint.h:35
RGBA color.
Definition: color.h:35
std::string GetError()
Returns the last error.
Definition: image.cpp:370
virtual ~CImage()
Destroys image, calling Free()
Definition: image.cpp:159