[Monodroid] Drawables vs Canvas.Draw() methods

Nathan Blevins nblevins at nathanblevins.com
Wed Mar 2 23:08:14 EST 2011


Hey all,

This is more of a basic Android question rather than a MonoDroid question,
so please forgive for the crossover.  I am working on making sure I have a
full understanding of different aspects of working with Graphics in
MonoDroid.  In particular, I am thinking of Drawables vs the Canvas.Draw()
methods.  Below are a few statements that I think are true.  Can you all
confirm to make sure that I am not insane?  :)

The canvas object in android is the primary mechanism for getting your
graphics to the screen.  Basically, it writes to an underlying Bitmap that
fills the space that the canvas represents.  In order to make working w/ the
Canvas easier, there are several methods added to it, such as drawPath(),
drawBitmap(), drawX()...  These are all essentially primitive drawing types.

In order to support some additional fxnality, Android added the Drawable
types via their 2D Graphics library.  These types overlap in purpose w/ some
of the Canvas draw methods (ShapeDrawable vs drawCircle), but provide extra
functionality than the basic cavnas methods.  Another difference w/ this
library is that it handles the drawing to the canvas object as opposed to a
developer designing a primitive type and calling the appropriate
Cavnas.DrawX() method.

Ideally, the cavnas methods will always exceed in performance to the
drawable methods since Drawables are an extra abstraction level.

Is my understanding correct?  Am I missing any nuances that I should
consider?  Thanks!

Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110302/92f03094/attachment.html 


More information about the Monodroid mailing list