65 void operator=(
const CImage &other) =
delete;
101 bool Load(
const std::string &fileName);
104 bool SavePNG(
const std::string &fileName);
117 void BlitToNewRGBASurface(
int width,
int height);
122 std::unique_ptr<ImageData> m_data;
void PadToNearestPowerOfTwo()
Pads the image to nearest power of 2 dimensions.
Definition: image.cpp:216
void SetPixelInt(Math::IntPoint pixel, Gfx::IntColor color)
Sets the precise color at given pixel.
Definition: image.cpp:318
Gfx::IntColor GetPixelInt(Math::IntPoint pixel)
Returns the precise color at given pixel.
Definition: image.cpp:258
Color with integer values.
Definition: color.h:101
void ConvertToRGBA()
Convert the image to RGBA surface.
Definition: image.cpp:229
void Fill(Gfx::IntColor color)
Fills the whole image with given color.
Definition: image.cpp:202
void Free()
Frees the allocated image data.
Definition: image.cpp:175
bool IsEmpty() const
Returns whether the image is empty (has null data)
Definition: image.cpp:170
Gfx::Color GetPixel(Math::IntPoint pixel)
Returns the color at given pixel.
Definition: image.cpp:306
void SetDataPixels(void *pixels)
sets/replaces the pixels from the surface
Definition: image.cpp:433
SDL_Surface * surface
SDL surface with image data.
Definition: image.h:44
Math::IntPoint GetSize() const
Returns the image size.
Definition: image.cpp:193
Color structs and related functions.
bool Load(const std::string &fileName)
Loads an image from the specified file.
Definition: image.cpp:380
Image loaded from file.
Definition: image.h:54
Implementation-specific image data.
Definition: image.h:41
ImageData * GetData()
Returns the image data; if empty - returns nullptr.
Definition: image.cpp:188
void FlipVertically()
Flips the image vertically.
Definition: image.cpp:447
bool SavePNG(const std::string &fileName)
Saves the image to the specified file in PNG format.
Definition: image.cpp:414
void SetPixel(Math::IntPoint pixel, Gfx::Color color)
Sets the color at given pixel.
Definition: image.cpp:370
CImage()
Constructs empty image (with nullptr data)
Definition: image.cpp:153
2D Point with integer coords
Definition: intpoint.h:39
RGBA color.
Definition: color.h:39
std::string GetError()
Returns the last error.
Definition: image.cpp:375
virtual ~CImage()
Destroys image, calling Free()
Definition: image.cpp:165