ImageSampler
The ImageSampler class provides a flexible and efficient interface for working with image data in various formats and dimensions. It supports 2D, 3D, and Cube image types, allowing for easy manipulation of image color data at the texel level. The class offers constructors for creating samplers from both mutable and immutable images, with optional slice support.
#include <format/TellusimImage.h>
Constructors
ImageSampler()
explicit ImageSampler(Image &image, Slice slice = Slice())
explicit ImageSampler(const Image &image, Slice slice = Slice())
Methods
Clear sampler.
void clear()
Check sampler.
bool isCreated() const
Sampler type.
Type getType() const
bool is2DType() const
bool is3DType() const
bool isCubeType() const
Sampler format.
Format getFormat() const
const char *getFormatName() const
Sampler dimension.
uint32_t getWidth() const
uint32_t getHeight() const
uint32_t getDepth() const
uint32_t getFaces() const
size_t getTexels() const
Size getSize() const
Region getRegion() const
Sampler layout.
size_t getStride() const
size_t getLayerSize() const
uint32_t getPixelSize() const
uint32_t getComponents() const
Sampler data.
const uint8_t *getData() const
uint8_t *getData()
Create sampler.
bool create(Image &image, Slice slice = Slice())
bool create(const Image &image, Slice slice = Slice())
bool create(Type type, Format format, Size size, size_t stride, void *data)
bool create(Type type, Format format, Size size, size_t stride, const void *data)
bool create(Type type, Format format, Size size, size_t stride, size_t layer_size, void *data)
bool create(Type type, Format format, Size size, size_t stride, size_t layer_size, const void *data)
Clear image.
bool clear(Color color)
bool clear(ImageColor color)
Multiply accumulate image.
bool mad(Color m, Color a)
2D image colors.
void set2D(uint32_t x, uint32_t y, ImageColor color)
ImageColor get2D(uint32_t x, uint32_t y, bool repeat = false) const
ImageColor get2D(float64_t x, float64_t y, bool repeat = false, Filter filter = Image::FilterLinear) const
3D image colors.
void set3D(uint32_t x, uint32_t y, uint32_t z, ImageColor color)
ImageColor get3D(uint32_t x, uint32_t y, uint32_t z, bool repeat = false) const
ImageColor get3D(float32_t x, float32_t y, float32_t z, bool repeat = false, Filter filter = Image::FilterLinear) const
Cube image colors.
void setCube(float32_t x, float32_t y, float32_t z, ImageColor color)
ImageColor getCube(float32_t x, float32_t y, float32_t z, Filter filter = Image::FilterLinear) const
uint32_t getCubeFace(float32_t x, float32_t y, float32_t z, float32_t &tx, float32_t &ty) const
Texel image colors.
void setTexel(size_t t, ImageColor color)
ImageColor getTexel(size_t t) const
Types
using Type = Image::Type
using Filter = Image::Filter