The Bitmap class is a helper class for working with bitmap data.
More...
#include <bitmap.h>
The Bitmap class is a helper class for working with bitmap data.
- Author
- Sam Twidale (https://samcodes.co.uk/)
geometrize::Bitmap::Bitmap |
( |
std::uint32_t |
width, |
|
|
std::uint32_t |
height, |
|
|
geometrize::rgba |
color |
|
) |
| |
Bitmap Creates a new bitmap.
- Parameters
-
width | The width of the bitmap. |
height | The height of the bitmap. |
color | The starting color of the bitmap (RGBA format). |
std::vector< std::uint8_t > m_data
The bitmap data.
Definition: bitmap.h:85
std::uint32_t m_width
The width of the bitmap.
Definition: bitmap.h:83
void fill(geometrize::rgba color)
fill Fills the bitmap with the given color.
Definition: bitmap.cpp:55
std::uint32_t m_height
The height of the bitmap.
Definition: bitmap.h:84
geometrize::Bitmap::Bitmap |
( |
std::uint32_t |
width, |
|
|
std::uint32_t |
height, |
|
|
const std::vector< std::uint8_t > & |
data |
|
) |
| |
Bitmap Creates a new bitmap from the supplied byte data.
- Parameters
-
width | The width of the bitmap. |
height | The height of the bitmap. |
data | The byte data to fill the bitmap with, must be width * height * depth (4) long. |
17 assert((width * height * 4U) == data.size());
std::vector< std::uint8_t > m_data
The bitmap data.
Definition: bitmap.h:85
std::uint32_t m_width
The width of the bitmap.
Definition: bitmap.h:83
std::uint32_t m_height
The height of the bitmap.
Definition: bitmap.h:84
geometrize::Bitmap::~Bitmap |
( |
| ) |
|
|
default |
std::vector< std::uint8_t > geometrize::Bitmap::copyData |
( |
| ) |
const |
copyData Gets a copy of the raw bitmap data.
- Returns
- The bitmap data.
std::vector< std::uint8_t > m_data
The bitmap data.
Definition: bitmap.h:85
fill Fills the bitmap with the given color.
- Parameters
-
color | The color to fill the bitmap with. |
57 for(std::size_t i = 0; i <
m_data.size(); i += 4U) {
std::vector< std::uint8_t > m_data
The bitmap data.
Definition: bitmap.h:85
std::uint8_t a
The blue component (0-255).
Definition: rgba.h:17
std::uint8_t g
The red component (0-255).
Definition: rgba.h:15
std::uint8_t b
The green component (0-255).
Definition: rgba.h:16
std::uint8_t r
Definition: rgba.h:14
const std::vector< std::uint8_t > & geometrize::Bitmap::getDataRef |
( |
| ) |
const |
getDataRef Gets a reference to the raw bitmap data.
- Returns
- The bitmap data.
std::vector< std::uint8_t > m_data
The bitmap data.
Definition: bitmap.h:85
std::uint32_t geometrize::Bitmap::getHeight |
( |
| ) |
const |
getHeight Gets the height of the bitmap.
std::uint32_t m_height
The height of the bitmap.
Definition: bitmap.h:84
geometrize::rgba geometrize::Bitmap::getPixel |
( |
std::uint32_t |
x, |
|
|
std::uint32_t |
y |
|
) |
| const |
getPixel Gets a pixel color value.
- Parameters
-
x | The x-coordinate of the pixel. |
y | The y-coordinate of the pixel. |
- Returns
- The pixel RGBA color value.
42 const std::size_t index{(
m_width * y + x) * 4U};
std::vector< std::uint8_t > m_data
The bitmap data.
Definition: bitmap.h:85
std::uint32_t m_width
The width of the bitmap.
Definition: bitmap.h:83
The rgba struct is a helper for manipulating RGBA8888 color data.
Definition: rgba.h:12
std::uint32_t geometrize::Bitmap::getWidth |
( |
| ) |
const |
getWidth Gets the width of the bitmap.
std::uint32_t m_width
The width of the bitmap.
Definition: bitmap.h:83
void geometrize::Bitmap::setPixel |
( |
std::uint32_t |
x, |
|
|
std::uint32_t |
y, |
|
|
geometrize::rgba |
color |
|
) |
| |
setPixel Sets a pixel color value.
- Parameters
-
x | The x-coordinate of the pixel. |
y | The y-coordinate of the pixel. |
color | The pixel RGBA color value. |
48 const std::uint32_t index{(
m_width * y + x) * 4U};
std::vector< std::uint8_t > m_data
The bitmap data.
Definition: bitmap.h:85
std::uint8_t a
The blue component (0-255).
Definition: rgba.h:17
std::uint8_t g
The red component (0-255).
Definition: rgba.h:15
std::uint32_t m_width
The width of the bitmap.
Definition: bitmap.h:83
std::uint8_t b
The green component (0-255).
Definition: rgba.h:16
std::uint8_t r
Definition: rgba.h:14
std::vector<std::uint8_t> geometrize::Bitmap::m_data |
|
private |
std::uint32_t geometrize::Bitmap::m_height |
|
private |
The height of the bitmap.
std::uint32_t geometrize::Bitmap::m_width |
|
private |
The documentation for this class was generated from the following files:
- /home/travis/build/Tw1ddle/geometrize-lib-docs/geometrize/geometrize/geometrize/bitmap/bitmap.h
- /home/travis/build/Tw1ddle/geometrize-lib-docs/geometrize/geometrize/geometrize/bitmap/bitmap.cpp