https://kotlinlang.org logo
Title
t

theapache64

04/10/2021, 7:44 AM
This could be a dumb question 😬. How do I
drawImage
(
Canvas
) with "pixelated" output?
r

romainguy

04/10/2021, 7:44 AM
You mean when you scale the image?
t

theapache64

04/10/2021, 7:44 AM
Yes
When I zoom the input image, the output looks like this. (pixelated)
r

romainguy

04/10/2021, 7:46 AM
In the
Paint
you pass to
drawImage
set the
filterQuality
to
None
I believe
t

theapache64

04/10/2021, 7:47 AM
and when I
drawImage
, it looks like this.
@romainguy Okay, let me try that.
@romainguy Looks like there's no
Paint
param 🤔
t

theapache64

04/10/2021, 7:56 AM
okay, I think i need to use
drawIntoCanvas
then
but then the problem is
Canvas#drawImage
doesn't accept
srcOffset
😬. It got only destination offset(
topLeftOffset
)
Also doesn't have
dstSize
😞 I think i have to do all thse manually now.
androidx.compose.ui.graphics.drawscope.DrawScope#drawImage
was easier
It would be great if
DrawScope#drawImage
can accept
Paint
object 😬
Ohh I didn't knw abt that method 😮
It worked :android-dance:
Thanks @Aaron Yoder @romainguy 🙇
a

Aaron Yoder

04/10/2021, 10:16 AM
Sorry, deleted my comment because I thought I misunderstood the question after looking at the documentation, but apparently not. 😅 For anyone else: use
Canvas#drawImageRect
t

theapache64

04/10/2021, 10:17 AM
😄 👍
c

Colton Idle

04/11/2021, 2:07 AM
@theapache64 can't wait to play Super Mario Compose. 😄