Keep your Kotlin code. Keep your Compose UI. Apply one Gradle plugin and let Kanvas take over the rendering path.
Kanvas is a Gradle plugin that integrates a native GPU rendering runtime into Kotlin/JVM desktop applications.
Kanvas is designed to be added to an existing Kotlin project rather than forcing the application into a custom engine or framework.
For a normal Compose Desktop app, the intended workflow is:
- apply
org.yurie.kanvas - point Kanvas at the application module
- choose a renderer, or leave it on
auto - run
kanvasDoctor - build, run, or package through the Kanvas tasks
Your application code stays Kotlin. Your Compose UI stays Compose. Kanvas handles the renderer integration underneath it.
Kotlin / Compose application
|
v
Kanvas Gradle plugin
|
+--> runtime provisioning
+--> compatibility checks
+--> Java/Skiko interception
+--> renderer capture/takeover
|
v
native GPU runtime
|
+-----+-----+------+
| | | |
Metal Vulkan OpenGL D3D9
The repository contains the plugin itself plus the implementation it installs and drives: the Java agent, renderer layer, native C/JNI runtime, Compose integration, diagnostics, packaging support, and graphics backends.
Warning
Kanvas is pre-release software. The plugin and renderer takeover path are functional, but full Compose rendering parity and complete cross-platform hardware verification are still in progress.
Until Kanvas is published through the Gradle Plugin Portal, use a Kanvas checkout as an included plugin build.
Clone Kanvas next to your project:
git clone https://github.com/Yuries-Public-Stuff/Kanvas.gitExample:
projects/
├── Kanvas/
└── my-app/
Add Kanvas to your application's settings.gradle.kts:
pluginManagement {
includeBuild("../Kanvas/gradle-plugin")
}Then apply the plugin:
plugins {
id("org.yurie.kanvas")
}For a multi-module app, point Kanvas at the module that owns the desktop application:
kanvas {
target = ":desktop"
}If the application is in the root project, Kanvas can target the root project directly.
Start by checking the project:
./gradlew kanvasDoctor
./gradlew kanvasCompatibilityThen use the Kanvas lifecycle tasks:
./gradlew kanvasBuild
./gradlew kanvasRunFor a Compose Desktop distributable:
./gradlew kanvasPackageKanvas resolves the configured application tasks, prepares the native runtime when required, injects the renderer integration into the JVM process, and launches the app through the selected backend.
| Task | Purpose |
|---|---|
kanvasDoctor |
Diagnose the host, JDK, native toolchain, backend, target project, application tasks, and runtime setup |
kanvasCompatibility |
Inspect detected Kotlin/Compose/Skiko runtime compatibility |
kanvasRuntime |
Build or provision the Kanvas native runtime |
kanvasRefreshRuntime |
Refresh the cached runtime and rebuild it |
kanvasBuild |
Run the configured application build task |
kanvasRun |
Launch the configured app with Kanvas renderer integration |
kanvasPackage |
Run the configured packaging/distributable task with Kanvas included |
Most applications only need:
kanvas {
target = ":desktop"
backend = "auto"
}The full extension currently exposes:
kanvas {
// Where Kanvas source/runtime artifacts come from.
home = ""
sourceUrl = "https://github.com/Yuries-Public-Stuff/Kanvas.git"
sourceRef = ""
// Renderer selection.
backend = "auto"
runtimeBuildType = "Release"
// Application project/tasks.
target = ":desktop"
buildTask = ""
runTask = ""
packageTask = ""
// Optional explicit runtime artifacts.
agentJar = ""
nativeLibrary = ""
// Renderer/runtime behavior.
strictRenderer = false
takeover = true
capture = true
audit = true
autoBuildRuntime = true
}Normally you should let Kanvas detect the build, run, and package tasks instead of setting them manually.
For every option and task override, see Configuration.
Kanvas is not just a launcher around the platform's normal renderer.
For supported Compose/Skiko paths, the runtime intercepts the final drawing flow, captures the frame, and sends it into the Kanvas native renderer.
The current modern Compose Desktop path includes support for Skiko picture-replay interception, allowing the final recorded Compose frame to pass through Kanvas rather than relying only on individual Canvas calls.
Renderer diagnostics can be enabled with:
kanvas {
audit = true
capture = true
}For stricter development testing:
kanvas {
strictRenderer = true
}Strict mode is intended to expose unsupported rendering paths instead of quietly hiding them during development.
| Platform | Primary backend | Additional implemented paths | Notes |
|---|---|---|---|
| macOS | Metal | — | Current macOS GPU path |
| Linux | Vulkan | — | Attached rendering currently targets X11/XWayland |
| Windows | Vulkan | Direct3D 9, OpenGL | GDI remains available as a software/reference path |
Backend values:
auto
vulkan
metal
opengl
d3d9
gdi
For almost every project, start with:
kanvas {
backend = "auto"
}Current auto behavior:
- macOS: Metal
- Linux: Vulkan
- Windows: Vulkan, then Direct3D 9, then OpenGL, with GDI available as a reference/safety path
Backend availability still depends on the host OS, driver stack, and native toolchain.
See Backend Status for the implementation and verification matrix.
Kanvas may need to build native runtime components for the host system.
Typical requirements are:
- JDK 17+
- Gradle or a Gradle wrapper
- Git
- CMake 3.21+
- a native C/C++ toolchain
- platform graphics/runtime libraries required by the selected backend
Run:
./gradlew kanvasDoctorbefore debugging the renderer manually. Doctor checks the important host, project, runtime, and backend prerequisites and reports blocking failures separately from warnings.
Platform-specific prerequisites are documented in Getting Started.
Kanvas does not assume that every Compose or Skiko build exposes the same renderer internals.
The compatibility tooling inspects the runtime actually used by the target application and reports what Kanvas sees:
./gradlew kanvasCompatibilityCurrent source-verified renderer lines include:
- Compose Desktop 1.8.2
- Compose Desktop 1.11.1
- Skiko 0.9.4.2
- Skiko 0.144.6
Those versions represent renderer ABI lines that have been investigated by the project. A compatibility report is not a guarantee that every drawing operation or every GPU/driver combination is fully supported.
See Compatibility for the full matrix and testing notes.
For Compose Desktop applications:
./gradlew kanvasPackageKanvas integrates with the detected distributable task and includes the renderer runtime needed by the packaged application.
Packaging remains pre-release. Test packaged builds on each operating system and architecture you intend to ship.
The Gradle plugin is the normal integration path.
For compatibility testing, Kanvas also includes a zero-edit adapter that can inject the integration into another Gradle repository without permanently modifying that repository.
./kanvas ../my-app --doctor --target :desktop
./kanvas ../my-app --compat --target :desktop
./kanvas ../my-app --run --target :desktop --backend metalVerbose development diagnostics:
./kanvas ../my-app --run --target :desktop --backend metal --devStrict renderer testing:
./kanvas ../my-app --run --target :desktop --backend metal --strict-renderer.\kanvas.ps1 ..\my-app -Mode Doctor
.\kanvas.ps1 ..\my-app -Mode RunThe adapter is mainly useful for answering:
Can Kanvas integrate with this application before I add the plugin to its build?
If something fails, start with:
./gradlew kanvasDoctor
./gradlew kanvasCompatibilityRenderer runs can also produce audit/capture information used to verify whether Kanvas actually owns the rendering path.
Common failure categories include:
- missing native build tools
- an unsupported backend on the host platform
- an incorrectly detected application module/task
- a Compose/Skiko runtime ABI Kanvas does not recognize
- a drawing operation that is not yet handled by the renderer takeover
- missing runtime artifacts
See Troubleshooting before opening an issue.
Kanvas is now primarily a Gradle-plugin-driven integration rather than a standalone renderer experiment.
Implemented:
-
org.yurie.kanvasGradle plugin - automatic runtime provisioning/build hooks
- Doctor and compatibility tasks
- configurable build/run/package task integration
- Compose Desktop / Skiko interception
- modern Skiko picture-replay capture path
- Kotlin renderer/display-list layer
- native C/JNI runtime
- macOS Metal backend
- Linux Vulkan backend
- Windows Vulkan backend
- Windows OpenGL backend
- Windows Direct3D 9 backend
- GDI software/reference path
- packaging integration
- renderer audit/capture tooling
- zero-edit compatibility adapter
Still in progress:
- full Compose rendering parity
- complete native text/effect coverage
- broader GPU/driver validation
- native Wayland attached rendering
- complete ARM64 release verification
- Gradle Plugin Portal publication
The detailed implementation tracker is in TODO.md.
gradle-plugin/ org.yurie.kanvas plugin and Gradle tasks
integration-agent/ JVM instrumentation and Compose/Skiko interception
integration/ zero-edit Gradle adapter
renderer/ Kotlin renderer and display-list layer
compose-bridge/ Compose-facing renderer integration
native/ C/JNI runtime and platform graphics backends
examples/ example Gradle projects using Kanvas
docs/ setup, compatibility, architecture, and support docs
scripts/ build, verification, and maintenance tooling
The Gradle plugin is the entry point. The other modules are the runtime and implementation layers it coordinates.
- Getting Started — install and apply the Gradle plugin
- Configuration — plugin DSL, tasks, backends, and overrides
- Compatibility — Kotlin, Compose, Skiko, JDK, and platform compatibility
- Backend Status — renderer implementation status
- Architecture — plugin/runtime/renderer architecture
- Known Limitations — current renderer and platform limits
- Troubleshooting — setup and renderer diagnostics
- Examples — example projects
- FAQ — common questions
- Changelog — user-facing changes
- Roadmap — active implementation work
See CONTRIBUTING.md for development setup and contribution requirements.
Repository-wide guidance for AI coding tools and automated contributors is in AI.md.
When reporting renderer problems, include:
OS:
Architecture:
GPU:
Backend:
JDK:
Kotlin:
Compose Desktop:
Skiko:
Kanvas commit:
and attach the renderer audit output when available.
Kanvas is licensed under the Apache License 2.0. See LICENSE.
Security issues should follow SECURITY.md.