![]() |
Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
|
Represents raw 2D image data stored in memory. More...
#include <image_data.hpp>
Public Member Functions | |
| ImageData () | |
| Constructs an empty image. More... | |
| ImageData (unsigned int width, unsigned int height) | |
| Constructs a blank image with specified dimensions. More... | |
| ImageData (std::string filepath) | |
| Loads image data from a file. More... | |
| ImageData (std::vector< uint8_t > const &fileBytes) | |
| Constructs an image by decoding raw file bytes. More... | |
| ImageData (unsigned int width, unsigned int height, std::vector< std::uint8_t > const &pixelsRGBA) | |
| Constructs image from raw RGBA pixel buffer. More... | |
| ~ImageData () | |
| Destructor that frees memory. More... | |
| ImageData (const ImageData &src) | |
| Copy constructor. More... | |
| ImageData & | operator= (const ImageData &rhs) |
| Copy assignment operator. More... | |
| unsigned int | GetWidth () const |
| Returns the image width. More... | |
| unsigned int | GetHeight () const |
| Returns the image height. More... | |
| void | Fill (Color color) |
| Fills the image with a solid color. More... | |
| void | SetPixel (unsigned int x, unsigned int y, Color color) |
| Sets the color of a specific pixel. More... | |
| const Color | GetPixel (unsigned int x, unsigned int y) const |
| Retrieves the color of a specific pixel. More... | |
| std::vector< uint8_t > | GetImageDataRGBA () const |
| Gets raw image data in RGBA format. More... | |
| std::vector< uint8_t > | GetImageDataRGB () const |
| Gets raw image data in RGB format. More... | |
| size_t | GetSizeInBytes () const |
| Gets the total size of the image in memory. More... | |
| void | WriteJpegFile (char const *filename) |
| Writes the image data to a JPEG file. More... | |
| void | WritePngFile (char const *filename) |
| Writes the image data to a PNG file. More... | |
Static Public Member Functions | |
| static void | DrawImageOnImageAtPos (unsigned int const x, unsigned int const y, ImageData &toImage, ImageData &fromImage) |
| Overlays one image on top of another at a given position. More... | |
Protected Member Functions | |
| void | AllocateMemory (unsigned int width, unsigned int height) |
| Allocates memory for internal pixel storage. More... | |
| void | CleanAllocatedMemory () |
| Frees allocated memory. More... | |
| void | LoadImageDataRGBA (std::vector< std::uint8_t > const &pixels) |
| Loads image data from a 32-bit RGBA buffer. More... | |
| void | LoadImageDataRGB (std::vector< std::uint8_t > const &pixels) |
| Loads image data from a 24-bit RGB buffer. More... | |
| bool | LoadTexturePngFile (char const *filename) |
| Loads image from a PNG file. More... | |
| bool | LoadTextureJpegFile (char const *filename) |
| Loads image from a JPEG file. More... | |
| size_t | GetLinearIndex (unsigned int x, unsigned int y) const |
| Color & | PixelRef (unsigned int x, unsigned int y) |
| const Color & | PixelRef (unsigned int x, unsigned int y) const |
Represents raw 2D image data stored in memory.
Definition at line 79 of file image_data.hpp.
| rendering_engine::ImageData::ImageData | ( | ) |
Constructs an empty image.
Definition at line 12 of file image_data.cpp.
| rendering_engine::ImageData::ImageData | ( | unsigned int | width, |
| unsigned int | height | ||
| ) |
Constructs a blank image with specified dimensions.
| width | Image width in pixels |
| height | Image height in pixels |
Definition at line 18 of file image_data.cpp.
| rendering_engine::ImageData::ImageData | ( | std::string | filepath | ) |
Loads image data from a file.
| filepath | Path to the image file (JPG or PNG) |
Definition at line 26 of file image_data.cpp.
| rendering_engine::ImageData::ImageData | ( | std::vector< uint8_t > const & | fileBytes | ) |
Constructs an image by decoding raw file bytes.
This constructor allows loading an image from a memory buffer rather than a file on disk. The data is interpreted as either PNG or JPEG depending on format detection. Decoded pixel data is stored internally in 32-bit RGBA format.
| fileBytes | Raw contents of an image file (PNG or JPEG). |
Definition at line 60 of file image_data.cpp.
| rendering_engine::ImageData::ImageData | ( | unsigned int | width, |
| unsigned int | height, | ||
| std::vector< std::uint8_t > const & | pixelsRGBA | ||
| ) |
Constructs image from raw RGBA pixel buffer.
| width | Image width |
| height | Image height |
| pixelsRGBA | Vector of RGBA pixel data (4 bytes per pixel) |
Definition at line 101 of file image_data.cpp.
| rendering_engine::ImageData::~ImageData | ( | ) |
Destructor that frees memory.
Definition at line 109 of file image_data.cpp.
| rendering_engine::ImageData::ImageData | ( | const ImageData & | src | ) |
Copy constructor.
Definition at line 114 of file image_data.cpp.
|
protected |
Allocates memory for internal pixel storage.
| width | Image width |
| height | Image height |
Definition at line 308 of file image_data.cpp.
|
protected |
Frees allocated memory.
Definition at line 315 of file image_data.cpp.
|
static |
Overlays one image on top of another at a given position.
| x | Top-left X coordinate for the overlay |
| y | Top-left Y coordinate for the overlay |
| toImage | Destination image |
| fromImage | Source image |
Definition at line 159 of file image_data.cpp.
| void rendering_engine::ImageData::Fill | ( | Color | color | ) |
Fills the image with a solid color.
| color | The color to fill with |
Definition at line 135 of file image_data.cpp.
|
inline |
Returns the image height.
Definition at line 145 of file image_data.hpp.
| std::vector< uint8_t > rendering_engine::ImageData::GetImageDataRGB | ( | ) | const |
Gets raw image data in RGB format.
Definition at line 235 of file image_data.cpp.
| std::vector< uint8_t > rendering_engine::ImageData::GetImageDataRGBA | ( | ) | const |
Gets raw image data in RGBA format.
Definition at line 219 of file image_data.cpp.
|
inlineprotected |
Definition at line 246 of file image_data.hpp.
| const Color rendering_engine::ImageData::GetPixel | ( | unsigned int | x, |
| unsigned int | y | ||
| ) | const |
Retrieves the color of a specific pixel.
| x | X coordinate |
| y | Y coordinate |
Definition at line 148 of file image_data.cpp.
|
inline |
Gets the total size of the image in memory.
Definition at line 197 of file image_data.hpp.
|
inline |
Returns the image width.
Definition at line 137 of file image_data.hpp.
|
protected |
Loads image data from a 24-bit RGB buffer.
Definition at line 338 of file image_data.cpp.
|
protected |
Loads image data from a 32-bit RGBA buffer.
Definition at line 323 of file image_data.cpp.
|
protected |
Loads image from a JPEG file.
Definition at line 265 of file image_data.cpp.
|
protected |
Loads image from a PNG file.
Definition at line 289 of file image_data.cpp.
Copy assignment operator.
Definition at line 122 of file image_data.cpp.
|
inlineprotected |
Definition at line 251 of file image_data.hpp.
|
inlineprotected |
Definition at line 256 of file image_data.hpp.
| void rendering_engine::ImageData::SetPixel | ( | unsigned int | x, |
| unsigned int | y, | ||
| Color | color | ||
| ) |
Sets the color of a specific pixel.
| x | X coordinate |
| y | Y coordinate |
| color | The color to set |
Definition at line 140 of file image_data.cpp.
| void rendering_engine::ImageData::WriteJpegFile | ( | char const * | filename | ) |
Writes the image data to a JPEG file.
| filename | Path to output file |
Definition at line 260 of file image_data.cpp.
| void rendering_engine::ImageData::WritePngFile | ( | char const * | filename | ) |
Writes the image data to a PNG file.
| filename | Path to output file |
Definition at line 284 of file image_data.cpp.