procedure BlendImage(BackBmp, ForeBmp: TBitmap; TransColor: TColor; Alpha: Integer);
type
TRGBArray = array[0..32767] of TRGBTriple;
PRGBArray = ^TRGBArray;
var
X, Y, OffX, OffY: Integer;
BackRect, ForeRect: TRect;
BackRGB, ForeRGB: PRGBArray;
BackR, BackG, BackB: Byte;
ForeR, ForeG, ForeB: Byte;
begin
if not Assigned(BackBmp) then exit;
if not Assigned(ForeBmp) then exit;
if BackBmp.PixelFormat <> pf24bit then Exit;
if ForeBmp.PixelFormat <> pf24bit then Exit;
if (BackBmp.Empty) or (ForeBmp.Empty) then Exit;
BackRect := BackBmp.Canvas.ClipRect;
ForeRect := ForeBmp.Canvas.ClipRect;
DockRect(ForeRect, BackRect);
OffX := ForeRect.Left - BackRect.Left;
OffY := ForeRect.Top - BackRect.Top;
for Y := 0 to BackBmp.Height - 1 do
begin
if (Y > ForeRect.Bottom - 1) or
(Y < ForeRect.Top) then Continue;
BackRGB := BackBmp.ScanLine[Y];
ForeRGB := ForeBmp.ScanLine[Y
两张BMP图片叠加
最新推荐文章于 2022-12-25 20:06:03 发布