template<typename T>
spice::image class

spice's image class stores pixel data of arbitrary channel order and arbitrary channel semantics in channel, column, row order.

Thus, a 3x2 pixel BGR image would be stored in an 18 element vector where the first element represents the blue channel of the top left pixel, the second the green, the third the red and the fourth element would be the blue channel of the leftmost pixel of the second row.

Base classes

template<size_t Dimensions, typename T>
class nd_vector_impl<Dimensions, T, true>

Public static variables

static const constexpr range intensity_range

Constructors, destructors, conversion operators

image()
image(image const& other)
image(size_t width, size_t height, channel_list channel_semantics = {}, int alpha_channel = NO_ALPHA, T const& default_value = T{})
image(T*const data, size_t width, size_t height, channel_list channel_semantics = {}, int alpha_channel = NO_ALPHA)

Public functions

auto width() const -> size_t
auto height() const -> size_t
auto channels() const -> size_t
auto channel_semantics() const -> const channel_list&
auto alpha_channel() const -> int
The index of the alpha channel or NO_ALPHA if none is present.

Function documentation

template<typenameT>
spice::image<T>::image()

Constructs an empty image.

template<typenameT>
spice::image<T>::image(image const& other)

Parameters
other The image to copy

Copy constructor. Performs a deep copy of the passed image.

template<typenameT>
spice::image<T>::image(size_t width, size_t height, channel_list channel_semantics = {}, int alpha_channel = NO_ALPHA, T const& default_value = T{})

Parameters
width The width of the image
height The height of the image
channel_semantics The meaning to assign to the channels
alpha_channel The index of the channel holding alpha values. If the argument equals NO_ALPHA, the index will be deduced from the channel_semantics (if possible). Pass DISABLE_ALPHA_DEDUCTION to disable automatic alpha channel detection.
default_value The value to initialise the image with

Constructs an image with a given width, height and channel_semantics, initialising the data with T{}.

template<typenameT>
spice::image<T>::image(T*const data, size_t width, size_t height, channel_list channel_semantics = {}, int alpha_channel = NO_ALPHA)

Parameters
data The raw image data
width The width of the image
height The height of the image
channel_semantics The meaning to assign to the channels
alpha_channel The index of the channel holding alpha values. If the argument equals NO_ALPHA, the index will be deduced from the channel_semantics (if possible). Pass DISABLE_ALPHA_DEDUCTION to disable automatic alpha channel detection.

Constructs a fresh image with the supplied data and shape. Will take ownership of the pointer.

template<typenameT>
size_t spice::image<T>::width() const

The width of the image.

template<typenameT>
size_t spice::image<T>::height() const

The height of the image.

template<typenameT>
size_t spice::image<T>::channels() const

The number of channels in the image.

template<typenameT>
const channel_list& spice::image<T>::channel_semantics() const

The meaning assigned to the individual channels.

template<typenameT>
int spice::image<T>::alpha_channel() const

The index of the alpha channel or NO_ALPHA if none is present.

Returns int

Variable documentation

template<typenameT>
static const constexpr range spice::image<T>::intensity_range

Convenience constant defining the value representing black and the value representing white. This will be { 0, 1 } for floating point types and the type's minimum and maximum for all others.

Note that this range convention implies that floating point images can contain pixel values beyond the black-white spectrum (meaning values that will be clipped when rendered).