#include <include/spice-lib/color_view.hpp>
template<typename T>
color_view class
Wrapper around color data of arbitrary length with arbitrary stride between channel samples.
Template parameters | |
---|---|
T |
Contents
Public types
- using value_type = T
- Alias for the type used to represent individual pixel values.
Constructors, destructors, conversion operators
- color_view() constexpr
- Construct a new, empty color_
view object. -
color_view(color_
view const& other) defaulted constexpr - Create a copy of the given color_
view object. -
color_view(color_
view&& other) defaulted constexpr - Move the the given color_
view object. - color_view(T*const data, size_t stride, size_t channels) constexpr
- Construct a new color_
view object referring to the given data.
Public functions
-
auto operator=(color_
view const& other) -> color_ view& defaulted noexcept - Copy-assigns another color_
view. -
auto operator=(color_
view&& other) -> color_ view& defaulted noexcept - Move-assigns another color_
view. -
auto operator=(T const& value) -> color_
view& noexcept - Assign each channel the provided value.
- void reset()
- Replaces the reference with a nullptr reference and resets the stride and size to 0.
-
void reset(color_
view const& other) - Replaces the reference with the reference held by
other
and adjusts the size accordingly. - void reset(T*const data, size_t stride, size_t channels)
- Replaces the reference to refer to
data
and updates the stride and channel count. - auto size() const -> size_t constexpr
- Returns the channel count.
- auto channels() const -> size_t constexpr
- Returns the channel count.
- auto stride() const -> size_t constexpr
- Returns the stride.
- auto data() -> T*const constexpr
- Returns the data pointer.
- auto data() const -> T const *const constexpr
- Returns the data pointer.
- auto operator[](size_t index) -> T&
- Retrieve a reference to an element of the color_
view. - auto operator[](size_t index) const -> T const &
- Retrieve a constant reference to an element of the color_
view. -
auto operator+=(color_
view const& rhs) -> color_ view& - Add
rhs
to this color_view channel-wise. -
auto operator+=(T const& rhs) -> color_
view& - Add
rhs
to this color_view channel-wise. -
auto operator-=(color_
view const& rhs) -> color_ view& - Subtract
rhs
from this color_view channel-wise. -
auto operator-=(T const& rhs) -> color_
view& - Subtract
rhs
from this color_view channel-wise. -
auto operator*=(color_
view const& rhs) -> color_ view& - Multiply this color_
view with rhs
channel-wise. -
auto operator*=(T const& rhs) -> color_
view& - Multiply this color_
view with rhs
channel-wise. -
auto operator/=(color_
view const& rhs) -> color_ view& - Divide this color_
view by rhs
channel-wise. -
auto operator/=(T const& rhs) -> color_
view& - Divide this color_
view by rhs
channel-wise.
Friends
-
template<typename T_other>auto operator==(T_other const& lhs, color_
view const& rhs) -> std::enable_if_t<std::is_scalar<T_other>::value, bool> - Compares a color_
view component-wise with a scalar. -
template<typename T_other>auto operator==(color_
view const& lhs, T_other const& rhs) -> std::enable_if_t<std::is_scalar<T_other>::value, bool> - Compares a color_
view component-wise with a scalar. -
template<typename T_other>auto operator!=(T_other const& lhs, color_
view const& rhs) -> std::enable_if_t<std::is_scalar<T_other>::value, bool> - Compares a color_
view component-wise with a scalar for inequality. -
template<typename T_other>auto operator!=(color_
view const& lhs, T_other const& rhs) -> std::enable_if_t<std::is_scalar<T_other>::value, bool> - Compares a color_
view component-wise with a scalar for inequality. -
auto operator==(color_
view const& lhs, color_ view const& rhs) -> bool - Compares two color_views for equality.
-
auto operator!=(color_
view const& lhs, color_ view const& rhs) -> bool - Compares two color_views for inequality.
-
template<typename T_other>auto operator==(T_other const& lhs, color_
view const& rhs) -> std::enable_if_t<!std::is_same<color_ view, T_other>::value && !std::is_scalar<T_other>::value, bool> - Compares two color_views.
-
template<typename T_other>auto operator!=(color_
view const& lhs, T_other const& rhs) -> std::enable_if_t<!std::is_same<color_ view, T_other>::value && !std::is_scalar<T_other>::value, bool> - Compares two color_views for inequality.
-
template<typename T_other>auto operator==(color_
view const& lhs, T_other const& rhs) -> std::enable_if_t<!std::is_same<color_ view, T_other>::value && !std::is_scalar<T_other>::value, bool> - Compares two color_views.
-
template<typename T_other>auto operator!=(T_other const& lhs, color_
view const& rhs) -> std::enable_if_t<!std::is_same<color_ view, T_other>::value && !std::is_scalar<T_other>::value, bool> - Compares two color_views for inequality.
-
auto operator+(color_
view lhs, color_ view const& rhs) -> color_ view - Add
rhs
tolhs
channel-wise. -
auto operator+(color_
view lhs, T const& rhs) -> color_ view - Add
rhs
tolhs
channel-wise. -
auto operator-(color_
view lhs, color_ view const& rhs) -> color_ view - Subtract
rhs
fromlhs
channel-wise. -
auto operator-(color_
view lhs, T const& rhs) -> color_ view - Subtract
rhs
fromlhs
channel-wise. -
auto operator*(color_
view lhs, color_ view const& rhs) -> color_ view - Multiply
lhs
withrhs
channel-wise. -
auto operator*(color_
view lhs, T const& rhs) -> color_ view - Multiply
lhs
withrhs
channel-wise. -
auto operator/(color_
view lhs, color_ view const& rhs) -> color_ view - Divide
lhs
byrhs
channel-wise. -
auto operator/(color_
view lhs, T const& rhs) -> color_ view - Divide
lhs
byrhs
channel-wise.
Function documentation
template<typename T>
spice:: color_view<T>:: color_view() constexpr
Construct a new, empty color_
Before the color_color_
.
template<typename T>
spice:: color_view<T>:: color_view(color_ view const& other) defaulted constexpr
Create a copy of the given color_
Parameters | |
---|---|
other | The color_ |
template<typename T>
spice:: color_view<T>:: color_view(color_ view&& other) defaulted constexpr
Move the the given color_
Parameters | |
---|---|
other | The color_ |
template<typename T>
spice:: color_view<T>:: color_view(T*const data,
size_t stride,
size_t channels) constexpr
Construct a new color_
Parameters | |
---|---|
data | |
stride | The distance between the channels |
channels | The number of channels this color_ |
template<typename T>
color_ view& spice:: color_view<T>:: operator=(color_ view const& other) defaulted noexcept
Copy-assigns another color_
Parameters | |
---|---|
other | |
Returns | color_ |
template<typename T>
color_ view& spice:: color_view<T>:: operator=(color_ view&& other) defaulted noexcept
Move-assigns another color_
Parameters | |
---|---|
other | |
Returns | color_ |
template<typename T>
color_ view& spice:: color_view<T>:: operator=(T const& value) noexcept
Assign each channel the provided value.
Parameters | |
---|---|
value | |
Returns | color_ |
template<typename T>
void spice:: color_view<T>:: reset(color_ view const& other)
Replaces the reference with the reference held by other
and adjusts the size accordingly.
Parameters | |
---|---|
other |
template<typename T>
size_t spice:: color_view<T>:: size() const constexpr
Returns the channel count.
Returns | size_t |
---|
template<typename T>
size_t spice:: color_view<T>:: channels() const constexpr
Returns the channel count.
Returns | size_t |
---|
template<typename T>
size_t spice:: color_view<T>:: stride() const constexpr
Returns the stride.
Returns | size_t |
---|
template<typename T>
T*const spice:: color_view<T>:: data() constexpr
Returns the data pointer.
Returns | size_t |
---|
template<typename T>
T const *const spice:: color_view<T>:: data() const constexpr
Returns the data pointer.
Returns | size_t |
---|
template<typename T>
T& spice:: color_view<T>:: operator[](size_t index)
Retrieve a reference to an element of the color_
Parameters | |
---|---|
index | |
Returns | T& |
template<typename T>
T const & spice:: color_view<T>:: operator[](size_t index) const
Retrieve a constant reference to an element of the color_
Parameters | |
---|---|
index | |
Returns | T& |
template<typename T>
color_ view& spice:: color_view<T>:: operator+=(color_ view const& rhs)
Add rhs
to this color_
Parameters | |
---|---|
rhs | |
Returns | color_ |
template<typename T>
color_ view& spice:: color_view<T>:: operator+=(T const& rhs)
Add rhs
to this color_
Parameters | |
---|---|
rhs | |
Returns | color_ |
template<typename T>
color_ view& spice:: color_view<T>:: operator-=(color_ view const& rhs)
Subtract rhs
from this color_
Parameters | |
---|---|
rhs | |
Returns | color_ |
template<typename T>
color_ view& spice:: color_view<T>:: operator-=(T const& rhs)
Subtract rhs
from this color_
Parameters | |
---|---|
rhs | |
Returns | color_ |
template<typename T>
color_ view& spice:: color_view<T>:: operator*=(color_ view const& rhs)
Multiply this color_rhs
channel-wise.
Parameters | |
---|---|
rhs | |
Returns | color_ |
template<typename T>
color_ view& spice:: color_view<T>:: operator*=(T const& rhs)
Multiply this color_rhs
channel-wise.
Parameters | |
---|---|
rhs | |
Returns | color_ |
template<typename T>
color_ view& spice:: color_view<T>:: operator/=(color_ view const& rhs)
Divide this color_rhs
channel-wise.
Parameters | |
---|---|
rhs | |
Returns | color_ |
template<typename T>
color_ view& spice:: color_view<T>:: operator/=(T const& rhs)
Divide this color_rhs
channel-wise.
Parameters | |
---|---|
rhs | |
Returns | color_ |
template<typename T>
template<typename T_other>
std::enable_if_t<std::is_scalar<T_other>::value, bool> operator==(T_other const& lhs,
color_ view const& rhs)
Compares a color_
Template parameters | |
---|---|
T_other | A scalar that is comparable to the color_T |
Parameters | |
lhs | |
rhs | |
Returns | true if all elements of the color_ |
template<typename T>
template<typename T_other>
std::enable_if_t<std::is_scalar<T_other>::value, bool> operator==(color_ view const& lhs,
T_other const& rhs)
Compares a color_
Template parameters | |
---|---|
T_other | A scalar that is comparable to the color_T |
Parameters | |
lhs | |
rhs | |
Returns | true if all elements of the color_ |
template<typename T>
template<typename T_other>
std::enable_if_t<std::is_scalar<T_other>::value, bool> operator!=(T_other const& lhs,
color_ view const& rhs)
Compares a color_
Template parameters | |
---|---|
T_other | A scalar that is comparable to the color_T |
Parameters | |
lhs | |
rhs | |
Returns | true if any of the elements of the color_ |
template<typename T>
template<typename T_other>
std::enable_if_t<std::is_scalar<T_other>::value, bool> operator!=(color_ view const& lhs,
T_other const& rhs)
Compares a color_
Template parameters | |
---|---|
T_other | A scalar that is comparable to the color_T |
Parameters | |
lhs | |
rhs | |
Returns | true if any of the elements of the color_ |
template<typename T>
bool operator==(color_ view const& lhs,
color_ view const& rhs)
Compares two color_views for equality.
Parameters | |
---|---|
lhs | |
rhs | |
Returns | true if the two have the same number of elements with corresponding values, false otherwise |
template<typename T>
bool operator!=(color_ view const& lhs,
color_ view const& rhs)
Compares two color_views for inequality.
Parameters | |
---|---|
lhs | |
rhs | |
Returns | true if the two do not have the same number of elements or any of the values do not correspond, false otherwise |
template<typename T>
template<typename T_other>
std::enable_if_t<!std::is_same<color_ view, T_other>::value && !std::is_scalar<T_other>::value, bool> operator==(T_other const& lhs,
color_ view const& rhs)
Compares two color_views.
Template parameters | |
---|---|
T_other | A type implementing the subscript operator as well as a size member function |
Parameters | |
lhs | |
rhs | |
Returns | true if the two have the same number of elements with corresponding values, false otherwise |
template<typename T>
template<typename T_other>
std::enable_if_t<!std::is_same<color_ view, T_other>::value && !std::is_scalar<T_other>::value, bool> operator!=(color_ view const& lhs,
T_other const& rhs)
Compares two color_views for inequality.
Parameters | |
---|---|
lhs | |
rhs | |
Returns | true if the two do not have the same number of elements or any of the values do not correspond, false otherwise |
template<typename T>
template<typename T_other>
std::enable_if_t<!std::is_same<color_ view, T_other>::value && !std::is_scalar<T_other>::value, bool> operator==(color_ view const& lhs,
T_other const& rhs)
Compares two color_views.
Template parameters | |
---|---|
T_other | A type implementing the subscript operator as well as a size member function |
Parameters | |
lhs | |
rhs | |
Returns | true if the two have the same number of elements with corresponding values, false otherwise |
template<typename T>
template<typename T_other>
std::enable_if_t<!std::is_same<color_ view, T_other>::value && !std::is_scalar<T_other>::value, bool> operator!=(T_other const& lhs,
color_ view const& rhs)
Compares two color_views for inequality.
Parameters | |
---|---|
lhs | |
rhs | |
Returns | true if the two do not have the same number of elements or any of the values do not correspond, false otherwise |
template<typename T>
color_ view operator+(color_ view lhs,
color_ view const& rhs)
Add rhs
to lhs
channel-wise.
Parameters | |
---|---|
lhs | |
rhs | |
Returns | color_ |
template<typename T>
color_ view operator+(color_ view lhs,
T const& rhs)
Add rhs
to lhs
channel-wise.
Parameters | |
---|---|
lhs | |
rhs | |
Returns | color_ |
template<typename T>
color_ view operator-(color_ view lhs,
color_ view const& rhs)
Subtract rhs
from lhs
channel-wise.
Parameters | |
---|---|
lhs | |
rhs | |
Returns | color_ |
template<typename T>
color_ view operator-(color_ view lhs,
T const& rhs)
Subtract rhs
from lhs
channel-wise.
Parameters | |
---|---|
lhs | |
rhs | |
Returns | color_ |
template<typename T>
color_ view operator*(color_ view lhs,
color_ view const& rhs)
Multiply lhs
with rhs
channel-wise.
Parameters | |
---|---|
lhs | |
rhs | |
Returns | color_ |
template<typename T>
color_ view operator*(color_ view lhs,
T const& rhs)
Multiply lhs
with rhs
channel-wise.
Parameters | |
---|---|
lhs | |
rhs | |
Returns | color_ |
template<typename T>
color_ view operator/(color_ view lhs,
color_ view const& rhs)
Divide lhs
by rhs
channel-wise.
Parameters | |
---|---|
lhs | |
rhs | |
Returns | color_ |
template<typename T>
color_ view operator/(color_ view lhs,
T const& rhs)
Divide lhs
by rhs
channel-wise.
Parameters | |
---|---|
lhs | |
rhs | |
Returns | color_ |