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

The mip-chain downscaler: one box-filter halving step per call, the standard non-sRGB-aware average every BLP toolchain uses. More...

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

Public Member Functions

std::vector< std::uint8_t > downscale (std::span< const std::uint8_t > rgba, std::uint32_t width, std::uint32_t height) const
 Downscale a level to the next one (dimensions halve, floored at 1); each destination texel averages its 2x2 (or clamped 2x1/1x2/1x1) source footprint per channel.

Detailed Description

The mip-chain downscaler: one box-filter halving step per call, the standard non-sRGB-aware average every BLP toolchain uses.

Stateless.

Definition at line 241 of file codec.hpp.

Member Function Documentation

◆ downscale()

std::vector< std::uint8_t > wowlib::formats::blp::detail::MipmapScaler::downscale ( std::span< const std::uint8_t > rgba,
std::uint32_t width,
std::uint32_t height ) const
nodiscard

Downscale a level to the next one (dimensions halve, floored at 1); each destination texel averages its 2x2 (or clamped 2x1/1x2/1x1) source footprint per channel.

Parameters
rgbathe source level's RGBA bytes.
widththe source width in pixels.
heightthe source height in pixels.
Returns
max(1, width/2) * max(1, height/2) * 4 RGBA bytes.

Definition at line 556 of file blp.cpp.

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


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