API — ICoreEssentials/UI/Backends/AppKit/Painting
The public contract of 3 header(s) under ICoreEssentials/UI/Backends/AppKit/Painting — 14 class/struct definition(s), 0 declaration(s). Each section shows the header's banner and its public (and protected-virtual) surface exactly as the file writes it.
ICoreAppKitCowStorage.h#
ICoreEssentials/UI/Backends/AppKit/Painting/ICoreAppKitCowStorage.h
Copy-on-write state behind a refcounted pointer, in the shape the painting value classes all need. Internal to this zone; the declared seam is ICoreAppKitPaintState.h.
⚠ WHY A SHARED TEMPLATE AND NOT FOUR HAND-WRITTEN COPIES. ICorePen, ICoreBrush, ICorePainterPath and both gradients each need identical refcount / detach / assign logic over a different state struct. Written out four times that is four chances to miss a detach() in a setter -- which is the failure that makes one value's mutation appear in an unrelated copy, and which no compiler, linker or guard reports. Writing it once means the six operations are either right everywhere or wrong everywhere, and the suites exercise them everywhere.
⚠ std::launder throughout, for the reason every Group D seat states: the
Box#
ICoreAppKitCowStorage.h:26 · struct · 0 declaration(s)
struct Box {
public:
int refs = 1;
State value;
};
};
ICoreAppKitPaintState.h#
ICoreEssentials/UI/Backends/AppKit/Painting/ICoreAppKitPaintState.h
What the painting value classes hold on this backend, and the in-zone seam the painter reads them through. (The planning row is named in the .mm, not here.)
NO OBJECTIVE-C AND NO GRAPHICS TYPE IN THIS HEADER -- plain numbers, enums and std::vector only, exactly like the event map and the drawing core beside it. That is what lets the verify test include it without the toolkit, and it is also why this file is worth reading if you are seating the SAME tier on another backend: none of these shapes is Core Graphics-specific.
⚠⚠ WHY EVERY ONE OF THESE IS A REFCOUNTED POINTER, NOT AN INLINE STRUCT. A1.6's storage audit prescribed the refcounted-pointer shape for ICorePen and ICoreBrush specifically, because they have no CoreGraphics counterpart and their state does not fit 8 bytes. Seating the whole tier turned that
ICoreAppKitRgba8#
ICoreAppKitPaintState.h:37 · struct · 0 declaration(s)
A colour as the wrapper stores it: 8-bit channels plus the INVALID state, which is load-bearing (an unset theme token must not read as black).
struct ICoreAppKitRgba8 {
public:
int red = 0;
int green = 0;
int blue = 0;
int alpha = 255;
bool valid = false;
};
};
ICoreAppKitGradientStopState#
ICoreAppKitPaintState.h:45 · struct · 0 declaration(s)
struct ICoreAppKitGradientStopState {
public:
double position = 0.0;
ICoreAppKitRgba8 color;
};
};
ICoreAppKitGradientState#
ICoreAppKitPaintState.h:50 · struct · 0 declaration(s)
struct ICoreAppKitGradientState {
public:
enum class Kind { Linear, Radial };
Kind kind = Kind::Linear;
// Linear: (x1,y1) -> (x2,y2). Radial: centre (x1,y1) with `radius`.
double x1 = 0.0, y1 = 0.0, x2 = 0.0, y2 = 0.0;
double radius = 0.0;
std::vector<ICoreAppKitGradientStopState> stops;
};
};
ICoreAppKitBrushState#
ICoreAppKitPaintState.h:61 · struct · 0 declaration(s)
struct ICoreAppKitBrushState {
public:
enum class Kind { None, Solid, Gradient };
Kind kind = Kind::None; // ⚠ the default really is "no fill"
ICoreAppKitRgba8 color;
ICoreAppKitGradientState gradient;
};
};
ICoreAppKitPenState#
ICoreAppKitPaintState.h:68 · struct · 0 declaration(s)
struct ICoreAppKitPenState {
public:
// ⚠ A PEN HOLDS A BRUSH, NOT A COLOUR. That is the wrapper's shape --
// ICorePen(const ICoreBrush&, double) exists and its call site strokes a
// rim with one. Flattening this to a colour compiles and quietly drops the
// gradient on the one site that passes one.
ICoreAppKitBrushState brush;
// ⚠ 0 MEANS A COSMETIC HAIRLINE, not "invisible" -- a backend that treats
// it as nothing draws no hairline strokes at all.
//
// ⚠ BUT 0 IS *NOT* THE PEN'S DEFAULT, WHICH IS WHAT THIS COMMENT USED TO
// SAY. It cited the wrapper's header, and the wrapper's header was wrong:
// the toolkit's default pen is `widthF=1, cosmetic=false`, measured against
// this tree's own version. ICorePen's constructors set 1 explicitly for
// that reason. This struct member keeps 0 as its *field* initialiser, which
// is only ever seen by a state built without going through a constructor.
double width = 0.0;
ICorePenStyle style = ICorePenStyle::Solid;
ICorePenCap cap = ICorePenCap::Square; // the toolkit's default, not Flat
ICorePenJoin join = ICorePenJoin::Bevel; // the toolkit's default, not Miter
bool cosmetic = false;
};
};
ICoreAppKitPathCommand#
ICoreAppKitPaintState.h:100 · struct · 0 declaration(s)
A path as a replayable command list rather than a graphics object.
struct ICoreAppKitPathCommand {
public:
enum class Op { MoveTo, LineTo, CubicTo, Close };
Op op = Op::MoveTo;
double x1 = 0.0, y1 = 0.0; // MoveTo/LineTo point, or CubicTo control 1
double x2 = 0.0, y2 = 0.0; // CubicTo control 2
double x3 = 0.0, y3 = 0.0; // CubicTo end point
};
};
ICoreAppKitPainter.h#
ICoreEssentials/UI/Backends/AppKit/Painting/ICoreAppKitPainter.h
The drawing core of the AppKit backend's painter: every stroke and fill the wrapper offers, expressed against a Core Graphics context.
NO OBJECTIVE-C AND NO TOOLKIT TYPE IN THIS HEADER, the same rule the event map beside it follows and for the same reason: the verify test -- and anything else above the backend -- includes this without the toolkit. The context arrives as an opaque pointer and is cast in the .mm, which is the only file that names a graphics type.
⚠ IT SPEAKS PLAIN NUMBERS, NOT THE ICore VALUE CLASSES. ICoreColor, ICorePen, ICoreBrush and ICorePainterPath are all pImpl over the OTHER toolkit today: they cannot be constructed in a build that has no Qt, so a core written against them could not be compiled or tested until the whole value tier is converted. The enums below are the exception and are used
ICoreAppKitRgba#
ICoreAppKitPainter.h:31 · struct · 0 declaration(s)
A colour, straight: components in [0, 1], alpha included, no colour space beyond the device's own.
struct ICoreAppKitRgba {
public:
double red = 0.0;
double green = 0.0;
double blue = 0.0;
double alpha = 1.0;
};
};
ICoreAppKitPoint#
ICoreAppKitPainter.h:42 · struct · 0 declaration(s)
A point and a rectangle in the painter's coordinates, which are Y-DOWN -- the flipped convention every wrapper-owned view uses, so the geometry and paint code above keeps its assumptions.
struct ICoreAppKitPoint {
public:
double x = 0.0;
double y = 0.0;
};
};
ICoreAppKitRect#
ICoreAppKitPainter.h:47 · struct · 0 declaration(s)
struct ICoreAppKitRect {
public:
double x = 0.0;
double y = 0.0;
double width = 0.0;
double height = 0.0;
};
};
ICoreAppKitStroke#
ICoreAppKitPainter.h:54 · struct · 0 declaration(s)
struct ICoreAppKitStroke {
public:
ICoreAppKitRgba color;
double width = 1.0;
ICorePenStyle style = ICorePenStyle::Solid;
ICorePenCap cap = ICorePenCap::Square;
ICorePenJoin join = ICorePenJoin::Bevel;
};
};
ICoreAppKitGradientStop#
ICoreAppKitPainter.h:63 · struct · 0 declaration(s)
One stop of a gradient: where it sits along the ramp, and what colour it is.
struct ICoreAppKitGradientStop {
public:
double position = 0.0;
ICoreAppKitRgba color;
};
};
ICoreAppKitFont#
ICoreAppKitPainter.h:71 · struct · 0 declaration(s)
A font request, in the terms a caller already has.
struct ICoreAppKitFont {
public:
std::string family = "Helvetica";
double pointSize = 12.0;
// 400 is regular and 700 is bold, the same numbering the wrapper's font
// weight enum uses.
int weight = 400;
bool italic = false;
};
};
ICoreAppKitTextMetrics#
ICoreAppKitPainter.h:83 · struct · 0 declaration(s)
What a font measures, in points.
struct ICoreAppKitTextMetrics {
public:
double ascent = 0.0;
double descent = 0.0;
double leading = 0.0;
double width = 0.0;
};
};