procedure myMoveImages(const AImageList: TImageList);
var
TmpIter: Integer;
TmpBitmapOldmask: TBitmap;
TmpBitmapOldImg: TBitmap;
TmpImageListCopyHolder: TImageList;
begin
TmpImageListCopyHolder := TImageList.Create(nil);
TmpImageListCopyHolder.Width := AImageList.Width;
TmpImageListCopyHolder.Height := AImageList.Height;
TmpImageListCopyHolder.DrawingStyle := AImageList.DrawingStyle;
//--
TmpBitmapOldImg := myCreateBitmap(AImageList.Width, AImageList.Height, clNone, pf32bit);
TmpBitmapOldmask := myCreateBitmap(AImageList.Width, AImageList.Height, clNone, pf32bit);
//--
for TmpIter := 0 to -1 + AImageList.Count do
begin
TmpBitmapOldImg.Canvas.FillRect(TmpBitmapOldImg.Canvas.ClipRect);
TmpBitmapOldmask.Canvas.FillRect(TmpBitmapOldmask.Canvas.ClipRect);
AImageList.Draw(TmpBitmapOldImg.Canvas, 0, 0, TmpIter, dsTransparent, itImage, True);
AImageList.Draw(TmpBitmapOldMask.Canvas, 0, 0, TmpIter, dsNormal, itMask, True);
//TmpImageListCopyHolder.Add(TmpBitmapOldImg, TmpBitmapOldMask);
TmpImageListCopyHolder.AddMasked(TmpBitmapOldImg, TmpBitmapOldImg.TransparentColor);
end;
//--
AImageList.Clear;
for TmpIter := 0 to -1 + TmpImageListCopyHolder.Count do
begin
TmpBitmapOldImg.Canvas.FillRect(TmpBitmapOldImg.Canvas.ClipRect);
TmpBitmapOldmask.Canvas.FillRect(TmpBitmapOldmask.Canvas.ClipRect);
TmpImageListCopyHolder.Draw(TmpBitmapOldImg.Canvas, 0, 0, TmpIter, dsTransparent, itImage, True);
TmpImageListCopyHolder.Draw(TmpBitmapOldMask.Canvas, 0, 0, TmpIter, dsNormal, itMask, True);
AImageList.AddMasked(TmpBitmapOldImg, TmpBitmapOldImg.TransparentColor);
//AImageList.Add(TmpBitmapOldImg, TmpBitmapOldMask);
end;
function myCreateBitmap(AWidth, AHeight: Integer; ABGColor: TColor; APixelFormat: TPixelFormat): TBitMap;
var
BitMap: TBitMap;
TmpRect: TRect;
begin
BitMap := TBitMap.Create;
with BitMap do
begin
PixelFormat := APixelFormat;
Width := AWidth;
Height := AHeight;
Canvas.Brush.Style := bsSolid;
if ABGColor = clNone then
ABGColor := Bitmap.TransparentColor
;
Canvas.Brush.Color := ABGColor;
TmpRect.Top := 0;
TmpRect.Left := 0;
TmpRect.Right := Width;
TmpRect.Bottom := Height;
Canvas.FillRect(TmpRect);
end
;
Result := BitMap;
end;