Tag Archive: SIMD
KSVG: A Modern SVG Renderer for Android
Rendering fidelity, GPU-accelerated filters, and SIMD-optimized CPU rendering.
Where It All Started
It all started with an icon that wouldn’t render correctly.
While working on NewsFeed Launcher, I came across an icon displayed inside the app that wasn’t rendering correctly. It turned out to be an SVG rendered by AndroidSVG, so I went straight to the library’s source code to find out what was going wrong.
Eventually I found it: the image used an SVG <mask>, and the original Java renderMask mishandled mask positioning and sizing: it ignored the x and y attributes, used incorrect default dimensions and offsets, and failed to constrain the mask to its declared region. It also used full-canvas intermediate layers for compositing.
From a Fix to a Full-Fledged Renderer
AndroidSVG had other shortcomings too. I initially set it aside, but returned a few weeks later with a plan to move it to Kotlin and address some of the missing features. Filters were the biggest gap, so that became the next major area of work. The project gradually evolved into a renderer I could rely on in production. The development took roughly two and a half to three months to reach its current state.
AI tools also played a useful role in the implementation, particularly in writing and refining the assembly kernels. I used them to explore implementation approaches, while parity tests and measurements on actual devices determined what made it into the final code.
The move to Kotlin was about more than translating the existing Java code. I wanted an implementation that was easier to reason about and a public API that felt natural to Android developers today — myself included. KSVG is Kotlin-first rather than “pure Kotlin”: the API and rendering core are Kotlin, while the filter engine uses native code where the pixel work needs it.
Inline higher-order functions were one practical reason for choosing Kotlin. They let me keep expressive abstractions in performance-sensitive code without adding function-object overhead in the hot paths where lambdas would otherwise be created repeatedly during drawing or animation updates.
What you get from KSVG
