Redrawing only a portion of LCDBitmap with the C api on linux?

I have been reading through the bachelor's thesis that is on the links page.

I have gotten to the part where it is suggested to add a background to the hello world sample code. Is it possible to only redraw a portion of a Bitmap? Can I copy a chunk of one bitmap into a new one and then draw that to the screen?

Instead of copying twice, you can use a clip rect to limit drawing to just a portion of the bitmap. If (x,y,w,h) gives the dimensions of the rectangle on screen and (imx,imy) is the top-left point of the rectangle in the image, then this draws just that rectangle from the bitmap:

pd->graphics->setClipRect(x,y,w,h);
pd->graphics->drawBitmap(image, x-imx, y-imy, kBitmapUnflipped);
pd->graphics->clearClipRect();
2 Likes

Excellent thanks for the help!