feat(ui): themed DragonX logo — runtime-rasterized SVG recolored per skin

Replace the shared app logo (Overview header, first-run wizard, lock screen) with
the DragonX mark rendered from res/img/logos/logo_dragonx.svg, recolored to each
theme: the dragon body takes the theme accent (Primary()), the inner detail stays
light. Vendor nanosvg (memononen, zlib/public-domain) in libs/nanosvg/ and add
util::LoadTextureFromSvg (parse a copy, recolor shapes by luminance, rasterize to
RGBA, upload via the existing CreateRawTexture — GL + DX11). The SVG is embedded as
a string (src/embedded/logo_dragonx_svg.h) so it's available in every build.

The load moves into App::ensureLogoTexture(), called at the top of render() BEFORE
the wizard/lock early-returns (so those screens get the logo too, which they never
did before), and re-rasterizes when the accent or the dark/light variant changes.
The per-skin PNG remains a fallback if rasterization ever fails; logo-texture
lifetime is now freed on replace + on theme switch (was leaked).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-21 13:28:51 -05:00
co-authored by Claude Opus 4.8
parent 267d839d5b
commit 17525003c5
9 changed files with 4991 additions and 58 deletions
+24
View File
@@ -0,0 +1,24 @@
// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
//
// Rasterize a (two-tone) SVG to a themed RGBA GPU texture via nanosvg. Used for the DragonX logo /
// custom emoji: the darker fill becomes `bodyColor` (the theme accent), the light fill `detailColor`.
#pragma once
#include "imgui.h"
namespace dragonx {
namespace util {
// Rasterize `svgText` (nul-terminated SVG markup) to a texture of width `pxSize` (height follows the
// SVG aspect). Fills are recolored by brightness — light fills -> detailColor, darker fills -> bodyColor
// (both forced opaque). Returns false on parse/rasterize/upload failure; on success *outTex is a texture
// the caller owns (release via util::DestroyTexture). Safe to call off the initial frame (needs a live
// GL/DX device, like the other texture loaders).
bool LoadTextureFromSvg(const char* svgText, int pxSize, ImU32 bodyColor, ImU32 detailColor,
ImTextureID* outTex, int* outW, int* outH);
} // namespace util
} // namespace dragonx