Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flip vertically an Android Canvas

Is there an easy way to flip a canvas in Android? I cant seem to find anything that allows me to flip it vertically so that zero on the y-axis is the bottom of the phone screen instead of the top. It's OK if the solution isn't especially fast because I'm not doing anything computationally intense with the canvas.

Thanks in advance.

like image 936
Chris Avatar asked Mar 07 '12 22:03

Chris


1 Answers

Try

canvas.scale(1f, -1f, width / 2f, height / 2f)

See Canvas.scale documentation. The first two parameters are the amount to scale by.

like image 137
you786 Avatar answered Oct 14 '22 06:10

you786