mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 00:38:14 +02:00
change argument names
git-svn-id: trunk@12953 -
This commit is contained in:
parent
6b823ed766
commit
980c6a4889
@ -251,7 +251,7 @@ type
|
|||||||
procedure SetRawImage(const ARawImage: TRawImage; ADataOwner: Boolean = True); virtual;
|
procedure SetRawImage(const ARawImage: TRawImage; ADataOwner: Boolean = True); virtual;
|
||||||
procedure GetRawImage(out ARawImage: TRawImage); virtual;
|
procedure GetRawImage(out ARawImage: TRawImage); virtual;
|
||||||
procedure FillPixels(const Color: TFPColor); virtual;
|
procedure FillPixels(const Color: TFPColor); virtual;
|
||||||
procedure CopyPixels(ASource: TFPCustomImage; xoffs: Integer = 0; yoffs: Integer = 0); virtual;
|
procedure CopyPixels(ASource: TFPCustomImage; XDst: Integer = 0; YDst: Integer = 0); virtual;
|
||||||
procedure AlphaFromMask(AKeepAlpha: Boolean = True);
|
procedure AlphaFromMask(AKeepAlpha: Boolean = True);
|
||||||
procedure GetXYDataPostion(x, y: integer; out Position: TRawImagePosition);
|
procedure GetXYDataPostion(x, y: integer; out Position: TRawImagePosition);
|
||||||
procedure GetXYMaskPostion(x, y: integer; out Position: TRawImagePosition);
|
procedure GetXYMaskPostion(x, y: integer; out Position: TRawImagePosition);
|
||||||
@ -3082,7 +3082,7 @@ begin
|
|||||||
// ToDo: mask
|
// ToDo: mask
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLazIntfImage.CopyPixels(ASource: TFPCustomImage; xoffs: Integer = 0; yoffs: Integer = 0);
|
procedure TLazIntfImage.CopyPixels(ASource: TFPCustomImage; XDst: Integer = 0; YDst: Integer = 0);
|
||||||
var
|
var
|
||||||
SrcImg: TLazIntfImage absolute ASource;
|
SrcImg: TLazIntfImage absolute ASource;
|
||||||
x, y, xStop, yStop: Integer;
|
x, y, xStop, yStop: Integer;
|
||||||
@ -3092,7 +3092,7 @@ begin
|
|||||||
SetSize(Src.Width,Src.Height);
|
SetSize(Src.Width,Src.Height);
|
||||||
}
|
}
|
||||||
if (ASource is TLazIntfImage) and
|
if (ASource is TLazIntfImage) and
|
||||||
FRawImage.Description.IsEqual(SrcImg.FRawImage.Description) and (xoffs = 0) and (yoffs = 0) then
|
FRawImage.Description.IsEqual(SrcImg.FRawImage.Description) and (XDst = 0) and (YDst = 0) then
|
||||||
begin
|
begin
|
||||||
// same description -> copy
|
// same description -> copy
|
||||||
if FRawImage.Data <> nil then
|
if FRawImage.Data <> nil then
|
||||||
@ -3104,21 +3104,21 @@ begin
|
|||||||
|
|
||||||
// copy pixels
|
// copy pixels
|
||||||
xStop := ASource.Width;
|
xStop := ASource.Width;
|
||||||
if Width - xoffs < xStop
|
if Width - XDst < xStop
|
||||||
then xStop := Width - xoffs;
|
then xStop := Width - XDst;
|
||||||
yStop := ASource.Height;
|
yStop := ASource.Height;
|
||||||
if Height - yoffs < yStop
|
if Height - YDst < yStop
|
||||||
then yStop := Height - yoffs;
|
then yStop := Height - YDst;
|
||||||
Dec(xStop);
|
Dec(xStop);
|
||||||
Dec(yStop);
|
Dec(yStop);
|
||||||
for y:=0 to yStop do
|
for y:=0 to yStop do
|
||||||
for x:=0 to xStop do
|
for x:=0 to xStop do
|
||||||
Colors[x+xoffs,y+yoffs] := ASource.Colors[x,y];
|
Colors[x+XDst,y+YDst] := ASource.Colors[x,y];
|
||||||
|
|
||||||
if ASource is TLazIntfImage then
|
if ASource is TLazIntfImage then
|
||||||
for y:=0 to yStop do
|
for y:=0 to yStop do
|
||||||
for x:=0 to xStop do
|
for x:=0 to xStop do
|
||||||
Masked[x+xoffs,y+yoffs] := SrcImg.Masked[x,y];
|
Masked[x+XDst,y+YDst] := SrcImg.Masked[x,y];
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ var
|
|||||||
|
|
||||||
SrcImg, DstImg: TLazIntfImage;
|
SrcImg, DstImg: TLazIntfImage;
|
||||||
SrcHasAlpha, KeepAlpha: Boolean;
|
SrcHasAlpha, KeepAlpha: Boolean;
|
||||||
l, r: integer;
|
ALeft, ATop: integer;
|
||||||
begin
|
begin
|
||||||
SrcHasAlpha := SrcImage.Description.AlphaPrec > 0;
|
SrcHasAlpha := SrcImage.Description.AlphaPrec > 0;
|
||||||
KeepAlpha := SrcHasAlpha;
|
KeepAlpha := SrcHasAlpha;
|
||||||
@ -89,9 +89,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
DstImg := TLazIntfImage.Create(RawImage, False);
|
DstImg := TLazIntfImage.Create(RawImage, False);
|
||||||
l := (RawImage.Description.Width - SrcImage.Description.Width) div 2;
|
ALeft := (RawImage.Description.Width - SrcImage.Description.Width) div 2;
|
||||||
r := (RawImage.Description.Height - SrcImage.Description.Height) div 2;
|
ATop := (RawImage.Description.Height - SrcImage.Description.Height) div 2;
|
||||||
DstImg.CopyPixels(SrcImg, l, r);
|
DstImg.CopyPixels(SrcImg, ALeft, ATop);
|
||||||
if not SrcHasAlpha
|
if not SrcHasAlpha
|
||||||
then begin
|
then begin
|
||||||
DstImg.AlphaFromMask;
|
DstImg.AlphaFromMask;
|
||||||
@ -124,6 +124,7 @@ begin
|
|||||||
InternalSetImage(RawImg, SrcImage);
|
InternalSetImage(RawImg, SrcImage);
|
||||||
|
|
||||||
// force output png with colorformat = 4
|
// force output png with colorformat = 4
|
||||||
|
// to do this we need halftone alpha
|
||||||
if PRGBAQuad(RawImg.Data)[0].Alpha = 0 then
|
if PRGBAQuad(RawImg.Data)[0].Alpha = 0 then
|
||||||
PRGBAQuad(RawImg.Data)[0].Alpha := $01
|
PRGBAQuad(RawImg.Data)[0].Alpha := $01
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user