wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wowlib::formats::blp::detail::RawCodec Class Reference

The uncompressed-BGRA codec (ColorEncoding::Bgra / BgraAlt): a pure channel swizzle. More...

#include <wowlib/formats/blp/codec.hpp>

Public Member Functions

Result< std::vector< std::uint8_t > > decode (std::span< const std::byte > src, std::uint32_t width, std::uint32_t height) const
 Decode one level's BGRA bytes to RGBA8 pixels.
Result< FileBuffer > encode (std::span< const std::uint8_t > rgba, std::uint32_t width, std::uint32_t height) const
 Encode RGBA8 pixels to one level's BGRA bytes.

Detailed Description

The uncompressed-BGRA codec (ColorEncoding::Bgra / BgraAlt): a pure channel swizzle.

Stateless, a class for symmetry with the other codecs and to keep the swizzle off the free-function surface.

Definition at line 217 of file codec.hpp.

Member Function Documentation

◆ decode()

Result< std::vector< std::uint8_t > > wowlib::formats::blp::detail::RawCodec::decode ( std::span< const std::byte > src,
std::uint32_t width,
std::uint32_t height ) const
nodiscard

Decode one level's BGRA bytes to RGBA8 pixels.

Parameters
srcthe on-disk BGRA bytes; short payloads decode their missing texels transparent black.
widththe level width in pixels.
heightthe level height in pixels.
Returns
width * height * 4 RGBA bytes.

Definition at line 526 of file blp.cpp.

Referenced by wowlib::formats::blp::BLP::decode().

◆ encode()

Result< FileBuffer > wowlib::formats::blp::detail::RawCodec::encode ( std::span< const std::uint8_t > rgba,
std::uint32_t width,
std::uint32_t height ) const
nodiscard

Encode RGBA8 pixels to one level's BGRA bytes.

Parameters
rgbawidth * height * 4 RGBA bytes.
widththe level width in pixels.
heightthe level height in pixels.
Returns
width * height * 4 BGRA bytes.

Definition at line 540 of file blp.cpp.

Referenced by wowlib::formats::blp::BLP::encode().


The documentation for this class was generated from the following files: