Template Class bitmap_t

Class Documentation

template<typename T = f_t, std::size_t Dims = 2>
class bitmap_t

Generic bitmap class. “Pixels” can be arbitrary types. For texel types (snorm/unorm/fp elements), where T satisfies the texel concept, conversion between layouts and texel types and bitmap resizing is provided.

Public Types

using size_t = vec<Dims, std::uint32_t>

Public Functions

bitmap_t() noexcept = default
bitmap_t(bitmap_t&&) noexcept = default
inline bitmap_t(const bitmap_t &o)
bitmap_t &operator=(bitmap_t&&) noexcept = default
inline auto *data() noexcept
inline const auto *data() const noexcept
inline const auto width() const noexcept
inline const auto height() const noexcept
inline const auto depth() const noexcept
inline const auto dimensions() const noexcept
inline const auto pixel_layout() const noexcept
inline const auto components() const noexcept
inline const auto component_bytes() const noexcept
inline std::size_t bytes() const noexcept
inline std::size_t total_elements() const noexcept
inline std::size_t total_pixels() const noexcept
inline auto &operator[](std::uint64_t idx) noexcept
inline const auto &operator[](std::uint64_t idx) const noexcept
inline auto &operator()(std::uint32_t x, std::uint32_t c) noexcept
inline const auto &operator()(std::uint32_t x, std::uint32_t c) const noexcept
inline auto &operator()(std::uint32_t x, std::uint32_t y, std::uint32_t c) noexcept
inline const auto &operator()(std::uint32_t x, std::uint32_t y, std::uint32_t c) const noexcept
inline auto &operator()(std::uint32_t x, std::uint32_t y, std::uint32_t z, std::uint32_t c) noexcept
inline const auto &operator()(std::uint32_t x, std::uint32_t y, std::uint32_t z, std::uint32_t c) const noexcept
inline auto &operator()(const size_t &idx, std::uint32_t c) noexcept
inline const auto &operator()(const size_t &idx, std::uint32_t c) const noexcept
inline auto &operator()(const size_t &idx, std::uint32_t c) noexcept
inline const auto &operator()(const size_t &idx, std::uint32_t c) const noexcept
inline auto &operator()(const size_t &idx, std::uint32_t c) noexcept
inline const auto &operator()(const size_t &idx, std::uint32_t c) const noexcept
inline auto *begin() noexcept
inline auto *end() noexcept
inline const auto *begin() const noexcept
inline const auto *end() const noexcept
inline const auto *cbegin() const noexcept
inline const auto *cend() const noexcept
inline auto &operator+=(const bitmap_t &s)
inline void fill(const T &val)
template<typename NewT, typename Converter>
inline auto convert(pixel_layout_t new_layout, const Converter &conv) const

Converts pixel layout and underlying type. conv(const T* src_pixel, NewT* dst_pixel) does the conversion between pixels.

template<typename NewT>
inline auto convert() const

Converts the underlying type. Conversion is done via a static_cast on each pixel element.

template<texel NewT>
inline auto convert_texels(pixel_layout_t new_layout) const

Converts pixel layout and underlying type. Pixel layout must not be Custom. Conversion is done automatically via layout and texel conversion (for snorm/unorm/fp bitmaps).

template<texel NewT>
inline auto convert_texels() const

Converts the underlying type. Pixel layout must not be Custom. Conversion is done automatically via texel conversion (for snorm/unorm/fp bitmaps).

inline auto resize(size_t new_size) const &

Resizes the bitmap. Pixel layout must not be Custom. For snorm/unorm/fp bitmaps.

inline auto resize(std::uint32_t new_width, std::uint32_t new_height) const &

Resizes the bitmap. Pixel layout must not be Custom. For snorm/unorm/fp bitmaps.

inline auto resize(size_t new_size) &&

Resizes the bitmap. Pixel layout must not be Custom. For snorm/unorm/fp bitmaps.

inline auto resize(std::uint32_t new_width, std::uint32_t new_height) &&

Resizes the bitmap. Pixel layout must not be Custom. For snorm/unorm/fp bitmaps.

Public Static Functions

static inline auto create(size_t size, pixel_layout_t layout, std::optional<T> fill_val = std::nullopt)
static inline auto create(std::uint32_t w, std::uint32_t h, pixel_layout_t layout, std::optional<T> fill_val = std::nullopt)