mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 18:39:10 +02:00
TAChart: Fix false colors in TManhattanSeries. Issue #38759.
git-svn-id: trunk@65002 -
This commit is contained in:
parent
0a2e80cbc4
commit
87b1cb08ba
@ -917,10 +917,27 @@ var
|
|||||||
rawImage: TRawImage;
|
rawImage: TRawImage;
|
||||||
r: TRect;
|
r: TRect;
|
||||||
|
|
||||||
procedure PutPixel(const APoint: TPoint; AColor: TChartColor); inline;
|
{ Fix for issue #38759:
|
||||||
|
In TColor, the byte layout is - from low to high - "rgba". The rawimage
|
||||||
|
data block however must have the byte order "bgra". Therefore, we must
|
||||||
|
exchange r and b to avoid false colors.
|
||||||
|
Note: It does not work out to init the rawimage by Init_BPP32_R8G8B8A8_BIO_TTB
|
||||||
|
(rather than by Init_BPP32_B8G8R8A8_BIO_TTB) - no idea why... }
|
||||||
|
function FixColor(AColor: TChartColor): Cardinal; inline;
|
||||||
|
type
|
||||||
|
TQuad = packed array[0..3] of byte;
|
||||||
|
var
|
||||||
|
quad: TQuad absolute AColor;
|
||||||
begin
|
begin
|
||||||
PCardinal(rawImage.Data)[APoint.Y * r.Right + APoint.X] :=
|
TQuad(Result)[0] := quad[2];
|
||||||
Cardinal(ColorDef(AColor, SeriesColor)) or $FF000000; // Opacity.
|
TQuad(Result)[1] := quad[1];
|
||||||
|
TQuad(Result)[2] := quad[0];
|
||||||
|
TQuad(Result)[3] := $FF; // Opacity
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure PutPixel(const APoint: TPoint; AColor: TChartColor);
|
||||||
|
begin
|
||||||
|
PCardinal(rawImage.Data)[APoint.Y * r.Right + APoint.X] := FixColor(ColorDef(AColor, SeriesColor));
|
||||||
cnt += 1;
|
cnt += 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user