decl_block.hpp
1 #pragma once
2 
3 #include "../../global.hpp"
4 
5 #include "../../_detail/block/block_helper_linear_value.hpp"
6 #include "../../_detail/block/block_helper_ref_value.hpp"
7 #include "../../_detail/block/detail_block_point_helper.hpp"
8 
9 #include "decl_block_base.hpp"
10 
11 namespace Cvb
12 {
13  CVB_BEGIN_INLINE_NS
14 
22  template <class T, class ACCESSTRAIT>
23  class Block final : public BlockBase<ACCESSTRAIT>
24  {
25  template <class Ty, class OTHER_ACCESSTRAIT>
26  friend class Block;
27 
28  public:
29  using ComponentType = ComponentOfT<T>; // Type of one pixel.
30  using AccessTrait = ACCESSTRAIT; // Type of the access trait.
31  using PixelType = T; // Actual type T given as template argument.
32  using ConstPixelType = const T; // Const version of PixelType.
33 
35  static constexpr const bool IsPixelTypeMutable = true;
36 
37  private:
38  static constexpr const size_t NumComponents = NumComponentsOfV<T>;
39  static_assert(NumComponents > 0, "Cvb: NumComponents must be at least 1");
40 
42  template <class OTHER_ACCESSTRAIT>
43  explicit Block(const Block<T, OTHER_ACCESSTRAIT> &other, Cvb::Rect<int> aoi)
44  : BlockBase<ACCESSTRAIT>(other, aoi)
45  {
46  if (!IsAligned<PixelType>(other.Access()(0, 0))
47  || (aoi.Width() > 1 && !IsAligned<PixelType>(other.Access()(1, 0)))
48  || (aoi.Height() > 1 && !IsAligned<PixelType>(other.Access()(0, 1))))
49  throw std::runtime_error("Block-type and pointer must have the same alignment.");
50  }
51 
52  public:
54  explicit Block(ACCESSTRAIT access, Cvb::Size2D<int> size)
55  : BlockBase<ACCESSTRAIT>(std::move(access), std::move(size))
56  {
57  if (!IsAligned<PixelType>(access(0, 0)) || (size.Width() > 1 && !IsAligned<PixelType>(access(1, 0)))
58  || (size.Height() > 1 && !IsAligned<PixelType>(access(0, 1))))
59  throw std::runtime_error("Block-type and pointer must have the same alignment.");
60  }
61 
67  Block(const Block &other) noexcept = default;
68 
75  Block &operator=(const Block &other) noexcept = default;
76 
78  ~Block() = default;
79 
92  auto SubBlock(Cvb::Rect<int> aoi) const -> Block<T, decltype(this->Access().NewMoved(Cvb::Rect<int>{}))>
93  {
94  return Block<T, decltype(this->Access().NewMoved(Cvb::Rect<int>{}))>{*this, aoi};
95  }
96 
108  CVB_FORCE_INLINE const PixelType &operator()(int x, int y) const noexcept
109  {
110  return *reinterpret_cast<const PixelType *>(this->Access()(x, y));
111  }
112 
124  CVB_FORCE_INLINE PixelType &operator()(int x, int y) noexcept
125  {
126  static_assert(!std::is_const<typename std::remove_pointer<decltype(this->Access()(x, y))>::type>::value,
127  "The underlying access does not support mutable access. Make the Block const.");
128  return *reinterpret_cast<PixelType *>(this->Access()(x, y));
129  }
130 
131  private:
132  template <class PTy, size_t... I>
133  CVB_FORCE_INLINE static void SetElements(PixelType &pt, const PTy &value, std::index_sequence<I...>) noexcept
134  {
135  using expander =
136  int[]; // fold expression support for pre C++17 standards.. explanation see FillPixelValueElements.
137 
138  expander{0, (set<I>(pt, get<I>(value)), 0)...};
139  }
140 
141  public:
156  template <class FromPixelType>
157  CVB_FORCE_INLINE auto Set(int x, int y, const FromPixelType &value) noexcept
158  -> std::enable_if_t<!std::is_convertible<remove_cvref_t<FromPixelType>, remove_cvref_t<PixelType>>::value, void>
159  {
160  static_assert(!std::is_const<typename std::remove_pointer<decltype(this->Access()(x, y))>::type>::value,
161  "The underlying access does not support mutable access.");
162  static_assert(NumComponentsOfV<FromPixelType> >= NumComponents || NumComponentsOfV<FromPixelType> == -1,
163  "Incoming value must have at least as many components as current value.");
164 
165  SetElements(*reinterpret_cast<PixelType *>(this->Access()(x, y)), value,
166  std::make_index_sequence<NumComponents>{});
167  }
168 
170  CVB_FORCE_INLINE void Set(int x, int y, const PixelType &value) noexcept
171  {
172  static_assert(!std::is_const<typename std::remove_pointer<decltype(this->Access()(x, y))>::type>::value,
173  "The underlying access does not support mutable access.");
174  *reinterpret_cast<PixelType *>(this->Access()(x, y)) = value;
175  }
176 
187  CVB_FORCE_INLINE const PixelType &operator[](int idx) const noexcept
188  {
189  return *reinterpret_cast<const PixelType *>(this->Access()[idx]);
190  }
191 
202  CVB_FORCE_INLINE PixelType &operator[](int idx) noexcept
203  {
204  static_assert(!std::is_const<typename std::remove_pointer<decltype(this->Access()[idx])>::type>::value,
205  "The underlying access does not support mutable access. Make the Block const.");
206  return *reinterpret_cast<PixelType *>(this->Access()[idx]);
207  }
208 
222  template <class FromPixelType>
223  CVB_FORCE_INLINE auto Set(int idx, const FromPixelType &value) noexcept
224  -> std::enable_if_t<!std::is_convertible<remove_cvref_t<FromPixelType>, remove_cvref_t<PixelType>>::value, void>
225  {
226  static_assert(!std::is_const<typename std::remove_pointer<decltype(this->Access()[idx])>::type>::value,
227  "The underlying access does not support mutable access.");
228  static_assert(NumComponentsOfV<FromPixelType> >= NumComponents || NumComponentsOfV<FromPixelType> == -1,
229  "Incoming value must have at least as many components as current value.");
230 
231  SetElements(*reinterpret_cast<PixelType *>(this->Access()[idx]), value,
232  std::make_index_sequence<NumComponents>{});
233  }
234 
236  CVB_FORCE_INLINE void Set(int idx, const PixelType &value) noexcept
237  {
238  static_assert(!std::is_const<typename std::remove_pointer<decltype(this->Access()[idx])>::type>::value,
239  "The underlying access does not support mutable access.");
240  *reinterpret_cast<PixelType *>(this->Access()[idx]) = value;
241  }
242 
244  class Row
245  {
246  friend class Block;
247 
248  using AccessRow = typename AccessTrait::Row;
249 
250  AccessRow row_;
251 
257  Row(AccessRow row) noexcept
258  : row_(row)
259  {
260  }
261 
262  public:
264  Row() = default;
265 
267  Row(const Row &) = default;
268 
274  Row &operator=(const Row &) = default;
275 
285  CVB_FORCE_INLINE PixelType &operator[](int x) noexcept
286  {
287  static_assert(!std::is_const<typename std::remove_pointer<decltype(row_[x])>::type>::value,
288  "The underlying access does not support mutable access. Make the Row const.");
289  return *reinterpret_cast<PixelType *>(row_[x]);
290  }
291 
301  CVB_FORCE_INLINE const PixelType &operator[](int x) const noexcept
302  {
303  return *reinterpret_cast<const PixelType *>(row_[x]);
304  }
305 
318  template <class FromPixelType>
319  CVB_FORCE_INLINE auto Set(int x, const FromPixelType &value) noexcept
320  -> std::enable_if_t<!std::is_convertible<remove_cvref_t<FromPixelType>, remove_cvref_t<PixelType>>::value,
321  void>
322  {
323  static_assert(!std::is_const<typename std::remove_pointer<decltype(row_[x])>::type>::value,
324  "The underlying access does not support mutable access.");
325  static_assert(NumComponentsOfV<FromPixelType> >= NumComponents || NumComponentsOfV<FromPixelType> == -1,
326  "Incoming value must have at least as many components as current value.");
327 
328  SetElements(*reinterpret_cast<PixelType *>(row_[x]), value, std::make_index_sequence<NumComponents>{});
329  }
330 
332  CVB_FORCE_INLINE void Set(int x, const PixelType &value) noexcept
333  {
334  static_assert(!std::is_const<typename std::remove_pointer<decltype(row_[0])>::type>::value,
335  "The underlying access does not support mutable access.");
336  *reinterpret_cast<PixelType *>(row_[x]) = value;
337  }
338  };
339 
341  class Column
342  {
343  friend class Block;
344 
345  using AccessColumn = typename AccessTrait::Column;
346 
347  AccessColumn col_;
348 
354  Column(AccessColumn col) noexcept
355  : col_(col)
356  {
357  }
358 
359  public:
361  Column() = default;
362 
364  Column(const Column &) = default;
365 
371  Column &operator=(const Column &) = default;
372 
382  CVB_FORCE_INLINE PixelType &operator[](int y) noexcept
383  {
384  static_assert(!std::is_const<typename std::remove_pointer<decltype(col_[y])>::type>::value,
385  "The underlying access does not support mutable access. Make the Column const.");
386  return *reinterpret_cast<PixelType *>(col_[y]);
387  }
388 
398  CVB_FORCE_INLINE const PixelType &operator[](int y) const noexcept
399  {
400  return *reinterpret_cast<const PixelType *>(col_[y]);
401  }
402 
415  template <class FromPixelType>
416  CVB_FORCE_INLINE auto Set(int y, const FromPixelType &value) noexcept
417  -> std::enable_if_t<!std::is_convertible<remove_cvref_t<FromPixelType>, remove_cvref_t<PixelType>>::value,
418  void>
419  {
420  static_assert(!std::is_const<typename std::remove_pointer<decltype(col_[y])>::type>::value,
421  "The underlying access does not support mutable access.");
422  static_assert(NumComponentsOfV<FromPixelType> >= NumComponents || NumComponentsOfV<FromPixelType> == -1,
423  "Incoming value must have at least as many components as current value.");
424 
425  SetElements(*reinterpret_cast<PixelType *>(col_[y]), value, std::make_index_sequence<NumComponents>{});
426  }
427 
429  CVB_FORCE_INLINE void Set(int y, const PixelType &value) noexcept
430  {
431  static_assert(!std::is_const<typename std::remove_pointer<decltype(this->row_[0])>::type>::value,
432  "The underlying access does not support mutable access.");
433  *reinterpret_cast<PixelType *>(col_[y]) = value;
434  }
435  };
436 
446  Row RowAt(int y) const noexcept
447  {
448  return {this->Access().RowAt(y)};
449  }
450 
460  Column ColumnAt(int x) const noexcept
461  {
462  return {this->Access().ColumnAt(x)};
463  }
464  };
465 
466  // specialization for ScatterAccess
467  template <class T, int K>
468  class Block<T, ScatterAccess<K>> final : public BlockBase<ScatterAccess<K>>
469  {
470  template <class Ty, class OTHER_ACCESSTRAIT>
471  friend class Block;
472 
473  public:
474  using ComponentType = ComponentOfT<T>;
475  using AccessTrait = ScatterAccess<K>;
476  using PixelType = T;
477  using ConstPixelType =
479  const ConstRefValue<ComponentType, K>,
480  const PixelType>::type;
481 
482  static constexpr const bool IsPixelTypeMutable =
484 
486  private:
488  explicit Block(const Block &other, Cvb::Rect<int> aoi)
489  : BlockBase<ScatterAccess<K>>(other, aoi)
490  {
491  }
492 
493  public:
495  explicit Block(AccessTrait access, Cvb::Size2D<int> size)
496  : BlockBase<AccessTrait>(std::move(access), std::move(size))
497  {
498  }
499 
505  Block(const Block &other) noexcept = default;
506 
513  Block &operator=(const Block &other) noexcept = default;
514 
516  ~Block() = default;
517 
530  auto SubBlock(Cvb::Rect<int> aoi) const -> Block<T, decltype(this->Access().NewMoved(Cvb::Rect<int>{}))>
531  {
532  return Block<T, decltype(this->Access().NewMoved(Cvb::Rect<int>{}))>{*this, aoi};
533  }
534 
535  private:
543  template <class PTy, class Ty, size_t... I>
544  static CVB_FORCE_INLINE PTy FillPixelValueElements(Ty addresses, std::index_sequence<I...>) noexcept
545  {
546  // JMe: as C++14 does not yet support fold expressions, which would make this a bit more straight forward I had to
547  // go with this weird version As `I` is a template parameter pack, it has to be expanded with the ... operator.
548  // But this is only possible in contexts, where a list of `xxx, yyy, zzz` is allowed, as the ... operator joins
549  // the expression before it with commas. One such context where it is possible to expand the parameter pack, is
550  // array initialization as used here. The array is unnamed, to make clear to the compiler, that the array can be
551  // optimized away. If `set` returned something it could be as short as: int[]{internal_set<I>(value,
552  // reinterpret_cast<const ComponentType*>(addresses[I]))...}; this just calls set<0>, set<1>, set<2>,... with the
553  // corresponding address and "stores" the return values in the array (which will be discarded anyway). As `set`
554  // returns void, we need to utilize the comma operator, which evaluates the expression left of the operator but
555  // discards its value and returns the value on the right of the comma (an int). E.g. after `int i = 200; int x =
556  // i++, 0;` i == 201 and x == 0. Therefore the expression down there just calls set<I> for all I in 0 to K - 1
557  // with the corresponding address.
558 
559  using expander = int[]; // fold expression support for pre C++17 standards..
560 
561  using CType = typename std::conditional<std::is_const<PTy>::value, const ComponentType, ComponentType>::type;
562  typename std::remove_const<PTy>::type value;
563  expander{0, ((void)internal_set<I>(value, reinterpret_cast<CType *>(addresses[I])), 0)...};
564  return value;
565  }
566 
568  template <class PTy, class Ty>
569  static CVB_FORCE_INLINE PTy FillPixelValue(Ty addresses) noexcept
570  {
571  return FillPixelValueElements<PTy>(addresses, std::make_index_sequence<K>());
572  }
573 
580  template <class Ty, class PTy, size_t... I>
581  CVB_FORCE_INLINE static void SetElements(Ty addresses, const PTy &value, std::index_sequence<I...>) noexcept
582  {
583  // fold expression support for pre C++17 standards.. explanation see FillPixelValueElements.
584  using expander = int[];
585 
586  expander{0, (*reinterpret_cast<ComponentType *>(addresses[I]) = get<I>(value), 0)...};
587  }
588 
589  public:
601  CVB_FORCE_INLINE ConstPixelType operator()(int x, int y) const noexcept
602  {
603  auto addresses = this->Access()(x, y);
604  return FillPixelValue<ConstPixelType>(addresses);
605  }
606 
618  template <bool ENABLE = IsPixelTypeMutable, std::enable_if_t<ENABLE, int> = 0>
619  CVB_FORCE_INLINE PixelType operator()(int x, int y) noexcept
620  {
621  auto addresses = this->Access()(x, y);
622  return FillPixelValue<PixelType>(addresses);
623  }
624 
639  template <class FromPixelType>
640  CVB_FORCE_INLINE auto Set(int x, int y, const FromPixelType &value) noexcept
641  -> std::enable_if_t<!std::is_convertible<remove_cvref_t<FromPixelType>, remove_cvref_t<PixelType>>::value, void>
642  {
643  auto addresses = this->Access()(x, y);
644  SetElements(addresses, value, std::make_index_sequence<K>());
645  }
646 
648  CVB_FORCE_INLINE void Set(int x, int y, const PixelType &value) noexcept
649  {
650  auto addresses = this->Access()(x, y);
651  SetElements(addresses, value, std::make_index_sequence<K>());
652  }
653 
664  CVB_FORCE_INLINE ConstPixelType operator[](int idx) const noexcept
665  {
666  auto addresses = this->Access()[idx];
667  return FillPixelValue<ConstPixelType>(addresses);
668  }
669 
680  template <bool ENABLE = IsPixelTypeMutable, std::enable_if_t<ENABLE, int> = 0>
681  CVB_FORCE_INLINE PixelType operator[](int idx) noexcept
682  {
683  auto addresses = this->Access()[idx];
684  return FillPixelValue<PixelType>(addresses);
685  }
686 
700  template <class FromPixelType>
701  CVB_FORCE_INLINE auto Set(int idx, const FromPixelType &value) noexcept
702  -> std::enable_if_t<!std::is_convertible<remove_cvref_t<FromPixelType>, remove_cvref_t<PixelType>>::value, void>
703  {
704  auto addresses = this->Access()[idx];
705  SetElements(addresses, value, std::make_index_sequence<K>());
706  }
707 
709  CVB_FORCE_INLINE void Set(int idx, const PixelType &value) noexcept
710  {
711  auto addresses = this->Access()[idx];
712  SetElements(addresses, value, std::make_index_sequence<K>());
713  }
714 
716  class Row
717  {
718  friend class Block;
719 
720  using AccessRow = typename AccessTrait::Row;
721 
722  AccessRow row_;
723 
729  Row(AccessRow row) noexcept
730  : row_(row)
731  {
732  }
733 
734  public:
736  Row() = default;
737 
739  Row(const Row &) = default;
740 
746  Row &operator=(const Row &) = default;
747 
757  template <bool ENABLE = IsPixelTypeMutable, std::enable_if_t<ENABLE, int> = 0>
758  CVB_FORCE_INLINE PixelType operator[](int x) noexcept
759  {
760  auto addresses = row_[x];
761  return FillPixelValue<PixelType>(addresses);
762  }
763 
773  CVB_FORCE_INLINE ConstPixelType operator[](int x) const noexcept
774  {
775  auto addresses = row_[x];
776  return FillPixelValue<ConstPixelType>(addresses);
777  }
778 
791  template <class FromPixelType>
792  CVB_FORCE_INLINE auto Set(int x, const FromPixelType &value) noexcept
793  -> std::enable_if_t<!std::is_convertible<remove_cvref_t<FromPixelType>, remove_cvref_t<PixelType>>::value,
794  void>
795  {
796  auto addresses = row_[x];
797  SetElements(addresses, value, std::make_index_sequence<K>());
798  }
799 
801  CVB_FORCE_INLINE void Set(int x, const PixelType &value) noexcept
802  {
803  auto addresses = row_[x];
804  SetElements(addresses, value, std::make_index_sequence<K>());
805  }
806  };
807 
809  class Column
810  {
811  friend class Block;
812 
813  using AccessColumn = typename AccessTrait::Column;
814 
815  AccessColumn col_;
816 
822  Column(AccessColumn col) noexcept
823  : col_(col)
824  {
825  }
826 
827  public:
829  Column() = default;
830 
832  Column(const Column &) = default;
833 
839  Column &operator=(const Column &) = default;
840 
850  template <bool ENABLE = IsPixelTypeMutable, std::enable_if_t<ENABLE, int> = 0>
851  CVB_FORCE_INLINE PixelType operator[](int y) noexcept
852  {
853  auto addresses = col_[y];
854  return FillPixelValue<PixelType>(addresses);
855  }
856 
866  CVB_FORCE_INLINE ConstPixelType operator[](int y) const noexcept
867  {
868  auto addresses = col_[y];
869  return FillPixelValue<ConstPixelType>(addresses);
870  }
871 
884  template <class FromPixelType>
885  CVB_FORCE_INLINE auto Set(int y, const FromPixelType &value) noexcept
886  -> std::enable_if_t<!std::is_convertible<remove_cvref_t<FromPixelType>, remove_cvref_t<PixelType>>::value,
887  void>
888  {
889  auto addresses = col_[y];
890  SetElements(addresses, value, std::make_index_sequence<K>());
891  }
892 
894  CVB_FORCE_INLINE void Set(int y, const PixelType &value) noexcept
895  {
896  auto addresses = col_[y];
897  SetElements(addresses, value, std::make_index_sequence<K>());
898  }
899  };
900 
910  Row RowAt(int y) const noexcept
911  {
912  return {this->Access().RowAt(y)};
913  }
914 
924  Column ColumnAt(int x) const noexcept
925  {
926  return {this->Access().ColumnAt(x)};
927  }
928  };
929 
936  template <class T>
938 
945  template <class T>
947 
954  template <class T>
956 
963  template <class T, size_t K>
965 
966  CVB_END_INLINE_NS
967 } // namespace Cvb
Row()=default
Default ctor.
T Width() const noexcept
Gets the width of the rectangle.
Definition: rect.hpp:171
T Height() const noexcept
Gets the vertical component of the size.
Definition: size_2d.hpp:79
Column()=default
Default ctor.
CVB_FORCE_INLINE auto Set(int y, const FromPixelType &value) noexcept -> std::enable_if_t<!std::is_convertible< remove_cvref_t< FromPixelType >, remove_cvref_t< PixelType >>::value, void >
Row setter.
Definition: decl_block.hpp:885
CVB_FORCE_INLINE ConstPixelType operator[](int y) const noexcept
Row access.
Definition: decl_block.hpp:866
~Block()=default
Default dtor.
CVB_FORCE_INLINE void Set(int x, const PixelType &value) noexcept
Column setter.
Definition: decl_block.hpp:801
Row & operator=(const Row &)=default
Copy assignment.
Non-owning view on a 2d-plane of data.
Definition: decl_block.hpp:23
A single row.
Definition: decl_block.hpp:244
Block(ACCESSTRAIT access, Cvb::Size2D< int > size)
Base class for all typed Cvb::Block types.
Definition: decl_block.hpp:54
A single row.
Definition: decl_scatter_access.hpp:269
Base class for all typed Cvb::Block types.
Definition: decl_block_base.hpp:24
CVB_FORCE_INLINE void Set(int idx, const PixelType &value) noexcept
Index setter.
Definition: decl_block.hpp:236
CVB_FORCE_INLINE PixelType & operator[](int y) noexcept
Row access.
Definition: decl_block.hpp:382
CVB_FORCE_INLINE PixelType & operator[](int x) noexcept
Column access.
Definition: decl_block.hpp:285
CVB_FORCE_INLINE const PixelType & operator[](int x) const noexcept
Column access.
Definition: decl_block.hpp:301
CVB_FORCE_INLINE auto Set(int idx, const FromPixelType &value) noexcept -> std::enable_if_t<!std::is_convertible< remove_cvref_t< FromPixelType >, remove_cvref_t< PixelType >>::value, void >
Index setter.
Definition: decl_block.hpp:223
CVB_FORCE_INLINE void Set(int x, const PixelType &value) noexcept
Column setter.
Definition: decl_block.hpp:332
CVB_FORCE_INLINE ConstPixelType operator[](int x) const noexcept
Column access.
Definition: decl_block.hpp:773
A single column.
Definition: decl_scatter_access.hpp:372
CVB_FORCE_INLINE auto Set(int y, const FromPixelType &value) noexcept -> std::enable_if_t<!std::is_convertible< remove_cvref_t< FromPixelType >, remove_cvref_t< PixelType >>::value, void >
Row setter.
Definition: decl_block.hpp:416
CVB_FORCE_INLINE void Set(int y, const PixelType &value) noexcept
Row setter.
Definition: decl_block.hpp:429
Root namespace for the Image Manager interface.
Definition: version.hpp:11
CVB_FORCE_INLINE PixelType & operator[](int idx) noexcept
Coordinate pixel access operator.
Definition: decl_block.hpp:202
CVB_FORCE_INLINE auto Set(int x, int y, const FromPixelType &value) noexcept -> std::enable_if_t<!std::is_convertible< remove_cvref_t< FromPixelType >, remove_cvref_t< PixelType >>::value, void >
Coordinate setter.
Definition: decl_block.hpp:157
Column ColumnAt(int x) const noexcept
Gets the Block::Column at x.
Definition: decl_block.hpp:460
CVB_FORCE_INLINE PixelType operator[](int x) noexcept
Column access.
Definition: decl_block.hpp:758
CVB_FORCE_INLINE const ACCESSTRAIT & Access() const noexcept
Gets the pixel access.
Definition: decl_block_base.hpp:101
auto SubBlock(Cvb::Rect< int > aoi) const -> Block< T, decltype(this->Access().NewMoved(Cvb::Rect< int >
Creates a new sub Block from this block.
Definition: decl_block.hpp:92
static constexpr const bool IsPixelTypeMutable
! Indicates whether the returned values of operator(x,y) or operator[idx] are mutable.
Definition: decl_block.hpp:35
T move(T... args)
CVB_FORCE_INLINE PixelType & operator()(int x, int y) noexcept
Coordinate pixel access operator.
Definition: decl_block.hpp:124
Row RowAt(int y) const noexcept
Gets the Block::Row at y.
Definition: decl_block.hpp:446
T Height() const noexcept
Gets the height of the rectangle.
Definition: rect.hpp:191
CVB_FORCE_INLINE auto Set(int x, const FromPixelType &value) noexcept -> std::enable_if_t<!std::is_convertible< remove_cvref_t< FromPixelType >, remove_cvref_t< PixelType >>::value, void >
Column setter.
Definition: decl_block.hpp:319
Block< T, ScatterAccess< K > > ScatterBlock
A Cvb::Block of variant planes.
Definition: decl_block.hpp:964
Column & operator=(const Column &)=default
Copy assignment.
CVB_FORCE_INLINE PixelType operator[](int y) noexcept
Row access.
Definition: decl_block.hpp:851
CVB_FORCE_INLINE const PixelType & operator()(int x, int y) const noexcept
Coordinate pixel access operator.
Definition: decl_block.hpp:108
CVB_FORCE_INLINE void Set(int x, int y, const PixelType &value) noexcept
Coordinate setter.
Definition: decl_block.hpp:170
CVB_FORCE_INLINE void Set(int y, const PixelType &value) noexcept
Row setter.
Definition: decl_block.hpp:894
A single column.
Definition: decl_block.hpp:341
CVB_FORCE_INLINE auto Set(int x, const FromPixelType &value) noexcept -> std::enable_if_t<!std::is_convertible< remove_cvref_t< FromPixelType >, remove_cvref_t< PixelType >>::value, void >
Column setter.
Definition: decl_block.hpp:792
Block & operator=(const Block &other) noexcept=default
Copy operator.
T Width() const noexcept
Gets the horizontal component of the size.
Definition: size_2d.hpp:59
CVB_FORCE_INLINE const PixelType & operator[](int idx) const noexcept
Index pixel access operator.
Definition: decl_block.hpp:187
CVB_FORCE_INLINE const PixelType & operator[](int y) const noexcept
Row access.
Definition: decl_block.hpp:398