How to draw part of an image using arduboy.drawBitmap?

I have a wide background where I only want to draw part of the image.

Can I do that using drawBitmap?

Any examples of code?

No. The best way is to slice up your image into images that are screen size and then scroll them left and right. Adding the next image onto the left or right of it depending on what direction you are scrolling in.

Mike is right but technically if your image width is < 255 it’d probably still work just fine with drawBitmap IIRC. (the parts not onscreen would simply get clipped)

@Dreamer3 Haha, remember my masking code from Sprites?. That would be useful here :'D.

Masking (with a separate mask) is the wrong answer for BOTH problems (your original one and this one). All he’s wanting is a RANGE of the image… you don’t need a mask for that. You just need a way to say image is 64x64, draw portion from 0,32 to 64,64… etc… you want clipping, not masking. Very different concepts (with clipping being far simpler).

I’m actually working on a very similar problem for my application library. It needs to be able to clip images to 'windows" inside the screen and the existing code only clips to the entire screen. That might ultimately make it back into Arduboy2, we’ll see.

Thnx for your input, now I have something to work with :slight_smile:

Cheers Jacoste

Well, if your background is only 8 pixels high, you can.