Generated reference › API — ICoreEssentials/UI/Backends/WinUI/Icons
kind: generated#api#icoreessentials-ui-backends-winui-icons

API — ICoreEssentials/UI/Backends/WinUI/Icons

The public contract of 2 header(s) under ICoreEssentials/UI/Backends/WinUI/Icons — 5 class/struct definition(s), 11 declaration(s). Each section shows the header's banner and its public (and protected-virtual) surface exactly as the file writes it.

ICoreWinUIIconEngine.h#

ICoreEssentials/UI/Backends/WinUI/Icons/ICoreWinUIIconEngine.h

The WinUI backend's icon-raster core: draw a piece of art offscreen at the size and device pixel ratio a screen actually wants, theme it, and keep the result until something that would change it moves.

⚠ THIS IS NOT ICoreThemedIconEngine's Impl, AND IT CANNOT BE. That class is declared in UI/Backends/Qt/Icons/ICoreThemedIcon.h deriving from ICoreIconEngine (moved there by A9.16's sibling row A9.17, §0.161), which IS a QIconEngine -- the one class in this tree sanctioned to derive from it -- and ICoreIcons::themed() hands back a QIcon, across 95 call sites in 28 files. A Qt-free Windows build does not get as far as an Impl: it fails in that header. Retyping that return is an ICoreIcon decision. So this is the CORE, on the same split the Direct2D painter and the portable scene took -- every argument here is a plain number, and seating the engine on it later is a forward.

ICoreWinUIIconTint#

ICoreWinUIIconEngine.h:56 · struct · 0 declaration(s)

A colour, or the deliberate absence of one.

struct ICoreWinUIIconTint {
public:
    bool valid = false;
    int r = 0, g = 0, b = 0, a = 255;
};
};

ICoreWinUIIconPalette#

ICoreWinUIIconEngine.h:65 · struct · 0 declaration(s)

The three theme tokens the tint decision reads, resolved to plain channels by whoever owns the theme.

struct ICoreWinUIIconPalette {
public:
    bool isDark = false;
    ICoreWinUIIconTint textPrimary;
    ICoreWinUIIconTint textDisabled;
    ICoreWinUIIconTint textOnAccent;
};
};

ICoreWinUIIconFit#

ICoreWinUIIconEngine.h:87 · struct · 0 declaration(s)

Square-fit and centring, in logical pixels.

struct ICoreWinUIIconFit {
public:
    int side = 0;
    double offsetX = 0.0;
    double offsetY = 0.0;
};
};

ICoreWinUIIconRaster#

ICoreWinUIIconEngine.h:116 · struct · 1 declaration(s)

One raster, in premultiplied BGRA -- the byte order a WIC/D2D surface uses and the one ICorePixmap will hand over.

struct ICoreWinUIIconRaster {
public:
    int pixelWidth = 0;
    int pixelHeight = 0;
    int stride = 0;                 // bytes per row; not always pixelWidth*4
    int logicalSide = 0;
    double devicePixelRatio = 1.0;
    std::vector<unsigned char> bgra;

    // Declared, not defined: the header surface rule takes no bodies, and a
    // one-liner is exactly the shape that talks a header into growing them.
    bool isNull() const;
};
};

ICoreWinUIIconEngine#

ICoreWinUIIconEngine.h:141 · class · pImpl · 10 declaration(s)

class ICoreWinUIIconEngine {
public:
    ICoreWinUIIconEngine(ID2D1Factory* d2dFactory,
                         IWICImagingFactory* wicFactory,
                         ICoreWinUIIconTheming theming);
    ~ICoreWinUIIconEngine();

    ICoreWinUIIconEngine(const ICoreWinUIIconEngine&) = delete;
    ICoreWinUIIconEngine& operator=(const ICoreWinUIIconEngine&) = delete;

    // Replacing the art invalidates the cache. Setting no art is legal and
    // yields null rasters -- "this icon has no drawing" is a state the registry
    // really produces (an unregistered block type), not a caller error.
    void setArt(ICoreWinUIIconArt art);

    // Bump when the art itself would render differently -- a RecolourArt engine
    // whose theme moved. See icoreWinUIIconRevisionOf above for why a bool will
    // not do.
    void setArtRevision(unsigned int revision);
    unsigned int artRevision() const;

    // RecolourArt only. Disabled art is faded, not greyed: draining the colours
    // out of a glyph whose colours carry meaning says something different rather
    // than saying the same thing quietly.
    void setDisabledOpacity(double opacity);

    // The raster for this request, from the cache when nothing that would change
    // it has moved. The reference is owned by the engine and is valid until the
    // next call on it.
    const ICoreWinUIIconRaster& raster(int boxWidth, int boxHeight,
                                       double devicePixelRatio,
                                       ICoreWinUIIconMode mode,
                                       const ICoreWinUIIconTint& tint);

    // How many times the art was actually re-rendered, and how many requests the
    // cache answered. Exposed because "the cache works" is otherwise a claim
    // about something invisible, and a cache with the wrong key is
    // indistinguishable from a correct one until the theme moves.
    unsigned int rasterCount() const;
    unsigned int cacheHits() const;
    void clearCache();

private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};

File-scope declarations#

// The states an icon is asked for. The names are the tree's, not the toolkit's.
enum class ICoreWinUIIconMode { Normal, Disabled, Active, Selected };

// How the active theme reaches the art. The two engines behind ICoreIcons theme
// in OPPOSITE ways, and this is the whole of the difference:
// 
// FloodMono   -- flat line art authored for a light surface. ONE drawing,
// flooded with a single colour that keeps its alpha, so the
// shape and its soft edges survive and only the ink moves.
enum class ICoreWinUIIconTheming { FloodMono, RecolourArt };

// Draws the art into `painter`, inside the square (0,0)-(side,side) in LOGICAL
// units. The ratio is already in the painter's transform, so one drawing serves
// every display -- see the .cpp, where that choice is also what keeps the flood
// correct.
// 
// ⚠ TAKEN AS A FUNCTION RATHER THAN AS AN SVG, deliberately. Rasterizing SVG on
using ICoreWinUIIconArt = std::function<void(ICoreWinUIPainter& painter, double side)>;

ICoreWinUIIconSizing.h#

ICoreEssentials/UI/Backends/WinUI/Icons/ICoreWinUIIconSizing.h

The icon SEAT's two pieces of arithmetic, with no toolkit under them.

The engine next door (ICoreWinUIIconEngine.h) owns what a RENDER needs -- the square fit, the rounded pixel side, the cache revision. This header owns the two rules the SEAT needs and the engine has no reason to know: one about art that is ALREADY a raster, and one about a caller that named a device pixel ratio.

⚠ THEY ARE HERE RATHER THAN INLINE IN THE SEAT FOR ONE REASON. The seat includes ICoreString, and on this configure ICoreString reaches Qt, so a rule spelled inside it can only be proved by a suite that links the toolkit. These are plain ints, so the suite beside them links nothing at all -- the split the painter, the scene core and the icon engine each took before it.

Declares no class of its own — see the file.