Fastest way to erase a bitmap

3 posts / 0 new
Last post
YesCop
YesCop's picture
Offline
Last seen: 3 years 7 months ago
Joined: 2011-05-17 15:07
Fastest way to erase a bitmap

Hello there.
For AmigaOS4.1 last update.

I would want to find the best and fastest way to clear a (big like 1600x1050) bitmap.
For the moment I use BltClear from graphics library.
To use it I call LockBitmap before.

First, I have found that BltClear is not fast I supposed.
Second, it clears bitmap with 0. What could I do if I want to use a ARGB value?

Thanks for reading.

salass00
salass00's picture
Offline
Last seen: 1 year 1 month ago
Joined: 2011-02-03 11:27
Re: Fastest way to erase a bitmap
  1. void ClearBitMapARGB(struct BitMap *bm, uint32 argb) {
  2. struct RastPort temp_rp;
  3. int32 width, height;
  4.  
  5. width = IGraphics->GetBitMapAttr(bm, BMA_WIDTH);
  6. height = IGraphics->GetBitMapAttr(bm, BMA_HEIGHT);
  7.  
  8. IGraphics->InitRastPort(&temp_rp);
  9. temp_rp.BitMap = bm;
  10.  
  11. IGraphics->RectFillColor(&temp_rp, 0, 0, width - 1, height - 1, argb);
  12. }
YesCop
YesCop's picture
Offline
Last seen: 3 years 7 months ago
Joined: 2011-05-17 15:07
Re: Fastest way to erase a bitmap

Thanks Salass.
I will test your solution as soon as possible.

Log in or register to post comments