QtCraft API C++ classes QML types Handbook

QcBlockIcon Namespace

Inventory icon of a block state: its boxes drawn from above at an angle (top, east and south faces), textured from the atlas and shaded like the world, so stairs, slabs and fences look different from their base block. More...

Header: #include <clientcore/icons/QcBlockIcon.h>

Classes

struct FreeQuad
struct Part

Variables

const int iconSize
const int largeIconSize
const int sourceTileSize

Functions

QImage render(const QList<QcBlockIcon::Part> &parts, const std::array<QImage, 6> &shadedAtlas, int size = iconSize)
QImage render(const QcBlockRenderTable::Entry &entry, const std::array<QImage, 6> &shadedAtlas, int size = iconSize)
QImage renderFitted(QList<QcBlockIcon::FreeQuad> quads, const std::array<QImage, 6> &shadedAtlas, int size = iconSize)
std::array<QImage, 6> shadedAtlases(const QImage &atlas)

Detailed Description

Classes

class FreeQuad

A quad of any size and place with the colour its texels are multiplied with (RGBA, 255 keeps a channel): a face of a creature's model (QcMobIcon). More...

class Part

One cell of a block that fills several (a bed's foot and head, decision E-885): its state's entry, drawn offset cells away from the first part. More...

Variable Documentation

const int QcBlockIcon::iconSize

Edge length of an icon in pixels for textures of 16 x 16.

const int QcBlockIcon::largeIconSize

Icons of texture packs above 16 x 16 (decision E-300).

const int QcBlockIcon::sourceTileSize

Atlas tiles the icons are drawn from at most: enough for a face of a large icon.

Function Documentation

QImage QcBlockIcon::render(const QList<QcBlockIcon::Part> &parts, const std::array<QImage, 6> &shadedAtlas, int size = iconSize)

Returns the icon of a block of several cells, size pixels across, drawn from shadedAtlas: all parts together, scaled evenly so that the bounds of their geometry take as much of the icon as a full block, centred there. A part without an entry draws nothing; a single part draws like render(entry).

QImage QcBlockIcon::render(const QcBlockRenderTable::Entry &entry, const std::array<QImage, 6> &shadedAtlas, int size = iconSize)

Returns the icon of the block state entry, size pixels across, drawn from shadedAtlas (shadedAtlases()).

QImage QcBlockIcon::renderFitted(QList<QcBlockIcon::FreeQuad> quads, const std::array<QImage, 6> &shadedAtlas, int size = iconSize)

Returns the icon of the free quads, size pixels across, drawn from shadedAtlas: scaled evenly so that the bounds of their geometry take as much of the icon as a full block, centred there.

std::array<QImage, 6> QcBlockIcon::shadedAtlases(const QImage &atlas)

Returns atlas darkened by the face shading of the world, per QcBlockFace; made once for all icons.