A simple sRGB(A) image.
More...
|
| | Image () |
| | Default constructor initializes an empty (invalid) image.
|
| bool | is_valid () const |
| | Returns true if the image has valid dimensions and data.
|
| void | setup_with_alpha_support (int w, int h) |
| | Initializes the image with the specified dimensions and alpha support.
|
| void | make_invalid () |
| | Marks the image as invalid by resetting its dimensions and clearing its data.
|
| void | set_pixel (int x, int y, int r, unsigned char g, unsigned char b, unsigned char a) |
| | Sets the color of a pixel at the specified coordinates in an image buffer.
|
| void | set_pixel (int x, int y, const PixelColor &color) |
| | Overload: Sets the color of a pixel using a PixelColor struct.
|
| PixelColor | get_pixel (int x, int y) const |
| | Gets the color of a pixel at the specified coordinates.
|
|
| int | width = 0 |
| int | height = 0 |
| std::vector< unsigned char > | data |
| | The data is stored in row-major order, with 4 bytes per pixel RGB(A).
|
A simple sRGB(A) image.
Definition at line 17 of file image.h.
◆ Image()
| eu::core::Image::Image |
( |
| ) |
|
Default constructor initializes an empty (invalid) image.
◆ get_pixel()
| PixelColor eu::core::Image::get_pixel |
( |
int | x, |
|
|
int | y ) const |
|
nodiscard |
Gets the color of a pixel at the specified coordinates.
- Parameters
-
| x | The x-coordinate of the pixel. |
| y | The y-coordinate of the pixel. |
- Returns
- The color at the pixel as a PixelColor struct. If out of bounds, returns {0,0,0,0}.
◆ is_valid()
| bool eu::core::Image::is_valid |
( |
| ) |
const |
|
nodiscard |
Returns true if the image has valid dimensions and data.
◆ make_invalid()
| void eu::core::Image::make_invalid |
( |
| ) |
|
Marks the image as invalid by resetting its dimensions and clearing its data.
◆ set_pixel() [1/2]
| void eu::core::Image::set_pixel |
( |
int | x, |
|
|
int | y, |
|
|
const PixelColor & | color ) |
Overload: Sets the color of a pixel using a PixelColor struct.
◆ set_pixel() [2/2]
| void eu::core::Image::set_pixel |
( |
int | x, |
|
|
int | y, |
|
|
int | r, |
|
|
unsigned char | g, |
|
|
unsigned char | b, |
|
|
unsigned char | a ) |
Sets the color of a pixel at the specified coordinates in an image buffer.
- Parameters
-
| x | The x-coordinate of the pixel. |
| y | The y-coordinate of the pixel. |
| r | The red color component (0-255). |
| g | The green color component (0-255). |
| b | The blue color component (0-255). |
| a | The alpha (transparency) component (0-255). |
◆ setup_with_alpha_support()
| void eu::core::Image::setup_with_alpha_support |
( |
int | w, |
|
|
int | h ) |
Initializes the image with the specified dimensions and alpha support.
- Parameters
-
| w | The width of the image. |
| h | The height of the image. |
◆ data
| std::vector<unsigned char> eu::core::Image::data |
The data is stored in row-major order, with 4 bytes per pixel RGB(A).
Definition at line 21 of file image.h.
◆ height
| int eu::core::Image::height = 0 |
◆ width
| int eu::core::Image::width = 0 |
The documentation for this struct was generated from the following file: