Releases: goyox86/thorvg-rs
thorvg 0.4.2
Documentation-only release. No code, API, or behavior change — a patch
bump so the revised docs render on docs.rs.
Documentation
- Reviewed every public item against the ThorVG C API (
thorvg_capi.h
contracts andtvgCapi.cppbehavior) and corrected inaccuracies in
error conditions, parameter units/ranges, ownership/lifetime claims,
defaults, and experimental status. Notable fixes:TextMetrics::advance
is the vertical line advance (not a horizontal run advance); theScene
drop-shadow default direction claim was removed;Shapestroke defaults,
the empty-dash-slice error, and circular trim-path wrapping are now
documented. - Normalized the rustdoc to one style — terse summaries,
# Errors/
# Safety/# Panicssections, intra-doc links, sharpened safety and
reliability contracts, and a per-module link to the upstream
C API docs.
thorvg 0.4.1
Portability and documentation fixes. No API change — a patch bump.
Fixed
- Windows (MSVC) build. Path-command decoding no longer depends on
bindgen's enum repr: theTVG_PATH_COMMAND_*constants arec_uinton
most targets butc_inton MSVC, which broke thematch(E0308). - Three broken rustdoc intra-doc links (
Thorvg::load_font,
BorrowedPaint,BorrowedPaint::paint_type).
Changed
- Depends on
thorvg-sys0.2.1, which carries the MSVC and
system-library (pkg-config) build fixes.
thorvg 0.4.0
Tracks ThorVG 1.0.6 (via thorvg-sys 0.2). Picks up the upstream
API changes that affect the safe surface.
Changed (breaking)
- Depends on
thorvg-sys0.2 (bundling ThorVG 1.0.6).
Added
LottieAnimation::set_audio_resolver/clear_audio_resolverand the
AudioInfoborrowed view — safe wrappers over ThorVG 1.0.6's new
Lottie audio-resolver callback, for synchronizing external audio
playback with the animation timeline. The closure is heap-stored and
unregistered on drop (same ownership model as the asset resolver).
Experimental upstream.EngineOption::Aliased— re-introduced upstream in ThorVG 1.0.6
(disables anti-aliased rendering). Marked experimental by upstream.
TheEngineOptionenum is#[non_exhaustive], so this is additive.
Removed (breaking)
LottieAnimation::assign— the underlying experimental
tvg_lottie_animation_assignC API was removed in ThorVG 1.0.6.
thorvg-sys 0.2.1
Build-system and portability fixes; still bundles ThorVG 1.0.6. No
API change — a patch bump.
Fixed
- System (non-vendored) build now finds ThorVG 1.x.
link_system
probed the unversionedthorvgpkg-config module, but ThorVG 1.x
installsthorvg-1(mesonfilebase: 'thorvg-' + vmaj). Probe
thorvg-1first, falling back tothorvgfor distros that ship the
unversioned name. - MSVC vendored build. Define
NOMINMAX— the Windows SDK's
min/maxmacros mangledtvgMath.h'sPoint min(...)/max(...)
declarations (C2059) — and pass/EHscfor the standard C++ exception
model. - Static linkage on MSVC. Define
TVG_STATIC: the vendored library
is linked as a static archive, but without it the C API expanded to
__declspec(dllimport)and MSVC rejected the definitions (C2491).
thorvg-sys 0.2.0+thorvg-1.0.6
Bundles ThorVG 1.0.6. The minor bump reflects a breaking change to
the generated FFI surface (a removed C API symbol).
Changed
- Bumped vendored ThorVG to 1.0.6. The seven bare-metal patches that
sat onv1.0.5were rebased unchanged ontov1.0.6.
Added
tvg_lottie_animation_set_audio_resolver, theTvg_Audio_Resolver
callback type, and theTvg_Audio_Infostruct — new in ThorVG 1.0.6
for synchronizing external audio playback with the Lottie timeline.TVG_ENGINE_OPTION_ALIASED— re-introduced upstream (disables
anti-aliased rendering); it had been dropped in 1.0.5.
Removed
tvg_lottie_animation_assign— removed upstream in ThorVG 1.0.6.
Breaking for any code that called it through the raw bindings.
thorvg 0.3.0
A large API-hardening and ergonomics release. The headline themes are
type-safety (enums and parameter structs replacing primitives), a
shared color module, sealed traits, lifetime-correct borrowed views,
and a sweep of memory-safety fixes around FFI ownership.
Changed (breaking)
- Colors are now typed.
Text::set_color/set_outlinetake
Rgb;Shapefill/stroke and gradientColorStoptakeRgba.
Rawu8channel arguments are gone.Rgb/Rgbalive in a shared
colormodule, which now also hostsColorSpace. EngineOptionis a plain enum (None/Default/SmartRender)
matching the C++ engine's exact-equality semantics, instead of a
bitflags newtype.Shapepaint order is aPaintOrderenum (FillThenStroke/
StrokeThenFill) instead of abool.- Shape primitives take parameter structs —
RectandCircle
(with builders andDefault) replace long positional argument lists. - Scene effects take parameter structs —
GaussianBlur,
DropShadow,Tint, andTritone(builders +Default); blur
direction and border are now enums rather than ints. Effect methods
were renamed for consistency. - Factory methods return
Resultacross paint/scene/picture/text/
animation/saver/accessor/gradient, instead of panicking or returning
bare handles on allocation failure. set_mask/set_clipconsume the paint by value, modelling the
ownership transfer to the C engine (prevents double-free / leaks).Canvas::pushandScene::pushrenamed toaddfor C API parity.Picture::load_datatakes a typedMimeTypeenum instead of a
string.- Font-loading API moved from
TexttoThorvg(it is engine-global
state, not per-text). Thorvg::initsignature is gated on thethreadsfeature.PaintandCanvasare now sealed traits — they cannot be
implemented downstream.from_rawconversions are exhaustive forPaintTypeand
MaskMethod, andShapeenums (FillRule,StrokeCap,StrokeJoin)
are exhaustive.
Added
- Typed
Path/PathCommand/Segmentmodel;Shape::pathreturns
it andShape::append_pathcloses the round-trip.Segmentsnow
implementssize_hint. Text::textgetter (C parity).Shape::set_stroke_radial_gradient(C parity).- Chainable
Matrixtransform combinators. Point::newplus rounded-out ergonomics and enum-variant docs.GlCanvas/WgCanvasGPU target builders for API parity (the
vendored build still strips the GPU engine).- Safe, closure-based
Picture::set_asset_resolver;BorrowedAccessor
andBorrowedPaintare passed intofor_eachvisitors. impl From<NulError> for Error, soCStringconstruction works with
?.- Gradient kinds are enumerated in
PaintType.
Fixed
- Memory leaks in
Paint::set_clip/set_maskand a leaked gradient
handle inShape(now exposed as aBorrowedGradientview). Leaks are
memory-safe; the related double-free is listed under Security below. Paint's mask getter called the wrong C API; replaced with the correct
one.Animation::pictureandPicture::get_paintnow return stable borrows
(&Picture/BorrowedPaint) instead of a rebuilt wrapper / raw
handle — clearer ownership. (Neither was unsound in prior releases.)- Hardened the newly safe, closure-based
Picture::set_asset_resolver
(new in this release, see Added) so its trampoline pointer stays stable
across moves of the picture.
Security
Several FFI-ownership and bounds bugs that were unsound — reachable
from safe code without unsafe — are fixed in this release. All of
them affect published versions ≤ 0.2.0 (the APIs date back to the
initial release) and are fixed in 0.3.0; users should upgrade.
0.1.0 and 0.1.1 were already yanked.
- Use-after-free in
Saver::save_animation. - Dangling input buffers —
Picture::load_data/Picture::load_raw
andText::load_font_datadid not tie the borrowed slice's lifetime to
the consuming object, so the engine could read freed memory after the
slice was dropped. The buffer lifetime is now enforced by the type
system. - Out-of-bounds read in
Picture::load_raw— the pixel-buffer length
was not validated against the declaredwidth × height; now
bounds-checked. - Out-of-bounds write in
SwCanvas::set_target— the target buffer
size computation could overflow and accept an undersized buffer; now
overflow-checked. - Double-free via
Paint::set_clip/set_mask— these took the
clipper/mask by reference while the engine took ownership, so the Rust
wrapper and the engine could both free it. They now consume the paint
by value. - Undefined behaviour on panic across FFI — a panic in a user closure
passed toAccessor::for_eachunwound through anextern "C"
trampoline (UB). Such closures are now wrapped incatch_unwindunder
std; theno_stdpanic policy is documented.
Removed
- The unused, unsafe
Accessor::setraw-FFI escape hatch.
Deprecated
Gradient::get_transform— renamed totransformfor consistency
withPaint::transform.
thorvg-sys 0.1.0+thorvg-1.0.5
First release under the crate's own versioning. Supersedes the yanked
1.0.0 / 1.0.1 / 1.0.5, which mirrored the upstream ThorVG version
number 1:1 — a scheme abandoned because it left no room to publish
sys-crate-only changes (build system, bare-metal support) while upstream
stayed at 1.0.5. Bundles ThorVG 1.0.5.
Changed
- Versioning scheme — the crate version is now independent of
upstream; the bundled ThorVG release is carried as+thorvg-X.Y.Z
build metadata. The previous upstream-mirroring1.0.xreleases are
yanked.
Build system
- Replaced the meson + ninja build with the
cccrate — ThorVG is
compiled from source via Cargo's configured (cross-)compiler; no meson
or ninja required. - Feature-gated loaders and capabilities —
lottie,svg,png,
fonts,expressions,threads,file-ioCargo features select
which ThorVG components compile (all enabled by default; embedded users
disable defaults and pick what they need). - bindgen now passes an explicit
--target=to libclang on host builds.
Bare-metal support (target_os = "none")
- Toolchain-agnostic cross-compilation pipeline, split into bare-metal
vs. SDK-runtime policy. - Vendors picolibc (submodule pinned to 1.8.11) as the libc on
bare-metal: compile-timepicolibc.hconfiguration plus a compile-only
validation phase inbuild.rs. - Per-concern runtime stubs welded to picolibc declarations with weak
linkage; bridges newlib's__errno()to picolibc's plainerrno;
stubs_on_exit. - RISC-V canonical-multilib selection;
expressionsenabled on
bare-metal ESP32-C6.
Vendored ThorVG patches
- Local shims layered on ThorVG 1.0.5 to support bare-metal builds:
absearchshim, a Lottie-loader shim extension, and runtime-stub
welding acrosstvgLock.h,tvgInitializer.cpp,tvgRender.cpp,
tvgSwRenderer.cpp, andtvgSwMemPool.cpp.