13 #ifndef IMAGE_SWIZZLE_HPP
14 #define IMAGE_SWIZZLE_HPP
38 for (
int i = 0; i < int(element.size()); i++)
43 if (
'0' <= c && c <=
'9') k = c -
'0';
44 if (
'A' <= c && c <=
'Z') k = c -
'A' + 10;
49 throw std::runtime_error(
"Swizzle index out of range");
53 virtual double get(
int i,
int j,
int k)
const
55 return L->
get(i, j, index[k]);
63 virtual void doc(std::ostream& out)
const
65 out <<
"swizzle " << element;
70 std::vector<int> index;
virtual double get(int i, int j, int k) const =0
Return the value of the sample at row i, column j, channel k.
swizzle(std::string element, image *L)
Reorder, replicate, or remove channels of L. Element is a string of digits used as channel indices...
Definition: image_swizzle.hpp:36
image * L
Left child.
Definition: image.hpp:117
virtual void doc(std::ostream &out) const
Produce a string documenting the function of this object.
Definition: image_swizzle.hpp:63
virtual int get_depth() const
Return the depth of this image.
Definition: image_swizzle.hpp:58
Base class for all image sources, filters, and operators.
Definition: image.hpp:20
Swizzle filter.
Definition: image_swizzle.hpp:20