I have some complex graphics to draw using Canvas but I am confused by
the documentation.

I can get the size of the screen using
getResources().getDisplayMetrics() and looking at widthPixels and
heightPixels. For my AVD this is 1250x800. I can also check this in my
onDraw() method by using Canvas.getWidth() and Canvas.getHeight() and
these return the same results.

I split the screen into two parts by a vertical divide at 1066 so my
left side should have 1066 pixels width. However, if I draw a test
line with marks at every 100 pixels I can see that using an x value of
800 in, say, Canvas.drawLines(...) I am at the vertical divide (which
should be pixel value 1066). How is this possible?

I don't see anything in the documentation for Canvas methods to say
that the parameters are dp units so I assume they are physical pixels.
Is that correct? My AVD density is 240. If the Canvas methods do use
dp, is it possible to draw using physical pixels?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to