Hello! I have a question, how to draw a custom ima...
# multiplatform
p
Hello! I have a question, how to draw a custom image resource on Canvas? I tried loading my image via
painterResource("path/to/image.png")
from compose.resources, but the resulting Painter does not have any
DrawScope.draw()
method (a la android Painter), or any way to convert it into ImageBitmap
p
Thank you, I got misled by no autocomplete when in the wrong scope it seems
m
how to use this in drawImage? or set offset, because i have a Canvas and i want to show image in canvas
s
use what?
m
in my Canvas, i want to show a image with specific size and offset for location, draw function not have any offset... drawImage function has offset but it get ImageBitmap instead of ImageVector...
or you can just transform the canvas itself using translate() block
m
yes but it get Imagebitmap, i can not convert my icon to imageBitmap, icons are imageVector
s
oh, use painter then with ImageVector. to offset a drawing use canvas translation
m
thanks a lot, you saved my life :))
👍 1