Axarydax
Axarydax

Reputation: 16633

draw to canvas without regard to DPI

I'm developing a simple arcade game and I'd like to paint the graphics onto a Canvas without regard for the device DPI, just the pixels. If I do some drawing in 240x320 pixels emulator, I'd like the Canvas to have 240x320 pixels. Canvas.getWidth() and getHeight() tell me that I have 240x320 pixels Canvas, but when I draw a line by g.drawLine(0,0, 240, 320, activePaint); a line gets drawn only to (180;240). It's scaled by DPI somehow, but I'd like to draw to the exact pixels. Is there a simple fix to this? Thanks

Upvotes: 0

Views: 1127

Answers (1)

GeekYouUp
GeekYouUp

Reputation: 1651

If I understand your question correctly then all you should need to do specify the supports-screens anyDensity=true and smallScreens=true into your manifest. That should stop the scaling from happening.

details here: http://developer.android.com/guide/topics/manifest/supports-screens-element.html

Upvotes: 2

Related Questions