Well you cannot change the data pointer, because it is registered to the operating system to be a part of memory that contains an image.
What you can do is to copy pixel data to a buffer, and use this buffer, for example :
var bgra: BGRABitmap;
buffer1, buffer2: Pointer;
Begin
...
bgra.TextOut(...)
getmem(buffer1, bgra.NbPixels* sizeof(TBGRAPixel) );
move(bgra.Data^, buffer1^, bgra.NbPixels* sizeof(TBGRAPixel) );
bgra.Clear;
bgra.TextOut(...)
getmem(buffer2, bgra.NbPixels* sizeof(TBGRAPixel) );
move(bgra.Data^, buffer2^, bgra.NbPixels* sizeof(TBGRAPixel) );
...
move(buffer1^, bgra.Data^, bgra.NbPixels* sizeof(TBGRAPixel) );
bgra.InvalidateBitmap;
bgra.Draw(...)
move(buffer2^, bgra.Data^, bgra.NbPixels* sizeof(TBGRAPixel) );
bgra.InvalidateBitmap;
bgra.Draw(...)
freemem(buffer1);
freemem(buffer2);
end;
If do not want to copy the data to draw it, you can use the following method :
BGRABitmapDraw(ACanvas: TCanvas; Rect: TRect; AData: Pointer;
VerticalFlip: boolean; AWidth, AHeight: integer; Opaque: boolean);
So in this case, after creating buffer1 and buffer2, you can draw it like that :
BGRABitmapDraw(Canvas, Rect(0,0,bgra.Width,bgra.Height), Buffer1, bgra.LineOrder=riloBottomToTop, bgra.Width,bgra.Height, False);
BGRABitmapDraw(Canvas, Rect(0,0,bgra.Width,bgra.Height), Buffer2, bgra.LineOrder=riloBottomToTop, bgra.Width,bgra.Height, False);
You can also use DataDrawOpaque or DataDrawTransparent function of your bgra instance.