Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
EmbeddedSvgIcon.h File Reference
#include <optional>
#include <span>
#include "donner/svg/renderer/RendererInterface.h"
Include dependency graph for EmbeddedSvgIcon.h:

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Functions

std::optional< svg::RendererBitmapdonner::editor::RenderEmbeddedSvgIcon (std::span< const unsigned char > svgBytes, int outputSizePx)
 Render an embedded SVG icon resource into a tintable RGBA bitmap.
std::optional< svg::RendererBitmapdonner::editor::RenderEmbeddedSvgArtwork (std::span< const unsigned char > svgBytes, int outputSizePx)
 Render embedded SVG artwork while preserving its authored RGBA colors.

Function Documentation

◆ RenderEmbeddedSvgArtwork()

std::optional< svg::RendererBitmap > donner::editor::RenderEmbeddedSvgArtwork ( std::span< const unsigned char > svgBytes,
int outputSizePx )
nodiscard

Render embedded SVG artwork while preserving its authored RGBA colors.

Use this for small multi-color assets such as the editor's black-core, white-halo tool icons. Single-color affordances should continue to use RenderEmbeddedSvgIcon so ImGui can tint their alpha mask.

Parameters
svgBytesEmbedded SVG source bytes.
outputSizePxSquare output bitmap size in device pixels.
Returns
Rendered artwork, or std::nullopt if parsing/rendering fails.

◆ RenderEmbeddedSvgIcon()

std::optional< svg::RendererBitmap > donner::editor::RenderEmbeddedSvgIcon ( std::span< const unsigned char > svgBytes,
int outputSizePx )
nodiscard

Render an embedded SVG icon resource into a tintable RGBA bitmap.

The source SVG is parsed and rasterized through Donner. The returned bitmap is normalized to a white premultiplied-alpha mask so callers can tint it with the current ImGui text color when displaying the resulting texture.

Parameters
svgBytesEmbedded SVG source bytes.
outputSizePxSquare output bitmap size in device pixels.
Returns
Rendered icon bitmap, or std::nullopt if parsing/rendering fails.