cvw::ImageMutView
Mutable, non-owning view over image pixel data. More...
#include <image_view.hpp>
Public Types
| Name | |
|---|---|
| using typename F::value_type | value_type Scalar element type derived from the pixel format. |
Public Functions
| Name | |
|---|---|
| ImageMutView() =default Default-constructs a null view. | |
| ImageMutView(value_type * data, int width, int height, size_t stride) Constructs a mutable view from a pointer and dimensions. | |
| int | width() const Returns the image width in pixels. |
| int | height() const Returns the image height in pixels. |
| constexprint | channels() const Returns the number of channels determined by the format. |
| size_t | stride() const Returns the row stride in elements. |
| bool | empty() const Checks whether the view references no data. |
| value_type * | data() Returns a mutable pointer to pixel data. |
| constvalue_type * | data() const Returns a const pointer to pixel data. |
| value_type & | at(int row, int col, int ch =0) Accesses a specific pixel channel by coordinates. |
| ImageView<F> | as_const_view() const Converts this mutable view to a read-only ImageView. |
Detailed Description
template <is_pixel_format F>
class cvw::ImageMutView;Mutable, non-owning view over image pixel data.
Template Parameters:
- F Pixel format tag satisfying is_pixel_format.
Since: 1.0.0
Note: Not thread-safe unless externally synchronized.
Provides read-write access to an external pixel buffer. Does not manage the underlying memory; the caller must ensure the buffer outlives the view.
cvw::Image<cvw::Gray> img(640, 480);
auto mv = img.mutable_view();
mv.at(0, 0) = 128;Public Types Documentation
using value_type
using cvw::ImageMutView<F>::value_type = typename F::value_type;Scalar element type derived from the pixel format.
Public Functions Documentation
function ImageMutView
ImageMutView() =defaultDefault-constructs a null view.
Since: 1.0.0
function ImageMutView
inline ImageMutView(
value_type * data,
int width,
int height,
size_t stride
)Constructs a mutable view from a pointer and dimensions.
Parameters:
- data Pointer to the first pixel element. Must be non-null if width * height > 0.
- width Image width in pixels.
- height Image height in pixels.
- stride Row stride in elements (not bytes).
Since: 1.0.0
function width
inline int width() constReturns the image width in pixels.
Return: Width in pixels.
Since: 1.0.0
function height
inline int height() constReturns the image height in pixels.
Return: Height in pixels.
Since: 1.0.0
function channels
inline constexprint channels() constReturns the number of channels determined by the format.
Return: Channel count (compile-time constant).
Since: 1.0.0
function stride
inline size_t stride() constReturns the row stride in elements.
Return: Stride in elements (not bytes).
Since: 1.0.0
function empty
inline bool empty() constChecks whether the view references no data.
Return: True if the data pointer is null.
Since: 1.0.0
function data
inline value_type * data()Returns a mutable pointer to pixel data.
Return: Mutable pointer to the first element.
Since: 1.0.0
function data
inline constvalue_type * data() constReturns a const pointer to pixel data.
Return: Const pointer to the first element.
Since: 1.0.0
function at
inline value_type & at(
int row,
int col,
int ch =0
)Accesses a specific pixel channel by coordinates.
Parameters:
- row Row index. Unit: pixels. Valid range: 0, height).
- col Column index. Unit: pixels. Valid range: [0, width).
- ch Channel index. Default: 0.
Exceptions:
- None (no bounds checking).
Return: Mutable reference to the channel value.
Since: 1.0.0
Warning: Undefined behavior for out-of-range indices.
function as_const_view
inline ImageView<F> as_const_view() constConverts this mutable view to a read-only [ImageView.
Return: An ImageView referencing the same pixel buffer.
Since: 1.0.0
Updated on 2026-05-17 at 13:22:38 +0000