Skip to content
Debanshu777Public

About

GPU shader effects for Jetpack Compose and Compose Multiplatform. Kotlin library for Android, iOS, desktop and WebAssembly using AGSL and SkSL.

Topics

Resources

Contributing

Stars

14 stars

Watchers

0 watching

Forks

Latest commit

 

History

55 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShaderX — GPU shader effects for Kotlin and Compose Multiplatform, illustrated by a blue halftone flower

ShaderX — shaders for Compose Multiplatform

Turn images, text, and Compose UI into print textures, moving surfaces, or your own AGSL/SkSL effects. Shared Kotlin API for Android, iOS, desktop, and WebAssembly.

Maven Central CI Apache 2.0 license

Gallery · Get started · Live app demos · Documentation

Gallery

Custom materials, animated type, grain and motion—then the tools to make them your own. Open a preview for a closer look, or follow its effect link for the recipe.

Effect recipes and platform limits.

A black-and-gold membership interface with an original moving gold foil surface and serif lettering
Gold foil membership
Custom foil
A pale type-design interface with blue and magenta scan bands masked to large monospaced FORM FREQ glyphs
Chromatic type specimen
Custom scan
A coral hand-wash bottle ripples over a blue water illustration beside an editorial product description
Skincare product preview
Ripple
An emerald focus interface with softly flowing green and amber layers of procedural noise
Atmospheric focus
Animated layered noise
A static ivory-and-navy botanical print with fine stochastic ink grain and large Wild forms lettering
Stippled botanical print
Static stochastic noise
A red-and-blue editorial art print develops halftone dots over an original geometric portrait
Halftone art print
Halftone
A cobalt arcade interface with a pink controller motif and a waving yellow Start a round button
Arcade call to action
Wave distortion
A purple pixel-platformer scene changes dither intensity behind a separate yellow title and game controls
Dithered platformer
Ordered dither
A red-and-black listening room pulses chromatic separation on an original vinyl cover illustration
Chromatic record player
Chromatic aberration
A graphite image editor adjusts a citrus illustration with synchronized numeric values and sliders
Citrus color editor
Color adjustment

More effect comparisons: gradients, plasma, grayscale, blur, sepia and pixelation. Try the apps below.

Get started

0.2.0 is available on Maven Central. Release notes · Publication status.

Add Maven Central to your repositories, then add ShaderX to commonMain.dependencies in your shared module:

implementation("io.github.debanshu777:shaderx:0.2.0")

Android requires API 31+ for native blur, API 33+ for AGSL, compile SDK 35+, and Java 17 bytecode; iOS, JVM desktop, and Wasm use Skia. Contributor builds use JDK 21; the current checkout uses Kotlin 2.3.21 / Compose Multiplatform 1.10.3. Setup and version catalogs.

Pass your existing Compose resource or image-loader Painter:

import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import com.debanshu.shaderlab.shaderx.compose.shaderEffect
import com.debanshu.shaderlab.shaderx.effect.impl.GrayscaleEffect

@Composable
fun GrayscalePhoto(painter: Painter, modifier: Modifier = Modifier) {
    Image(
        painter = painter,
        contentDescription = "Grayscale photo",
        modifier = modifier.shaderEffect(GrayscaleEffect(intensity = 1f)),
    )
}

Swap in SepiaEffect(), NativeBlurEffect(radius = 8f), or PixelateEffect(pixelSize = 12f). The same modifier works on text, cards, and other Compose content.

Gradle repository setup

Add Maven Central to your repositories in settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
    }
}

Pause, seek and respect reduced motion

The ordinary modifier animates built-ins with Modifier.shaderEffect(WaveEffect(amplitude = 5f, frequency = 9f)).

For retained pause/seek/speed control, keep playback outside changing effect values. The host supplies lifecycle and reduced-motion preferences.

import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import com.debanshu.shaderlab.shaderx.compose.controlledShaderEffect
import com.debanshu.shaderlab.shaderx.compose.rememberShaderPlayback
import com.debanshu.shaderlab.shaderx.effect.impl.WaveEffect

@Composable
fun WavePhoto(painter: Painter, active: Boolean, reducedMotion: Boolean) {
    val playback = rememberShaderPlayback(active = active, reducedMotion = reducedMotion)
    Image(
        painter, "Image with wave distortion",
        modifier = Modifier.controlledShaderEffect(
            WaveEffect(amplitude = 5f, frequency = 9f), playback,
        ),
    )
}

Optional controls use playback.isPlaying = false, playback.seekTo(2.5), and playback.speed = 0.5. Playback, live inputs, and ownership.

Effects and custom authoring

Family Effects
Color and image Grayscale, sepia, gradient, vignette, pixelation, chromatic aberration, invert, native blur
Motion and audio Wave, animated gradient, plasma, ripple, vortex, audio visualizer/distortion
Color and print collection Color adjustment/matrix, ordered dither, halftone

ShaderX provides editable custom definitions, controlled playback, procedural backgrounds, explicit data/child inputs, ordered Skia chains, support/fallback reports, and bounded Skia PNG export. Platform limits · Upgrade guide · Release history.

Live app demos

Try the controls yourself in ShaderX Sampler or ShaderLab. Sampler walks through Basic, Custom, Animation and Chain; ShaderLab lets you tune effects, edit shader source and build ordered pipelines.

Prefer running locally? Download the source ZIP and follow the desktop and Android setup. See separate run instructions for ASCII camera and movie carousel.

Current ShaderX Sampler browser app demonstrating Basic, Custom, Animation and Chain tabs, live wave playback and effect reordering
ShaderX Sampler
Four playable examples
Current ShaderLab desktop browser app demonstrating Gallery animation, a successful custom source run, and ordered pipeline editing
ShaderLab playground
Gallery · Source · Pipeline
A pale-blue print tool compares two effect orders on an original concentric-ring optical illustration
Optical print proof
Blur → dots / dots → blur · Try in ShaderLab
Current ShaderLab WebAssembly app at a 390 by 844 browser viewport, demonstrating grayscale, wave playback, effect selection and plasma
ShaderLab · narrow browser
Explore the playground · Sample app
Animated CameraX preview transformed into ASCII characters with a custom ShaderX shader
Live ASCII camera
CameraX + custom shader · Sample app
Animated movie carousel applying shader effects as cards scroll
Scroll-driven movie cards
Scroll + shader parameters · Sample app

Reference

Custom shaders · Compose and animation · Image processing · Coil and Haze · Troubleshooting

Contribute through CONTRIBUTING.md and the setup and validation guide. Every code change updates this README and affected guides. Release checks keep the build version, install snippets and changelog aligned; compatibility tests retain published modifier callbacks and Wave copy/destructuring. CI smoke-tests the installed sandboxed Chrome on both OSes and bounds macOS native-build concurrency. Gallery recipes and capture provenance record effect boundaries and validation limits. Release plan · Changelog · Publishing and release workflow.

Apache License 2.0.

About

GPU shader effects for Jetpack Compose and Compose Multiplatform. Kotlin library for Android, iOS, desktop and WebAssembly using AGSL and SkSL.

Topics

Resources

Contributing

Stars

14 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages