# jmseb3/capturable architecture

> Architecture diagram of the GitHub repository jmseb3/capturable, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jmseb3/capturable
- Repository: https://github.com/jmseb3/capturable

## Overview

Capturable is a Compose Multiplatform library that turns marked composable content into an ImageBitmap, with an optional extension for encoding, saving, and sharing captures. The main flow is: a caller marks content and requests a capture; the modifier records and converts the drawing; the controller completes the asynchronous result. Extension helpers then encode that result and hand it to platform save or share facilities. Core capture and save behavior is excerpted; platform-specific integrations are represented where the README documents them, but unsampled implementations are not treated as inspected.

Main entry points: [`capturable/src/commonMain/kotlin/dev/wonddak/capturable/controller/CaptureController.kt`](https://github.com/jmseb3/capturable/blob/master/capturable/src/commonMain/kotlin/dev/wonddak/capturable/controller/CaptureController.kt) (Capture controller), [`capturableExtension/src/jvmMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndShare.jvm.kt`](https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/jvmMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndShare.jvm.kt) (Platform sharing), [`capturable/src/commonMain/kotlin/dev/wonddak/capturable/Capturable.kt`](https://github.com/jmseb3/capturable/blob/master/capturable/src/commonMain/kotlin/dev/wonddak/capturable/Capturable.kt) (Capturable modifier), [`capturableExtension/src/nonWebMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndSave.nonweb.kt`](https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/nonWebMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndSave.nonweb.kt) (Platform save)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Core capture"]
  node_modifier["Capturable modifier<br/>[Capturable.kt]"]
  node_controller["Capture controller"]
  node_bitmap["ImageBitmap"]
end

subgraph group_formats["Image formats"]
  node_image_type["Image format"]
  node_encoder["Bitmap encoder"]
end

subgraph group_save["Save helpers"]
  node_save_api["Capture and save"]
  node_save_impl["Platform save"]
  node_filekit[("FileKit storage")]
end

subgraph group_share["Share helpers"]
  node_share_api["Capture and share"]
  node_share_platform["Platform sharing"]
  node_mac_share["macOS share picker<br/>[ShareByMacShare.kt]"]
  node_share_service["Native share service"]
  node_clipboard[("System clipboard")]
  node_web_share["Web Share API"]
  node_download["Browser download"]
end

node_caller(("Library caller"))

node_caller -->|"marks content"| node_modifier
node_caller -->|"requests capture"| node_controller
node_modifier -->|"collects requests"| node_controller
node_modifier -->|"converts drawing"| node_bitmap
node_modifier -->|"completes request"| node_controller
node_caller -->|"invokes save"| node_save_api
node_save_api -->|"captures image"| node_controller
node_save_impl -->|"awaits capture"| node_controller
node_save_impl -->|"encodes bitmap"| node_encoder
node_encoder -->|"uses format"| node_image_type
node_save_impl -->|"writes or saves"| node_filekit
node_caller -.->|"invokes share"| node_share_api
node_share_platform -->|"awaits capture"| node_controller
node_share_platform -->|"tries macOS share"| node_mac_share
node_mac_share -.->|"opens picker"| node_share_service
node_share_platform -->|"encodes clipboard image"| node_encoder
node_share_platform -->|"copies image"| node_clipboard
node_share_api -.->|"uses when available"| node_web_share
node_share_api -.->|"falls back to"| node_download

click node_modifier "https://github.com/jmseb3/capturable/blob/master/capturable/src/commonMain/kotlin/dev/wonddak/capturable/Capturable.kt"
click node_controller "https://github.com/jmseb3/capturable/blob/master/capturable/src/commonMain/kotlin/dev/wonddak/capturable/controller/CaptureController.kt"
click node_save_api "https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndSave.kt"
click node_save_impl "https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/nonWebMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndSave.nonweb.kt"
click node_image_type "https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/CapturableSaveImageType.kt"
click node_encoder "https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/encodeToByteArray.kt"
click node_share_api "https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndShare.kt"
click node_share_platform "https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/jvmMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndShare.jvm.kt"
click node_mac_share "https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/jvmMain/kotlin/dev/wonddak/capturable/extension/platform/macos/ShareByMacShare.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_modifier,node_controller,node_bitmap toneBlue
class node_image_type,node_encoder toneAmber
class node_save_api,node_save_impl,node_filekit toneMint
class node_share_api,node_share_platform,node_mac_share,node_share_service,node_clipboard,node_web_share,node_download toneRose
class node_caller toneIndigo
```

## Components

### Core capture

- [Capturable modifier](https://github.com/jmseb3/capturable/blob/master/capturable/src/commonMain/kotlin/dev/wonddak/capturable/Capturable.kt): `capturable/src/commonMain/kotlin/dev/wonddak/capturable/Capturable.kt`
- [Capture controller](https://github.com/jmseb3/capturable/blob/master/capturable/src/commonMain/kotlin/dev/wonddak/capturable/controller/CaptureController.kt): `capturable/src/commonMain/kotlin/dev/wonddak/capturable/controller/CaptureController.kt`
- **ImageBitmap**

### Image formats

- [Image format](https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/CapturableSaveImageType.kt): `capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/CapturableSaveImageType.kt`
- [Bitmap encoder](https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/encodeToByteArray.kt): `capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/encodeToByteArray.kt`

### Save helpers

- [Capture and save](https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndSave.kt): `capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndSave.kt`
- [Platform save](https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/nonWebMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndSave.nonweb.kt): `capturableExtension/src/nonWebMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndSave.nonweb.kt`
- **FileKit storage**

### Share helpers

- [Capture and share](https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndShare.kt): `capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndShare.kt`
- [Platform sharing](https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/jvmMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndShare.jvm.kt): `capturableExtension/src/jvmMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndShare.jvm.kt`
- [macOS share picker](https://github.com/jmseb3/capturable/blob/master/capturableExtension/src/jvmMain/kotlin/dev/wonddak/capturable/extension/platform/macos/ShareByMacShare.kt): `capturableExtension/src/jvmMain/kotlin/dev/wonddak/capturable/extension/platform/macos/ShareByMacShare.kt`
- **Native share service**
- **System clipboard**
- **Web Share API**
- **Browser download**

### Other components

- **Library caller**

## Connections

- Library caller → Capturable modifier: marks content (evidence: `README.md`)
- Library caller → Capture controller: requests capture (evidence: `README.md`)
- Capturable modifier → Capture controller: collects requests (evidence: `capturable/src/commonMain/kotlin/dev/wonddak/capturable/Capturable.kt`)
- Capturable modifier → ImageBitmap: converts drawing (evidence: `capturable/src/commonMain/kotlin/dev/wonddak/capturable/Capturable.kt`)
- Capturable modifier → Capture controller: completes request (evidence: `capturable/src/commonMain/kotlin/dev/wonddak/capturable/Capturable.kt`)
- Library caller → Capture and save: invokes save (evidence: `README.md`)
- Capture and save → Capture controller: captures image (evidence: `capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndSave.kt`)
- Platform save → Capture controller: awaits capture (evidence: `capturableExtension/src/nonWebMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndSave.nonweb.kt`)
- Platform save → Bitmap encoder: encodes bitmap (evidence: `capturableExtension/src/nonWebMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndSave.nonweb.kt`)
- Bitmap encoder → Image format: uses format (evidence: `capturableExtension/src/commonMain/kotlin/dev/wonddak/capturable/extension/encodeToByteArray.kt`)
- Platform save → FileKit storage: writes or saves (evidence: `capturableExtension/src/nonWebMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndSave.nonweb.kt`)
- Library caller → Capture and share: invokes share (evidence: `README.md`)
- Platform sharing → Capture controller: awaits capture (evidence: `capturableExtension/src/jvmMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndShare.jvm.kt`)
- Platform sharing → macOS share picker: tries macOS share (evidence: `capturableExtension/src/jvmMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndShare.jvm.kt`)
- macOS share picker → Native share service: opens picker (evidence: `README.md`)
- Platform sharing → Bitmap encoder: encodes clipboard image (evidence: `capturableExtension/src/jvmMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndShare.jvm.kt`)
- Platform sharing → System clipboard: copies image (evidence: `capturableExtension/src/jvmMain/kotlin/dev/wonddak/capturable/extension/CaptureAsyncAndShare.jvm.kt`)
- Capture and share → Web Share API: uses when available (evidence: `README.md`)
- Capture and share → Browser download: falls back to (evidence: `README.md`)
