Magnum::TextureTools namespace

Texture tools.

Contents

Tools for generating, compressing and optimizing textures.

This library is built if WITH_TEXTURETOOLS is enabled when building Magnum. To use this library with CMake, you need to request the TextureTools component of the Magnum package in CMake and link to the Magnum::TextureTools target:

find_package(Magnum REQUIRED TextureTools)

# ...
target_link_libraries(your-app Magnum::TextureTools)

Note that functionality depending on GL APIs is available only if Magnum is built with both WITH_GL and TARGET_GL enabled (which is done by default).

Additional utilities are built separately. See the magnum-distancefieldconverter utility documentation, Downloading and building and Usage with CMake for more information.

Classes

class DistanceField
Create a signed distance field.

Functions

auto atlas(const Vector2i& atlasSize, const std::vector<Vector2i>& sizes, const Vector2i& padding = Vector2i()) -> std::vector<Range2Di>
Pack textures into texture atlas.
void distanceField(GL::Texture2D& input, GL::Texture2D& output, const Range2Di& rectangle, Int radius, const Vector2i& imageSize = Vector2i{}) deprecated
Create a signed distance field.
void flip()
Flip an image upside down.

Function documentation

std::vector<Range2Di> Magnum::TextureTools::atlas(const Vector2i& atlasSize, const std::vector<Vector2i>& sizes, const Vector2i& padding = Vector2i())

Pack textures into texture atlas.

Parameters
atlasSize Size of resulting atlas
sizes Sizes of all textures in the atlas
padding Padding around each texture

Packs many small textures into one larger. If the textures cannot be packed into required size, empty vector is returned.

Padding is added twice to each size and the atlas is laid out so the padding don't overlap. Returned sizes are the same as original sizes, i.e. without the padding.

void Magnum::TextureTools::distanceField(GL::Texture2D& input, GL::Texture2D& output, const Range2Di& rectangle, Int radius, const Vector2i& imageSize = Vector2i{})

Create a signed distance field.