Skip to content

gdg-berlin-android/ZePatch

Repository files navigation

ZePatch

Make a composable. Get a real embroidered patch.

ZePatch is a fun Android + Kotlin project from GDG Berlin Android. During events like droidcon, attendees submit small Jetpack Compose snippets (we call them patchables) and receive the result back as a real-world fabric patch. Under the hood, we render composables to bitmaps and convert them to stitch files that an embroidery machine can sew.

Badge Rainbow

License: Apache-2.0 Kotlin Compose BOM Android Gradle Plugin minSdk targetSdk Latest Release

What’s a "patchable"?

A patchable is simply a Composable function annotated with @Patch that ZePatch can capture and turn into stitches.

  • You write a small composable (texts, shapes, icons, etc.).
  • It must contain only one SafeArea composable.
  • You can add interactive elements. Only the part in the SafeArea composable is converted to a patch
  • Annotate it with @Patch("YourNameOrTitle")
  • The build’s KSP processor discovers it and adds it to a registry.
  • The app can render it to a bitmap and the converter turns that into a stitch format (e.g., PES) for embroidery.

See examples

In its simplest form, a patchable looks like this:

@Patch("Hello World") // you need this to register it
@Composable
fun HelloWorld(
    shouldCapture: Boolean = false, // used to activate the convert to bitmap
    onBitmap: (ImageBitmap) -> Unit = {}, // used to return the bitmap from the SafeArea
) {
    // Safe Area is the part that becomes the patch
    SafeArea(
        shouldCapture = shouldCapture, // You need to pass this through from the parent or it won't work
        onBitmap = onBitmap, // You need to pass this through from the parent or it won't work
    ) {
        Text("Hello World!", fontSize = 48.sp) // <- Your creative input goes here
    }
    // Add interactive pieces here. This will not be part of the patch
}

First steps for attendees

  1. Get the code
    • Open in Android Studio (Narwhal+). Let Gradle sync.
    • Or build from CLI: ./gradlew assembleDebug
  2. Run the app
    • Use a device or emulator on Android 8.0 (API 26) or higher.
  3. Make your own patchable
    • Create a Composable and annotate it with @Patch("YourNameOrTitle").
    • Keep it simple, bold, and high-contrast for best stitching results.
    • Rebuild so KSP regenerates the patch registry.
  4. Preview and submit
    • Use the app’s UI to preview and export your patch design.
    • Event staff will provide a USB stick, save your patch on the device.
    • Event staff will embroider your patch.

Tip

Avoid tiny text and hairline strokes. Solid fills and thick lines stitch best.

Project overview

  • app: Jetpack Compose UI and the patch preview/generation flow.
  • patch-annotations: Kotlin annotation(s) like @Patch used to mark composables.
  • patch-processor: KSP processor that finds @Patch composables and generates a registry.
  • converter: Image and stitch conversion utilities, including a Python script to write stitch formats.

Download the latest release

Grab the newest APK from the Releases page:
https://github.com/gdg-berlin-android/ZePatch/releases/latest

Pick up an issue (great for attendees!)

If you’re unsure where to start, grab any "good first issue" or ping maintainers on the issue.

Local setup and building

  • Requirements
    • Android Studio Narwhal+ recommended.
    • JDK bundled with Android Studio is fine.
    • Python 3.8+ is required for certain converter features.
  • Build
    • Android Studio: Build the app module.
    • CLI: ./gradlew assembleDebug
  • Tests
    • Unit tests: ./gradlew test
    • Instrumentation tests: ./gradlew connectedAndroidTest (device/emulator required)

Python path (converter)

If you see missing Python errors, set an environment variable ZEPATCH_PYTHON_PATH to the Python 3.8+ executable on your machine.

Example (macOS/Linux):

export ZEPATCH_PYTHON_PATH=/usr/local/bin/python3

Contributing

Small, focused PRs are welcome. Please include a brief description and screenshots or screen recordings for UI changes when practical. Don’t commit build outputs or generated files.