Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
SdfGenerator.cpp File Reference

Exact signed distance field from an antialiased coverage bitmap. More...

#include "SdfGenerator.hpp"
#include <vector>
#include <cmath>
#include <algorithm>
Include dependency graph for SdfGenerator.cpp:

Go to the source code of this file.

Namespaces

namespace  esengine
namespace  esengine::text

Functions

void esengine::text::sdfFromAlpha (const u8 *alpha, u8 *out, u32 width, u32 height, f32 spread)
 Signed distance field from an antialiased alpha coverage bitmap.

Detailed Description

Exact signed distance field from an antialiased coverage bitmap.

Felzenszwalb–Huttenlocher separable squared-distance transform with coverage-derived fractional seeds (tiny-sdf lineage): a partially covered texel seeds the transform with (0.5 − α)², placing the edge at sub-texel accuracy so magnified glyphs stay smooth. Interior and exterior fields are subtracted for the signed distance; the 1D transform is exact and O(n), and skips the sites that cannot change a byte of the result (see edt1d).

Definition in file SdfGenerator.cpp.