An open API service indexing awesome lists of open source software.

https://github.com/brys0/compose-blurhash

A high performance implementation of blurhash for Compose Multiplatform. Utilizes SKSL shaders for performant rendering.
https://github.com/brys0/compose-blurhash

blurhash compose compose-multiplatform compose-multiplatform-library kotlin kotlin-multiplatform-library

Last synced: about 2 months ago
JSON representation

A high performance implementation of blurhash for Compose Multiplatform. Utilizes SKSL shaders for performant rendering.

Awesome Lists containing this project

README

          

# Compose blurhash
Provides multiplatform library to use [blurhash](https://blurha.sh/) in your compose app.

Using SKSL/AGSL for the best possible performance compared to regular bitmap alternatives.

## What platforms are currently supported
- [x] WasmJS/Browser
- [x] Desktop/JVM
- [x] iOS/Apple
- [x] Android

## Usage

Add this to your build.gradle.kts

```kt
implementation("io.github.brys0:blurhash:0.0-4-ALPHA")
```

You can now use it like this
```kt
@Composable
fun MyComposable() {
BlurHashImage(
"URGtW@NM}FV?w7={wOi{xYi%s,sm-CNZnPxt", // Your blurhash string
modifier = Modifier.fillMaxSize() // Modifiers you would like to apply
)
}
```

## Project Structure

This project contains several modules each for a different purpose.

1. `blurhash` - Contains the public code for implementing in your project
2. `blurhash-skio` - Contains the code specific to skia related implementations (WasmJS/Desktop/iOS)
3. `blurhash-shader` - Contains the shader related code and processing
4. `sample` - Contains a super simple sample project to demo the functionality

## Accreditation

- [peerless2012](https://github.com/peerless2012) For personally helping me get this project adapted over to compose and for his [blurhash implementation for android](https://github.com/peerless2012/blurhash-android)
- [blurha](https://blurha.sh/) For providing a reference on implementation, as well as creating a very simplistic and elegant solution to placeholder images
- [shady](https://github.com/drinkthestars/shady) For providing a reference on how to implement shader based code into compose specifically
- [blurhash_shader](https://github.com/xioxin/blurhash_shader) For providing the initial shader code to base sksl shader code off of
- [Romain Guy](https://www.romainguy.dev/posts/2024/optimization-step-by-step/) For providing a fast and performant color calculation for blurhash strings