QtCraft API C++ classes QML types Handbook

QcProceduralTexture Namespace

A procedural texture definition (content/*/textures/*.json or a texture pack's spec) turned into a picture: the fields are read into a QcTextureSpec and painted at 16 x 16; larger resolutions are enlarged with the pattern's detail (QcTextureDetail, decision E-299). More...

Header: #include <clientcore/textures/QcProceduralTexture.h>

Functions

QcTextureAnimation animationOf(const QJsonObject &definition)
QcResult<QImage> render(const QJsonObject &definition, int resolution, int frame = 0)
QcResult<QList<QImage>> renderFrames(const QJsonObject &definition, int resolution)
QcResult<QcTextureSpec> spec(const QJsonObject &definition)

Detailed Description

Function Documentation

QcTextureAnimation QcProceduralTexture::animationOf(const QJsonObject &definition)

Returns the animation of definition; a still one when it has none or invalid fields.

QcResult<QImage> QcProceduralTexture::render(const QJsonObject &definition, int resolution, int frame = 0)

Returns the texture of definition at resolution (a power of two from 16 to 512); of an animated definition (decision E-878) frame frame (0 to frames - 1), painted at the phase frame / frames.

QcResult<QList<QImage>> QcProceduralTexture::renderFrames(const QJsonObject &definition, int resolution)

Returns every frame of the animation of definition at resolution (one for a still texture, also when its animation fields are invalid: a server's content is checked by the content parser, not here).

QcResult<QcTextureSpec> QcProceduralTexture::spec(const QJsonObject &definition)

Returns the spec of definition; the error names the field that is wrong.