Share
Embed
Transcript
64 slides
-
Introducing thorvg.flutter! lottie to thorvg, user to contributor Taehyung Kwon
Korea University / Flutter Seoul -
Agenda 1 About Me 2 ThorVG Project 3 thorvg.flutter Project
4 lottie → thorvg, and Contributing 5 From OSS User to Contributor 6 Wrap-up Source: Flutter Logo, ThorVG Logo, Nano Banana Flutter Korea 2025 @TaeBbong -
About Me Taehyung Kwon @TaeBbong B.S., Korea Univ. School of
Cybersecurity Oops, signed a 7-yr security job (5 done) Free Inflearn Flutter course, ~18K students Wrote two borderline embarrassing books Met Flutter in 2019, still getting closer Lately hooked on OSS and Flutter core Flutter Korea 2025 @TaeBbong -
intro: Terms lottie file: a vector-based animation file in JSON
lottie: the existing Flutter package to play them Flutter Korea 2025 @TaeBbong -
intro: Vector Graphics? The “never-pixelated” image format Source: Wikipedia, SVG
Flutter Korea 2025 @TaeBbong -
intro: Vector Graphics? Vector graphics: images as equations Rendering: drawing
by computing them Source: GeoGebra Flutter Korea 2025 @TaeBbong -
intro: 2D Rendering Engines Impeller Renders 2D vector & raster
graphics Source: Skia, Flutter Flutter Korea 2025 @TaeBbong -
intro: 2D Rendering Engines Renders 2D vector & raster graphics
Source: Skia, Flutter, ThorVG Flutter Korea 2025 @TaeBbong -
ThorVG Project Ultralight cross-platform vector engine Light: embeddable from just
150KB Runs on low-end devices like IoT and RTOS No third-party dependencies Multiple hardware acceleration backends Drawing to Lottie, SVG and other standards Source: thorvg.org Flutter Korea 2025 @TaeBbong -
ThorVG Project Someday: Flutter engine contributor → Contribute to ThorVG,
a similar engine → Then dig into the Flutter engine → Learn OSS contribution properly Source: OSSCA website Flutter Korea 2025 @TaeBbong -
Introducing thorvg.flutter! Cross-platform: Windows, MacOS, Linux, Web(WASM), Embedded, Android, iOS,
and Flutter Source: github.com/ThorVG Flutter Korea 2025 @TaeBbong -
Introducing thorvg.flutter! On Flutter, it starts with Lottie animation rendering
A year-old OSS project, growing fast Source: github.com/ThorVG Flutter Korea 2025 @TaeBbong -
Introducing thorvg.flutter! What's a Lottie file? A vector animation file
written in JSON Source: Lottiefiles Flutter Korea 2025 @TaeBbong -
Introducing thorvg.flutter! In flutter, until now? We used the lottie
package Source: Lottiefiles Flutter Korea 2025 @TaeBbong -
Introducing thorvg.flutter! Going from lottie to thorvg is just a
package swap “The new thorvg engine plays lottie files too!” Source: Lottiefiles Flutter Korea 2025 @TaeBbong -
Use thorvg.flutter lottie Flutter Korea 2025 (Almost) the same API
thorvg @TaeBbong -
lottie vs thorvg - Internals Device lottie.json Widget Flutter Framework
App lottie.json Flutter Framework(App) CustomPainter Parsed JSON Canvas drawPath drawImage Rendering Engine Flutter Korea 2025 FFI saveLayer Rendering Engine Skia/Impeller ThorVG lottie thorvg @TaeBbong -
lottie vs thorvg - Internals lottie.json lottie.json Dart VM GC
vs manual C++ memory management drawPath drawImage Skia/Impeller Flutter Korea 2025 saveLayer ThorVG @TaeBbong -
thorvg.flutter - Dev Env Setup thorvg: engine repo linked as
a submodule src/: binding code to use just the engine's Lottie Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Dev Env Setup Engine build → meson, ninja
required Predefined build scripts per platform Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Dev Env Setup Ideally Linux/Mac advised... Engine build
→ needs meson, ninja setup Predefined build scripts per platform Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Dev Env Setup ffi lets Flutter call C++-based
native libraries Source: Google Codelab Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Dev Env Setup Dart/Flutter Side (Managed) 1) Dart
Code (User Code) Struct/Pointer setup, typedefs 2) dart:ffi Binding • Load via DynamicLibrary.open(...) • lookup<NativeFunction<T>> → Dart function pointer 3) Memory/Type Marshalling • calloc / malloc pointer alloc & free • Dart ↔ C types (int, double, Utf8, Struct...) Callbacks via pointers; mind Isolate/thread safety Flutter Korea 2025 Native Side Function call Lookup/Binding Pointer/Buffer Returns/Errors A) Native Library (C/C++/Rust, etc.) Public: extern "C" funcs, fixed ABI B) Thread/State Management • Reentrancy / thread safety • Callback flow to main Isolate C) OS/System Calls • File/net/graphics/device APIs • Per-platform .so/.dll/.dylib Native → Dart callback @TaeBbong -
thorvg.flutter - Dev Env Setup C++ library setup via ffi,
ffigen Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Dev Env Setup Load the built engine lib
dynamically Flutter Korea 2025 @TaeBbong -
thorvg.flutter - PR #25 (First PR) PR made during initial
setup A PR adding common fvm files and the .cxx files generated by Android builds to .gitignore Flutter Korea 2025 @TaeBbong -
thorvg.flutter - PR #25 (First PR) Global OSS, so it's
all in English (best effort ) Flutter Korea 2025 @TaeBbong -
thorvg.flutter - PR #25 (First PR) Easier than I thought?!
Got confident, and greedy Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Issue #26 (1st Oops) Looking for something to
contribute, I pitched dotlottie format support Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Issue #26 (1st Oops) Off from the project's
direction, and my tone didn't suit OSS culture Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Issue #26 (1st Oops) A classic newbie mistake
Respect the process and timelines, and small tasks still matter Source: tvN YouTube Flutter Korea 2025 @TaeBbong -
thorvg.flutter - PR #27 (2nd, Small) Found an error in
the example In the Android example, mismatched namespaces so Activity wasn't found Unified the namespace (org.thorvg.example) Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Issue #22 (1st Fail) Urgent on the roadmap,
seemed doable and meaningful, so I jumped in Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Issue #22 (1st Fail) On iOS, dynamic libraries
can't be shipped, and on arm64-based iOS simulators, dynamic library support wasn't ready Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Issue #22 (1st Fail) Register sources in podspec
Prevent stripping on static link Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Issue #22 (1st Fail) Load the lib with
process() to try static linking Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Issue #22 (1st Fail) Symbol-not-found error Now what
do I do..? Flutter Korea 2025 @TaeBbong -
thorvg.flutter - Issue #22 (1st Fail) No C++ or native
iOS experience, so it was very hard Promised to study more and retry (aka ran away) Flutter Korea 2025 @TaeBbong -
thorvg.flutter - PR #31 (My Strengths) Issue when Lottie has
no size set and the parent provides it Flutter Korea 2025 @TaeBbong -
thorvg.flutter - PR #31 (My Strengths) Lottie's size calc logic
ignored parent constraints Flutter Korea 2025 @TaeBbong -
thorvg.flutter - PR #31 (My Strengths) Filed an issue first,
then started with warm buy-in Flutter Korea 2025 @TaeBbong -
thorvg.flutter - PR #31 (My Strengths) 1. Get parent constraints
via LayoutBuilder 2. Extend RenderBox and write the layout logic 3. Read size via context.findRenderObject() Flutter Korea 2025 @TaeBbong -
thorvg.flutter - PR #31 (My Strengths) Get final size via
context.findRenderObject(), then draw from the 2nd frame Flutter Korea 2025 @TaeBbong -
thorvg.flutter - PR #31 (My Strengths) Found a real problem
to solve in the project, shared it as an issue first to build consensus, and drew on my background (Flutter pipeline) Flutter Korea 2025 @TaeBbong -
Wrap-up For lottie in Flutter, thorvg is a new choice
Flutter Korea 2025 @TaeBbong -
Wrap-up From user to contributor: hard at first, but anyone
can do it Flutter Korea 2025 @TaeBbong -
Wrap-up In OSS, no one sits beside you, but it's
teamwork with many people, so communication skills matter Flutter Korea 2025 @TaeBbong -
Wrap-up Not contributing for its own sake, but to grow
the project and myself Flutter Korea 2025 @TaeBbong -
Wrap-up We all have our strengths, so find where yours
can help Flutter Korea 2025 @TaeBbong