finds.dev← search

// the find

romainguy/v9

★ 361 · Kotlin · Apache-2.0 · updated Dec 2023

Vector 9-patches for Android.

A small Android library from Romain Guy that lets you resize a vector Path the way 9-patch bitmaps stretch — define slices and the corners/edges stay fixed while the rest scales. Useful for anyone drawing chat bubbles, rounded cards, or other vector shapes that need to flex with content instead of looking distorted when scaled.

The core idea is genuinely clever and solves a real gap — Android has 9-patch for bitmaps but nothing equivalent for Path objects until this. API is minimal: slice() once, call resize() as many times as you want, and there's an overload that reuses an existing Path to avoid allocations in draw loops. Comes from someone who wrote a chunk of Android's graphics stack, so the math around proportional stretching across multiple slices is correct and not a naive hack.

Single-file library (PathResizer.kt) with no releases since late 2023, so a two-year-old dependency with no public indication it's still maintained or used beyond its author's demos. Only one test file (PathResizerTest.kt) for a geometry-heavy library where edge cases — overlapping slices, zero-size target dimensions, slices outside path bounds — are exactly where bugs hide. Documentation is a single example in the README; no API docs or KDoc comments mentioned, so understanding behavior for anything beyond the basic rectangle-slice case means reading the source.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →