On MacOS, drawing on a Tbitmap.Canvas changes R, G, B values
Hi,
When I draw on the canvas of a 24bit Tbitmap with a certain brush color (e.g. clRed, R=255, G=0, B=0), the color values are slightly shifted on MacOS. clRed gives these values : R=251, G=0, B=7.
Here is some code example to reproduce the issue (put a TButton called TestButton and a TImage containing a 24bit bitmap on Form1) :
procedure TForm1.TestButtonClick(Sender: TObject);
var
j: Integer;
TempBmpPixels: Array [0..32767] of pRGBArray;
begin
for j := 0 to TestImage.Picture.Bitmap.height - 1 do
begin
TempBmpPixels[j] := TestImage.Picture.Bitmap.ScanLine[j];
end;
TestImage.Picture.Bitmap.Canvas.Brush.Color:=clRed;
TestImage.Picture.Bitmap.Canvas.FillRect(TestImage.ClientRect);
Showmessage(inttostr(TempBmpPixels[100,100].rgbtRed)+' '+inttostr(TempBmpPixels[100,100].rgbtGreen)+' '+inttostr(TempBmpPixels[100,100].rgbtBlue));
end;
Attached are the screenshots on Windows 10 and on MacOs Big Sur.
I guess this is due to some color profile correction on the Mac, but how can I avoid this?
Best regards
Comments (3)
-
repo owner -
reporter That’s great news, thanks. Looking forward to v1.50.
-
repo owner - changed status to resolved
At 1.50
- Log in to comment
We are doing big internal refactoring of graphics (GDI, GDI+) in preparing to support mobile & HiDPI. We don’t have such behavior on our new internal build. We are going to release CrossVcl 1.50 in a month.