7#include "../data_type.hpp"
9#include "../size_2d.hpp"
11#include "decl_access_base.hpp"
51 template <class PLANE_T>
90 return LinearAccessData{basePtr_ + newAoi.Top() * yInc_ + newAoi.Left() * xInc_, xInc_, yInc_, newAoi.Width()};
132 CVB_FORCE_INLINE
int Width() const noexcept
145 return this->basePtr_ !=
nullptr && this->xInc_ != 0 && this->yInc_ != 0 && this->width_ > 0;
149 explicit operator bool() const noexcept
151 return this->
Valid();
164 CVB_FORCE_INLINE
const void *
operator()(
int x,
int y)
const noexcept
166 return reinterpret_cast<const void *
>(this->basePtr_ + y * this->yInc_ + x * this->xInc_);
181 return reinterpret_cast<void *
>(this->basePtr_ + y * this->yInc_ + x * this->xInc_);
193 CVB_FORCE_INLINE
const void *
operator[](
int idx)
const noexcept
195 const int y = idx / this->width_;
196 const int x = idx % this->width_;
198 return reinterpret_cast<const void *
>(this->basePtr_ + y * this->yInc_ + x * this->xInc_);
212 const int y = idx / this->width_;
213 const int x = idx % this->width_;
215 return reinterpret_cast<void *
>(this->basePtr_ + y * this->yInc_ + x * this->xInc_);
250 Row(
const Row& other)
noexcept =
default;
251 Row& operator=(
const Row& other)
noexcept =
default;
252 Row(
Row&& other)
noexcept =
default;
253 Row& operator=(
Row&& other)
noexcept =
default;
267 return reinterpret_cast<void *
>(line0_ + x * xInc_);
279 CVB_FORCE_INLINE
const void *
operator[](
int x)
const noexcept
281 return reinterpret_cast<const void *
>(line0_ + x * xInc_);
318 Column& operator=(
const Column& other)
noexcept =
default;
335 return reinterpret_cast<void *
>(column0_ + y * yInc_);
347 CVB_FORCE_INLINE
const void *
operator[](
int y)
const noexcept
349 return reinterpret_cast<const void *
>(column0_ + y * yInc_);
364 return {basePtr_ + y * yInc_, xInc_};
378 return {basePtr_ + x * xInc_, yInc_};
390 template <class PLANE_T, std::enable_if_t<PlaneTraits<PLANE_T>::HasVpat,
int> = 0>
392 template <class PLANE_T, std::enable_if_t<!PlaneTraits<PLANE_T>::HasVpat,
int> = 0>
403 using LinearAccess = LinearAccessData;
415 return lhs.BasePtr() != rhs.BasePtr() || lhs.YInc() != rhs.YInc() || lhs.XInc() != rhs.XInc()
416 || lhs.Width() != rhs.Width();
429 return !(lhs != rhs);
439 return access0.BasePtr() + bytesPerPixel == access1.BasePtr() && access0.XInc() == access1.XInc()
440 && access0.YInc() == access1.YInc();
450 struct LinearAccessFindNonInterleaved
452 size_t bytesPerPixel;
469 return std::adjacent_find(accesses.cbegin(), accesses.cend(), Cvb::LinearAccessFindNonInterleaved{bytesPerPixel})
488 template <
class... ACCESSES>
490 const ACCESSES &... accs)
noexcept
493 return std::adjacent_find(arr.cbegin(), arr.cend(), LinearAccessFindNonInterleaved{bytesPerPixel}) == arr.cend();
Access trait for contiguous linear CVB image planes.
Definition: decl_array_access.hpp:27
Data type description for an image plane.
Definition: data_type.hpp:28
Image plane information container.
Definition: decl_image_plane.hpp:33
A single column.
Definition: decl_linear_access.hpp:290
CVB_FORCE_INLINE const void * operator[](int y) const noexcept
Value access.
Definition: decl_linear_access.hpp:347
CVB_FORCE_INLINE void * operator[](int y) noexcept
Value access.
Definition: decl_linear_access.hpp:333
Column() noexcept
Default ctor of invalid column.
Definition: decl_linear_access.hpp:310
A single row.
Definition: decl_linear_access.hpp:223
CVB_FORCE_INLINE void * operator[](int x) noexcept
Value access.
Definition: decl_linear_access.hpp:265
Row() noexcept
Default ctor of invalid row.
Definition: decl_linear_access.hpp:243
CVB_FORCE_INLINE const void * operator[](int x) const noexcept
Value access.
Definition: decl_linear_access.hpp:279
Linear access properties.
Definition: decl_linear_access.hpp:25
CVB_FORCE_INLINE void * operator[](int idx) noexcept
Index pixel access operator.
Definition: decl_linear_access.hpp:210
bool IsInterleaved(size_t bytesPerPixel, const LinearAccessData &access0, const LinearAccessData &access1, const ACCESSES &... accs) noexcept
Definition: decl_linear_access.hpp:489
std::intptr_t XInc() const noexcept
X-increment for linear access.
Definition: decl_linear_access.hpp:112
bool Valid() const noexcept
Gets whether this linear access object is valid.
Definition: decl_linear_access.hpp:143
bool IsInterleaved(size_t bytesPerPixel, const LinearAccessData &access0, const LinearAccessData &access1) noexcept
Definition: decl_linear_access.hpp:436
LinearAccessData() noexcept
Creates a default linear access data set.
bool operator==(const LinearAccessData &lhs, const LinearAccessData &rhs) noexcept
Equality operator.
Definition: decl_linear_access.hpp:427
static LinearAccessData FromPlane(const PLANE_T &plane) noexcept
Tries to get a valid LinearAccessData from the given plane.
Definition: detail_plane_access.hpp:40
CVB_FORCE_INLINE int Width() const noexcept
Gets the pixel width of the underlying plane.
Definition: decl_linear_access.hpp:132
LinearAccessData NewMoved(const Cvb::Rect< int > newAoi) const noexcept
Creates a new, moved linear access object.
Definition: decl_linear_access.hpp:88
static LinearAccessData FromPtr(std::uint8_t *basePtr, std::intptr_t xInc, std::intptr_t yInc, int width) noexcept
Creates LinearAccessData from the given pointer and increments.
Definition: decl_linear_access.hpp:74
std::intptr_t YInc() const noexcept
Y-increment for linear access.
Definition: decl_linear_access.hpp:122
std::uint8_t * BasePtr() const noexcept
Linear access base pointer.
Definition: decl_linear_access.hpp:102
CVB_FORCE_INLINE const void * operator()(int x, int y) const noexcept
Coordinate pixel access operator.
Definition: decl_linear_access.hpp:164
Row RowAt(int y) const noexcept
Gets the LinearAccessData::Row at y.
Definition: decl_linear_access.hpp:362
static LinearAccessData FromVpat(const Vpat &access, Cvb::Size2D< int > size, Cvb::DataType dataType) noexcept
Tries to get a valid LinearAccessData trait from the given vpat.
Definition: detail_plane_access.hpp:47
CVB_FORCE_INLINE void * operator()(int x, int y) noexcept
Coordinate pixel access operator.
Definition: decl_linear_access.hpp:179
Column ColumnAt(int x) const noexcept
Gets the LinearAccessData::Column at x.
Definition: decl_linear_access.hpp:376
CVB_FORCE_INLINE const void * operator[](int idx) const noexcept
Index pixel access operator.
Definition: decl_linear_access.hpp:193
Stores a pair of numbers that represents the width and the height of a subject, typically a rectangle...
Definition: size_2d.hpp:20
Common base class for access traits, providing typed Value access to planes.
Definition: decl_access_base.hpp:22
Virtual Pixel Access Table.
Definition: decl_vpat.hpp:24
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24