Re: Clearing a bitmap?
- Posted by DerekParnell (admin) Jun 27, 2009
- 777 views
lockiedownunder said...
Awesome thanks.
You're welcome. That flickering when clearing the viewport (moving the image down or right) can be fixed too. I was just lazy so I clear the entire viewport. All you need to do is just clear the one or two rectangles that were exposed when the image moved. The two rectangles are the boxes whose top-left and bottom-right corners are ...
- (Old_DestX, Old_DestY)
- (Old_DestX, Old_DestY)
Just do a drawRectangle() call (filled of course) with the viewport's background color for both of these boxes. Note that you can avoid drawing both if Old_DestY = New_DestY or Old_DestX = New_DestX.
I'll leave this as an exercise