Call canvas.translate(-x), draw, then call canvas.translate(x) You are moving the location on the canvas underneath where you draw, after you have drawn whatever you need to move the canvas back.
On Mar 21, 8:47 am, Jeffrey <jeffisagen...@gmail.com> wrote: > Is there a way around having to call canvas.drawbitmap() every time? > And if I call canvas.translate() after drawing the image doesn't move, > it instead moves everything that would draw *after* the call to > canvas.translate(). > > Thank you for your help so far, and I'm hoping you have just a little > bit left in you :) > > On Mar 20, 9:12 am, Riyad Kalla <rka...@gmail.com> wrote: > > > > > Jeffrey, > > > To what Peter said, mobile devices are very fill-rate-limited (at > > least these current gen of phones) so depending on how you are > > repainting that image over and over and over again to the Canvas, that > > could explain the speed issue. > > > If you tried a tiny little 16x16 icon and it went much faster with the > > same code, then I think you've found your culprit. > > > Regardless, Peter's approach sounds like the right way; upload image > > data to the GPU one, then just move your "view" of it around in a > > circle, panning across the image. > > > On Mar 19, 3:07 pm, Jeffrey <jeffisagen...@gmail.com> wrote: > > > > I'm trying to make a simple (or so I thought) live wallpaper that > > > takes an image and moves it slowly in a circular motion, to make the > > > picture seem less static and more like looking out a window. I took > > > the live wallpaper tutorial from the SDK and stripped it down to the > > > bare bones so I could add to it. But the issue is that no matter what > > > size the image I'm moving, or what format (drawable or bitmap), it is > > > only getting about 3 fps. > > > > I don't know what to do to make this run faster, I have very limited > > > programming knowledge so I don't know if I'm missing something stupid. > > > > Also, this is the code I'm using to calculate the circular movement: > > > > int NewX = (int) (OffsetX + Math.sin(Dist)*19); > > > int NewY = (int) (OffsetY + Math.cos(Dist)*19); > > > > where Dist is the speed it's moving and 19 is the radius of the > > > circle. > > > > Is there an easier way? I looked into Tween animation but I don't know > > > how I would implement my circle code into it.- Hide quoted text - > > - Show quoted text - -- 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