← API Reference Class

asge::media::Image

#include <Image.hpp>

Public Types

#using data_t = std::vector< std::uint8_t >

Private Attributes

#std::size_t m_Widthprivate
#std::size_t m_Heightprivate
#graphics::PixelFormat m_Formatprivate
#data_t m_Dataprivate

Public Member Functions

#Image()=delete
#Image(std::size_t inW, std::size_t inH, graphics::PixelFormat inFormat, data_t const &inData)
#Image(Image const &)=delete
#Image(Image &&)=default
#Image & operator=(Image const &)=delete
#Image & operator=(Image &&)=default
#math::Int2 Dimensions() const noexcept
#graphics::PixelFormat Format() const noexcept
#std::uint8_t const * Data() const noexcept
#std::size_t Stride() const noexcept
#math::Rect AlphaContentBounds() const noexcept

Tight bounding box of this image's non-transparent pixels, in its own pixel coordinates.

Scans the whole image; see the region overload below to scan just part of it.

#math::Rect AlphaContentBounds(math::Rect const &inRegion) const noexcept

Tight bounding box of the non-transparent pixels within inRegion (clamped to this image's own bounds), in the image's own pixel coordinates.

Falls back to the clamped region itself if every pixel in it is fully transparent.

Static Public Member Functions

#static Result< Image > Load(filesystem::Path const &inImagePath)

Reads an image file from disk and decodes it into an RGBA8 Image.

Parameters
inImagePath

The path to the encoded image file (PNG, JPEG, ...)

Returns

The decoded Image, or an error if the file couldn't be read or decoded

#static bool IsSupportedFile(filesystem::Path const &inPath) noexcept

Checks whether inPath's extension is one Load()/DecodeImage() can decode — a cheap, content-blind pre-filter for a file picker, not a guarantee the bytes themselves are valid.