mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-26 15:08:18 +02:00
AggPas: Fix coordinate calculation in Pixels and Colors properties of TAggFPImage
git-svn-id: trunk@40143 -
This commit is contained in:
parent
13ba6e1d8e
commit
193deb2aba
@ -741,6 +741,9 @@ function AggUTF8CharToUnicode(p: PChar; out CharLen: int): int32u;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
const
|
||||||
|
PixelSize: array [TAggFPImgPixelFormat] of Integer = (3, 4);
|
||||||
|
|
||||||
var
|
var
|
||||||
g_approxScale : double = 2.0;
|
g_approxScale : double = 2.0;
|
||||||
|
|
||||||
@ -920,7 +923,7 @@ var
|
|||||||
p: PByte;
|
p: PByte;
|
||||||
begin
|
begin
|
||||||
if (x>=0) and (y>=0) and (x<Width) and (y<Height) then begin
|
if (x>=0) and (y>=0) and (x<Width) and (y<Height) then begin
|
||||||
p:=@FData[y*Width+x];
|
p:=@FData[(y*Width+x) * PixelSize[PixelFormat]];
|
||||||
case PixelFormat of
|
case PixelFormat of
|
||||||
afpimRGB24:
|
afpimRGB24:
|
||||||
begin
|
begin
|
||||||
@ -944,7 +947,7 @@ var
|
|||||||
p: PByte;
|
p: PByte;
|
||||||
begin
|
begin
|
||||||
if (x>=0) and (y>=0) and (x<Width) and (y<Height) then begin
|
if (x>=0) and (y>=0) and (x<Width) and (y<Height) then begin
|
||||||
p:=@FData[y*Width+x];
|
p:=@FData[(y*Width+x) * PixelSize[PixelFormat]];
|
||||||
case PixelFormat of
|
case PixelFormat of
|
||||||
afpimRGB24:
|
afpimRGB24:
|
||||||
begin
|
begin
|
||||||
@ -975,7 +978,7 @@ function TAggFPImage.GetInternalPixel(x, y: integer): integer;
|
|||||||
var
|
var
|
||||||
p: PByte;
|
p: PByte;
|
||||||
begin
|
begin
|
||||||
p:=@FData[y*Width+x];
|
p:=@FData[(y*Width+x) * PixelSize[PixelFormat]];
|
||||||
case PixelFormat of
|
case PixelFormat of
|
||||||
afpimRGB24:
|
afpimRGB24:
|
||||||
begin
|
begin
|
||||||
@ -994,7 +997,7 @@ procedure TAggFPImage.SetInternalPixel(x, y: integer; Value: integer);
|
|||||||
var
|
var
|
||||||
p: PByte;
|
p: PByte;
|
||||||
begin
|
begin
|
||||||
p:=@FData[y*Width+x];
|
p:=@FData[(y*Width+x) * PixelSize[PixelFormat]];
|
||||||
case PixelFormat of
|
case PixelFormat of
|
||||||
afpimRGB24:
|
afpimRGB24:
|
||||||
begin
|
begin
|
||||||
@ -1070,20 +1073,12 @@ end;
|
|||||||
|
|
||||||
function TAggFPImage.DataSize: PtrUInt;
|
function TAggFPImage.DataSize: PtrUInt;
|
||||||
begin
|
begin
|
||||||
Result:=Width*Height;
|
Result:=Width*Height*PixelSize[PixelFormat];
|
||||||
case PixelFormat of
|
|
||||||
afpimRGB24: Result:=Result*3;
|
|
||||||
afpimRGBA32: Result:=Result*4;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TAggFPImage.LineSize: PtrUInt;
|
function TAggFPImage.LineSize: PtrUInt;
|
||||||
begin
|
begin
|
||||||
Result:=Width;
|
Result:=Width*PixelSize[PixelFormat];
|
||||||
case PixelFormat of
|
|
||||||
afpimRGB24: Result:=Result*3;
|
|
||||||
afpimRGBA32: Result:=Result*4;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TAggFPCanvas }
|
{ TAggFPCanvas }
|
||||||
|
Loading…
Reference in New Issue
Block a user