Worldstone
|
A view on an image buffer of type Color. More...
#include <ImageView.h>
Public Member Functions | |
ImageView (Color *_buffer, size_t _width, size_t _height, size_t _stride) | |
bool | isValid () const |
Checks if the view seems to be valid based on its characteristics. | |
bool | operator== (const ImageView &rhs) const |
bool | operator!= (const ImageView &rhs) const |
operator ImageView< const Color > () const | |
Enable conversion from ImageView<Color> to ImageView<const Color> | |
ImageView | subView (size_t xOffset, size_t yOffset, size_t subWidth, size_t subHeight) const |
Create an ImageView that is contained by the current view. More... | |
Color & | operator() (size_t x, size_t y) const |
Access the pixel at the given coordinates. More... | |
void | copyTo (ImageView destination) const |
Copy (blits) the content of an image to another. More... | |
void | fill (size_t x, size_t y, size_t columns, size_t rows, Color colorValue) |
Fills a part of the image. More... | |
void | fillBytes (size_t x, size_t y, size_t columns, size_t rows, uint8_t byteValue) |
Fills a part of the image using a byte pattern. More... | |
Public Attributes | |
Color * | buffer = nullptr |
Pointer to the memory considered as the first pixel. | |
size_t | width = 0 |
Width of the image, can be dfferent from the one of the buffer. | |
size_t | height = 0 |
Number of scanlines of the image. | |
size_t | stride = 0 |
Actual width of the buffer scanlines. | |
A view on an image buffer of type Color.
This class can be used to access a buffer of the Color type as if it was an image. It should be small enough so that you can directly copy the view instead of passing it by reference. Note that this class does not do bounds checking, and the user is the one responsible for handling the data correctly. A good way to abstract an image allocator could be to implement an IImageProvider, which returns an ImageView.
Definition at line 25 of file ImageView.h.
|
inline |
Copy (blits) the content of an image to another.
If the current view and destination memory overlap, result is undefined.
Definition at line 78 of file ImageView.h.
|
inline |
Fills a part of the image.
x | First column to fill |
y | First row to fill |
columns | Number of pixels to fill per scanline |
rows | Number of scanlines to fill |
colorValue | The value to set every byte of the pixels to |
Definition at line 95 of file ImageView.h.
|
inline |
Fills a part of the image using a byte pattern.
x | First column to fill |
y | First row to fill |
columns | Number of pixels to fill per scanline |
rows | Number of scanlines to fill |
byteValue | The value to set every byte of the pixels to |
Definition at line 115 of file ImageView.h.
|
inline |
Access the pixel at the given coordinates.
Definition at line 72 of file ImageView.h.
|
inline |
Create an ImageView that is contained by the current view.
xOffset | First column of the subview |
yOffset | First row of the subview |
subWidth | Number of columns, must verify xOffset + subWidth <= width
|
subHeight | Number of rows, must verify yOffset + subHeight > height
|
Definition at line 61 of file ImageView.h.