mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 01:29:30 +02:00
lcl: imagelist: add TCustomImageList.AddSlice function. Issue #33114
git-svn-id: trunk@57207 -
This commit is contained in:
parent
d67baf1433
commit
5493650684
@ -296,6 +296,7 @@ type
|
|||||||
|
|
||||||
function Add(Image, Mask: TCustomBitmap): Integer;
|
function Add(Image, Mask: TCustomBitmap): Integer;
|
||||||
function AddSliced(Image: TCustomBitmap; AHorizontalCount, AVerticalCount: Integer): Integer;
|
function AddSliced(Image: TCustomBitmap; AHorizontalCount, AVerticalCount: Integer): Integer;
|
||||||
|
function AddSlice(Image: TCustomBitmap; AImageRect: TRect): Integer;
|
||||||
function AddIcon(Image: TCustomIcon): Integer;
|
function AddIcon(Image: TCustomIcon): Integer;
|
||||||
procedure AddImages(AValue: TCustomImageList);
|
procedure AddImages(AValue: TCustomImageList);
|
||||||
function AddMasked(Image: TBitmap; MaskColor: TColor): Integer;
|
function AddMasked(Image: TBitmap; MaskColor: TColor): Integer;
|
||||||
|
@ -1180,6 +1180,24 @@ begin
|
|||||||
Grp.Free;
|
Grp.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomImageList.AddSlice(Image: TCustomBitmap; AImageRect: TRect
|
||||||
|
): Integer;
|
||||||
|
var
|
||||||
|
R: TCustomImageListResolution;
|
||||||
|
ScBmp: TRGBAQuadArray;
|
||||||
|
begin
|
||||||
|
if Image = nil then Exit(-1);
|
||||||
|
|
||||||
|
Result := Count;
|
||||||
|
|
||||||
|
CreateDefaultResolution;
|
||||||
|
for R in Resolutions do
|
||||||
|
begin
|
||||||
|
ScaleImage(Image, nil, AImageRect, R.Width, R.Height, ScBmp);
|
||||||
|
R.InternalInsert(Result, @ScBmp[0]);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomImageList.AddSliced(Image: TCustomBitmap; AHorizontalCount,
|
function TCustomImageList.AddSliced(Image: TCustomBitmap; AHorizontalCount,
|
||||||
AVerticalCount: Integer): Integer;
|
AVerticalCount: Integer): Integer;
|
||||||
var
|
var
|
||||||
@ -2036,9 +2054,13 @@ begin
|
|||||||
for X := SourceRect.Left to SourceRect.Right do
|
for X := SourceRect.Left to SourceRect.Right do
|
||||||
for Y := SourceRect.Top to SourceRect.Bottom do
|
for Y := SourceRect.Top to SourceRect.Bottom do
|
||||||
begin
|
begin
|
||||||
C := II.Colors[X, Y];
|
if (X>=0) and (X<II.Width) and (Y>=0) and (Y<II.Height) then
|
||||||
if (AMask<>0) and II.Masked[X, Y] then
|
begin
|
||||||
C.Alpha := 0;
|
C := II.Colors[X, Y];
|
||||||
|
if (AMask<>0) and II.Masked[X, Y] then
|
||||||
|
C.Alpha := 0;
|
||||||
|
end else
|
||||||
|
C := colTransparent;
|
||||||
FI.Colors[X-SourceRect.Left, Y-SourceRect.Top] := C;
|
FI.Colors[X-SourceRect.Left, Y-SourceRect.Top] := C;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user