I want to ask about fast "clearing" image to transparency color.
Something like: FillRect(Brushes.Transparent, 10, 20, 16, 16), but
because all new pixels are transparent then... all will be ignored.
Generally I have buffer (Bitmap) object. This buffer is divided on
tiles. At any time I want to "clear" specified tile (ex. it could be
buffer rectangle, x:30, y:70, w:10, w:10.
Right now I'm using:
BitmapData bData = _mapBuffers[layerLevel].LockBits(new Rectangle(bx,
by, tileWidth, tileHeight), ImageLockMode.WriteOnly,
PixelFormat.Format32bppArgb);
for (int i = 0; i < tileHeight; i++) {
int* ptrData = (int*)bData.Scan0 + (i * bData.Stride /
sizeof(int));
for (int j = 0; j < tileWidth; j++) {
(*ptrData++) = 0;
//ptrData++;
}
}
_mapBuffers[layerLevel].UnlockBits(bData);
Unfortunatelly other drawing is using Graphics object and I have to
release locked bits.
Does anyone know how to make it better (faster)?
Wojciech Gebczyk
Should work.
v