Generated reference › API — ICoreEssentials/UI/Media
kind: generated#api#icoreessentials-ui-media

API — ICoreEssentials/UI/Media

The public contract of 8 header(s) under ICoreEssentials/UI/Media — 4 class/struct definition(s), 87 declaration(s). Each section shows the header's banner and its public (and protected-virtual) surface exactly as the file writes it.

ICoreEpsRecorder.h#

ICoreEssentials/UI/Media/ICoreEpsRecorder.h

ICoreEpsRecorder#

ICoreEpsRecorder.h:54 · class · final · bases public ICorePaintRecorder · pImpl · 34 declaration(s)

ICoreEpsRecorder -- a drawing destination that writes Encapsulated PostScript.

class ICoreEpsRecorder final : public ICorePaintRecorder {
public:
    // `width` and `height` are the bounding box, in points. `pageBackground` is
    // what translucent paint is flattened against -- see the banner; pass the
    // colour the page is actually filled with, not white.
    ICoreEpsRecorder(double width, double height, const ICoreColor& pageBackground);
    ~ICoreEpsRecorder() override;

    // The finished document, header to `%%EOF`.
    [[nodiscard]] std::string document() const;

    // Every operation that could not be expressed, in arrival order and with
    // repeats kept -- twelve flattened fills and one are different stories
    // about the same page. Same contract as ICoreSvgRecorder::losses().
    [[nodiscard]] const std::vector<std::string>& losses() const;

    // -- ICorePaintRecorder -------------------------------------------------
    void unsupported(const char* what) override;

    void save() override;
    void restore() override;
    void setClipRect(const ICoreRect& rect) override;
    void clearClip() override;

    void setPen(const ICorePen& pen) override;
    void setPenColor(const ICoreColor& color) override;
    void setNoPen() override;
    void setBrush(const ICoreBrush& brush) override;
    void setNoBrush() override;
    void setFont(const ICoreFont& font) override;
    void setOpacity(double opacity) override;

    // Rasteriser hints. Accepted and discarded for the reason ICoreSvgRecorder
    // gives: a page description is not rasterised here, so letting these reach
    // unsupported() would file a loss on every prompt for something that loses
    // nothing -- and bury the real losses under it.
    void setAntialiasing(bool on) override;
    void setTextAntialiasing(bool on) override;

    void drawLine(const ICoreLine& line) override;
    void drawLine(const ICorePoint& p1, const ICorePoint& p2) override;
    void drawRect(const ICoreRect& rect) override;
    void drawRoundedRect(const ICoreRect& rect, double radiusX, double radiusY) override;
    void fillRect(const ICoreRect& rect, const ICoreBrush& brush) override;
    void drawEllipse(const ICoreRect& rect) override;
    void drawEllipse(const ICorePoint& center, double radiusX, double radiusY) override;
    void drawPolygon(const std::vector<ICorePoint>& points) override;
    void drawPolyline(const std::vector<ICorePoint>& points) override;
    void drawPath(const ICorePainterPath& path) override;
    void fillPath(const ICorePainterPath& path, const ICoreBrush& brush) override;
    void strokePath(const ICorePainterPath& path, const ICorePen& pen) override;

    void drawText(const ICorePoint& baseline, const ICoreString& text) override;
    void drawText(const ICoreRect& rect, ICoreAlignment alignment,
                  const ICoreString& text) override;

    void translate(double dx, double dy) override;
    void scale(double sx, double sy) override;
    void rotate(double degrees) override;

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

ICoreEpsWriter.h#

ICoreEssentials/UI/Media/ICoreEpsWriter.h

ICoreEpsWriter -- Encapsulated PostScript output. Chart export is its only consumer, exactly as with ICoreSvgWriter, whose inverted shape this copies: the painter is created INSIDE the writer and handed to a callback, so only an ICorePainter crosses the boundary and it cannot outlive the file it draws into.

⚠ ONE IMPLEMENTATION, NOT FOUR, AND THAT IS THE DIFFERENCE FROM ICoreSvgWriter. That header has a seat per backend because one toolkit ships a generator that IS a paint device (QSvgGenerator) and the others do not, so the Qt seat wraps and the rest intercept. NO toolkit here writes PostScript -- Core Graphics dropped CGPSContext, and nothing else is reachable through a wrapper -- so there is no seat to wrap on any backend and intercepting is the only spelling available. Four copies of one interception would be four chances to drift.

Declares no class of its own — see the file.

ICoreSvg.h#

ICoreEssentials/UI/Media/ICoreSvg.h

ICoreSvg#

ICoreSvg.h:53 · class · pImpl · 11 declaration(s)

ICoreSvg -- the editor's vector-art reader.

class ICoreSvg {
public:
    ICoreSvg();

    // Markup, not a path: this is what ICoreIcons::themedBlockArt hands back,
    // and it is how every block glyph in the editor is built.
    explicit ICoreSvg(const ICoreByteArray& contents);

    // A resource path (":/SVGs/...") or a file on disk.
    explicit ICoreSvg(const ICoreString& fileName);

    ~ICoreSvg();

    // Non-copyable: it owns a parsed document, and no call site copies one.
    ICoreSvg(const ICoreSvg&) = delete;
    ICoreSvg& operator=(const ICoreSvg&) = delete;

    // Did the markup parse? Every rasteriser below returns a null pixmap when
    // it did not -- a null icon leaves a row readable by its text, an empty box
    // does not.
    [[nodiscard]] bool isValid() const;

    // The drawing's own size, as authored. Empty when the markup did not parse,
    // which the one caller checks before using it to fit an aspect ratio.
    [[nodiscard]] ICoreSizeF defaultSize() const;

    // The whole drawing into a transparent square pixmap of `side * scale`
    // device pixels. `scale` is oversampling for art that will be scaled down
    // again by the widget that shows it -- the canvas auto-inserter renders at
    // 3x so its icons hold up when the canvas is zoomed in.
    [[nodiscard]] ICorePixmap toPixmap(int side, int scale = 1) const;

    // `side` LOGICAL pixels at `devicePixelRatio`, flooded with `tint`. The
    // returned pixmap carries the ratio, so a caller hands it straight to a
    // painter or an icon without scaling it again.
    [[nodiscard]] ICorePixmap toTintedPixmap(int side, const ICoreColor& tint,
                                             double devicePixelRatio) const;

    // The untinted twin of toTintedPixmap: the artwork in its own colours, at
    // the display's pixel ratio. A two-tone mark (the wordmark) cannot be
    // flooded, so tinting is not an option for it.
    //
    // Deliberately NOT an overload of toPixmap(side, scale) above. That one
    // multiplies the pixel COUNT and leaves the ratio at 1 -- a bigger image,
    // not a sharper one at the same size -- and the two would differ only in an
    // int versus a real, which is not a distinction a call site should have to
    // notice to get the right one.
    [[nodiscard]] ICorePixmap toPixmapForDisplay(int side, double devicePixelRatio) const;

    // Draw into a painter the caller already has, inside `target`.
    void render(ICorePainter& painter, const ICoreRect& target) const;

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

ICoreSvgDraw.h#

ICoreEssentials/UI/Media/ICoreSvgDraw.h

Draws an SVG document with this tree's painter.

This is the adapter between the toolkit-free reader (which resolves a document into a flat render list and draws nothing) and ICorePainter (which draws and knows nothing about SVG). It is deliberately thin: the cascade, <use>, gradients and units are all decided before anything here runs, so what is left is a walk that fills and strokes.

It names no toolkit. Every call it makes is an ICore wrapper call, so the same file serves whichever backend is compiled in.

THE TARGET IS A RECT, NOT A SIZE, and that is the whole DPR story: drawing the same document into a bigger rect re-rasterises it sharp, with no second code path and no scale argument for a caller to get wrong.

Declares no class of its own — see the file.

ICoreSvgRecorder.h#

ICoreEssentials/UI/Media/ICoreSvgRecorder.h

LQ.4, 2026-08-31: this header uses std::unique_ptr and never included <memory>. It compiled anyway because Qt's umbrella reached it transitively; the moment the rigs came off the Qt text seat the include path lost Qt and this stopped parsing. §L74.1 is the same defect pointing the other way -- there a QT name arrived with no include of its own, here a STANDARD one did.

ICoreSvgRecorder#

ICoreSvgRecorder.h:41 · class · final · bases public ICorePaintRecorder · pImpl · 29 declaration(s)

A paint destination that turns drawing calls into SVG.

class ICoreSvgRecorder final : public ICorePaintRecorder {
public:
    // `bounds` sets the document's size and viewBox together.
    ICoreSvgRecorder(double x, double y, double width, double height);
    ~ICoreSvgRecorder() override;

    // The document, from everything recorded so far.
    [[nodiscard]] std::string markup() const;

    // Every operation that could not be expressed, in the order it arrived and
    // with repeats kept -- twelve dropped gradients and one are different
    // stories about the same document.
    [[nodiscard]] const std::vector<std::string>& losses() const;

    // The operations recorded so far. Exposed so a suite can assert what
    // arrived without parsing markup back.
    [[nodiscard]] const std::vector<ICoreSvgEmitOp>& operations() const;

    // -- ICorePaintRecorder -----------------------------------------------
    void unsupported(const char* what) override;

    void save() override;
    void restore() override;
    void setClipRect(const ICoreRect& rect) override;
    void clearClip() override;

    void setPen(const ICorePen& pen) override;
    void setPenColor(const ICoreColor& color) override;
    void setNoPen() override;
    void setBrush(const ICoreBrush& brush) override;
    void setNoBrush() override;
    void setFont(const ICoreFont& font) override;
    void setOpacity(double opacity) override;

    // ⚠ ACCEPTED AND DISCARDED ON PURPOSE, which is not the same as dropped.
    // Antialiasing is a RASTERISER hint and SVG has no counterpart, because a
    // vector document is not rasterised until something else draws it. Letting
    // this fall through to `unsupported` would file a loss on every prompt for
    // something that loses nothing, and burying the real losses under it is
    // exactly how a loss report stops being read.
    void setTextAntialiasing(bool on) override;
    void setAntialiasing(bool on) override;

    void drawLine(const ICoreLine& line) override;
    void drawLine(const ICorePoint& p1, const ICorePoint& p2) override;
    void drawRect(const ICoreRect& rect) override;
    void fillRect(const ICoreRect& rect, const ICoreBrush& brush) override;
    void drawEllipse(const ICoreRect& rect) override;
    void drawEllipse(const ICorePoint& center, double radiusX, double radiusY) override;
    void drawPolygon(const std::vector<ICorePoint>& points) override;
    void drawPolyline(const std::vector<ICorePoint>& points) override;
    void drawPath(const ICorePainterPath& path) override;

    void drawText(const ICorePoint& baseline, const ICoreString& text) override;
    void drawText(const ICoreRect& rect, ICoreAlignment alignment,
                  const ICoreString& text) override;

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

ICoreSvgRenderer.h#

ICoreEssentials/UI/Media/ICoreSvgRenderer.h

ICoreSvgRenderer -- the one place a parsed SVG drawing meets a painter.

⚠ THERE IS EXACTLY ONE OF THESE FOR EVERY BACKEND, and that is the whole point of the split it sits on top of. Parsing, the style cascade, inheritance, use instancing, the viewBox fit and every other DECISION happen in UI/Portable/ICoreSvgDocument, with no toolkit and a headless test. What is left here is a walk over a flat list, and a walk holds no decisions -- so a second backend needs no second copy of it.

It is NOT in UI/Portable/ for one honest reason: it names ICorePainter, and that header reaches Qt's core module through ICorePoint.h. That does not stop it shipping -- Qt's core module stays in this plan -- but it does stop the file being compiled by a bare C++17 compiler with no toolkit installed, which is the property the tier below is built to keep.

Declares no class of its own — see the file.

ICoreSvgWriter.h#

ICoreEssentials/UI/Media/ICoreSvgWriter.h

ICoreSvgWriter -- the vector-art writer. Chart export is its only consumer.

Split out of ICoreSvg.{h,cpp} (task P1.6), where it had nothing in common with the reader beyond the letters S, V and G.

⚠ THIS IS AN INVERTED API, NOT A WRAPPED ONE, and the reason is worth keeping (task P1.7). QSvgGenerator is a QPaintDevice, so the one thing a caller used to do with it --

ICoreSvgWriter svg; svg.setBounds(...); QPainter painter(&svg);

-- needed the generator's ADDRESS, as a QPaintDevice*. A handle getter cannot help there: the caller has to construct a QPainter on it, and QPainter is a Qt type a client may not name. So the painter is created

Declares no class of its own — see the file.

ICoreVectorDrawing.h#

ICoreEssentials/UI/Media/ICoreVectorDrawing.h

ICoreVectorDrawing#

ICoreVectorDrawing.h:36 · class · pImpl · 13 declaration(s)

ICoreVectorDrawing -- a page of stroked polylines, written out as SVG, EPS or PDF: 2D linework as a vector document.

class ICoreVectorDrawing {
public:
    ICoreVectorDrawing(double width, double height);
    ~ICoreVectorDrawing();
    ICoreVectorDrawing(const ICoreVectorDrawing& other);
    ICoreVectorDrawing& operator=(const ICoreVectorDrawing& other);

    double width() const noexcept;
    double height() const noexcept;

    // The page's colour; white by default. EPS flattens translucent pens
    // against it (see ICoreEpsRecorder).
    void setBackground(const ICoreColor& color);
    ICoreColor background() const;

    void addPolyline(const std::vector<ICorePoint>& points, const ICorePen& pen);
    std::size_t polylineCount() const noexcept;

    // The document, whole.
    std::string toSvg() const;
    std::string toEps() const;

    // A one-page PDF at `path` (A4, in the orientation that fits the drawing
    // best), the drawing centred and scaled uniformly into the printable
    // area. False when the file could not be written.
    bool writePdf(const ICoreString& path) const;

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