`androidx.compose.ui.graphics.FilterQuality.None` ...
# compose-desktop
m
androidx.compose.ui.graphics.FilterQuality.None
- "Fastest possible filtering, albeit also the lowest quality Typically this implies nearest-neighbour filtering." What if I want to always use nearest-neighbour filtering? Is there (yet) an API to specify hard filtering requirement?
r
On Android, you can use
PaintFlagsDrawFilter
on the
Canvas
object to achieve this (https://developer.android.com/reference/android/graphics/PaintFlagsDrawFilter)
I don’t know if Compose for Desktop exposes this though
i
You can force nearest-neighbor using Skia directly:
Copy code
Canvas(Modifier.size(200.dp)) {
    drawIntoCanvas {
        val samplingMode = FilterMipmap(FilterMode.LINEAR, MipmapMode.NEAREST)
        it.nativeCanvas.drawImageRect(image, ..., samplingMode, ...)
    }
}
🙏 1
m
It is remarkable how you can write most of your code in a high-level, declarative way, but easily jump to lower levels whenever needed (unlike e.g. html) 👍