Calling setMatrix() will override the existing transforms set on the Canvas. The Canvas passed to View.onDraw() may already have transforms set to draw in the correct location. Instead of using setMatrix(), using Canvas.translate(), Canvas.scale(), etc. Don't forget to use Canvas.save() and restore().
On Thu, Jan 31, 2013 at 6:04 PM, dashman <[email protected]> wrote: > this is the onDraw method for my View sub-class > > drawCross() is a simple method that draws a cross. > > shouldn't this code result in overlapping crosses. > > trying to understand the translate method. > > > drawCross( canvas, 200, 400 ); // no transformations > > Matrix m = new Matrix(); > > m.setTranslate( 200, 400 ); > > canvas.setMatrix(m); > > drawCross( canvas, 0, 0 ); > > in my case - the 2nd cross is being drawn about 100 px above > the first. same x. > > -- > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Android Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Romain Guy Android framework engineer [email protected] -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

