|
mmcfilters
Public API documentation
|
Generic row-major 2D image with contiguous storage and shared ownership. More...
#include <Image.hpp>
Public Types | |
| using | Type = PixelType |
| Pixel scalar type stored by this image. | |
Public Member Functions | |
| Image (int rows, int columns) | |
| Allocates an owned row-major image buffer. | |
| void | fill (PixelType value) |
Fills every pixel with value. | |
| bool | isEqual (const Ptr &other) const |
Returns true when shape and pixel values match other. | |
| Ptr | clone () const |
| Returns a deep copy with its own owned buffer. | |
| std::shared_ptr< PixelType[]> | rawDataPtr () |
| Returns the shared pointer that owns or wraps the raw buffer. | |
| PixelType * | rawData () |
| Returns a mutable pointer to the contiguous row-major buffer. | |
| int | getNumRows () const |
| Returns the number of image rows. | |
| int | getNumColumns () const |
| Returns the number of image columns. | |
| int | getSize () const |
| Returns the total number of pixels. | |
| PixelType & | operator[] (PixelId index) |
Returns mutable linear access to pixel index. | |
| const PixelType & | operator[] (PixelId index) const |
Returns immutable linear access to pixel index. | |
Static Public Member Functions | |
| static Ptr | create (int rows, int columns) |
| Creates an owned image with uninitialised pixel values. | |
| static Ptr | create (int rows, int columns, PixelType initValue) |
Creates an owned image and fills every pixel with initValue. | |
| static Ptr | fromExternal (PixelType *rawPtr, int rows, int columns) |
| Wraps external row-major memory without taking ownership. | |
| static Ptr | fromRaw (PixelType *rawPtr, int rows, int columns) |
Wraps row-major memory and takes ownership through delete[]. | |
Friends | |
| class | detail::CommittedImageAccess |
Generic row-major 2D image with contiguous storage and shared ownership.
Image<PixelType> stores a rectangular image in a single contiguous row-major buffer. The class exposes simple factory helpers for owned and non-owned memory, deep copy support, linear access, and a few convenience operations used throughout the library.
Ownership semantics:
create(rows, columns) allocates and owns a fresh buffer;create(rows, columns, initValue) allocates, owns, and fills the buffer;fromExternal(rawPtr, rows, columns) wraps external memory without taking ownership;fromRaw(rawPtr, rows, columns) wraps external memory and assumes ownership.| PixelType | Pixel scalar type, such as uint8_t, int32_t, or float. |
|
inline |
|
inline |
|
inlinestatic |
Creates an owned image with uninitialised pixel values.
| rows | Number of image rows. |
| columns | Number of image columns. |
| std::invalid_argument | If either dimension is not positive. |
| std::overflow_error | If rows * columns exceeds the supported size. |
|
inlinestatic |
Creates an owned image and fills every pixel with initValue.
| rows | Number of image rows. |
| columns | Number of image columns. |
| initValue | Value assigned to every pixel. |
| std::invalid_argument | If either dimension is not positive. |
| std::overflow_error | If rows * columns exceeds the supported size. |
|
inlinestatic |
Wraps external row-major memory without taking ownership.
The caller remains responsible for keeping rawPtr alive while the image wrapper is used.
| rawPtr | Pointer to rows * columns row-major pixels. |
| rows | Number of image rows. |
| columns | Number of image columns. |
| std::invalid_argument | If rawPtr is null or dimensions are invalid. |
| std::overflow_error | If rows * columns exceeds the supported size. |
|
inlinestatic |
Wraps row-major memory and takes ownership through delete[].
| rawPtr | Pointer allocated with new PixelType[]. |
| rows | Number of image rows. |
| columns | Number of image columns. |
| std::invalid_argument | If rawPtr is null or dimensions are invalid. |
| std::overflow_error | If rows * columns exceeds the supported size. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns mutable linear access to pixel index.
index is interpreted in row-major order as row * getNumColumns() + column. The operator does not perform bounds checking.
| index | Zero-based index. |
|
inline |
Returns immutable linear access to pixel index.
index is interpreted in row-major order as row * getNumColumns() + column. The operator does not perform bounds checking.
| index | Zero-based index. |
|
inline |
Returns a mutable pointer to the contiguous row-major buffer.
The pointer remains valid while the image object and its shared buffer are alive and no external owner invalidates externally wrapped memory.
|
inline |
Returns the shared pointer that owns or wraps the raw buffer.
The returned pointer shares the same ownership/lifetime policy as this image: either owning storage, externally wrapped storage, or adopted raw storage.