The Android canvas has a method `drawBitmapMesh` ....
# compose-desktop
m
The Android canvas has a method
drawBitmapMesh
. I can’t find this, or any equivalent method, in the Compose canvas, so that I could use that on desktop too. I have to render my images distorted, so that I can accommodate to different projections of my map-tiles.
n
You can access the platform canvas by calling
nativeCanvas
on the compose canvas instance which will return an android.graphics.Canvas for Android and the desktop canvas. You can then call the corresponding methods directly on it.
i
Under the hood Android uses
SkCanvas::drawVertices
and `SkShader::CreateBitmapShader`: https://android.googlesource.com/platform/frameworks/base/+/3660789/core/jni/android/graphics/Canvas.cpp#728 So I think you can implement
drawBitmapMesh
using pure Compose
androidx.compose.ui.graphics.Canvas.drawVertices
and
androidx.compose.ui.graphics.ImageShader
m
@Nader Jawad Yes I know, but the problem is that the desktop canvas does not have a corresponding message.
@Igor Demin Thanks, that gives me some hope but I will have to leave that exercise to a later time when I (hopefully) understand the whole system a little bit better :-)