Hey Y'all,
Still asking for the
lazCAPTCHA thingamaboob I made
While trying to set the background to white I got a solution on
this thread but the solution kinda spawn another issue.
I'm now baffled by why setting the
PixelFormat property of a
TBitmap resets the Canvas Pen and/or Brush!!
Let me explain it with code.
If I do this:
var
Bitmap: TBitmap;
begin
Bitmap:= TBitmap.Create;
Bitmap.Width:= cWidth;
Bitmap.Height:= cHeight;
Bitmap.Canvas.Brush.Color:= clWhite;
Bitmap.PixelFormat:= pf24bit;
Bitmap.Canvas.FillRect(0,0,cWidth,cHeight);
end;
Then the
FillRect is ineffective at painting a white rectangle. I'm presuming that setting the
PixelFormat resets the Brush, but I'm not sure and that's why i need a clarification.
BUT if I do this:
var
Bitmap: TBitmap;
begin
Bitmap:= TBitmap.Create;
Bitmap.PixelFormat:= pf24bit;
Bitmap.Width:= cWidth;
Bitmap.Height:= cHeight;
Bitmap.Canvas.Brush.Color:= clWhite;
Bitmap.Canvas.FillRect(0,0,cWidth,cHeight);
end;
Then the
FillRect does indeed draw a white rectangle.
Is this a bug that needs to be reported to the issue tracking on GitLab?
Many thanks in advance!!
Cheers,
Gus