Scrolling a WriteableBitmap

May 18, 2011 at 2:35 PM

I'm using a WriteableBitmap that is slightly bigger than the viewport. I want to give the illusion of a continuous scroll (horizontal) and was wondering if it's possible to clear a certain area of the WriteableBitmap and then move it to the right hand side of the screen, so that it scrolls back towards the left. I assume I can `blit` the region, but how can I 'move' it from the left side of the screen to the right side? Or is there a better way of giving the illusion of a continuous scroll, whilst using a WriteableBitmap? I hope the questions were clear :) Thanks for any help.

May 18, 2011 at 2:47 PM

Yes, use the Blit method and change the source parameters over time. This will be extremely fast if you use BlendMode.None and no tint color.

- Rene 

May 18, 2011 at 2:52 PM

Wow, thanks for the super quick reply! Should I be translating the actual image control at the same time, or can the scrolling be done purely in a  WriteableBitmap?

May 18, 2011 at 3:19 PM

Leave the image static and assign one WriteableBitmap with fixed size as Source of the Image control. Use this WB1 as the destination of your blitting, where you blit a part of the large background WB2 onto the  WB1

May 18, 2011 at 4:59 PM

Got it, thanks a lot for your help!