mcpp index

compat.nanosvg

#include

NanoSVG — small SVG parser that flattens paths to beziers, with an optional rasterizer

#include <nanosvg.h>
mcpp add compat.nanosvg@2026.07.09

用法

來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。

// compat.nanosvg — parse a real SVG document and rasterize it.
//
// This asserts three separate things the package must get right:
//   1. `<nanosvg.h>` / `<nanosvgrast.h>` resolve (include_dirs points at src/),
//   2. the parser's output is real geometry, not an empty image, and
//   3. the generated implementation TU is actually linked -- BOTH halves of it.
//      nsvgParse comes from nanosvg.h's implementation and nsvgRasterize from
//      nanosvgrast.h's, so if the package only instantiated one of the two this
//      test fails at link time rather than silently passing.
#include <nanosvg.h>
#include <nanosvgrast.h>
import std;

int main() {
    bool ok = true;
    auto check = [&](bool cond, std::string_view what) {
        if (!cond) {
            std::println("FAIL: {}", what);
            ok = false;
        }
    };

// …

tests/examples/nanosvg/tests/parse.cpp · 專案 tests/examples/nanosvg

建置

targets
nanosvg (lib)
language
c++23
C standard
c11
import std
no
include dirs
*/src

原始檔 (1)

  • mcpp_generated/nanosvg_impl.c

產生的檔案

  • mcpp_generated/nanosvg_impl.c

版本

版本平台 鏡像sha256
2026.07.09 最新 LinuxWindowsmacOS GLOBAL CN 2bc68bdb518d…