图片叠加算法
procedure TCopyScreent.AlphalBmp(BackBmp, foreBmp: TBitmap; Alphal: Byte ; Rect : TRect);var R1 , G1 , B1 , R2 , G2 , B2 : Byte; X , Y : Integer; PB , PF : PByteArray;begin BackBmp.PixelFormat := pf24bit; foreBmp.PixelFormat := pf24bit; for Y := 0 to BackBmp.Height-1 do begin PB := BackBmp.ScanLine[Y]; PF := foreBmp.ScanLine[Y] ; X:=0; while X<=(BackBmp.Width-1)*3 do begin Inc(X,3) ; if (X>=Rect.Left*3) and (X<=Rect.Right*3) and (Y>=Rect.Top) and (Y<=Rect.Bottom) then begin Continue; end else begin B1 := PB[X]; G1 := PB[X+1]; R1 := PB[X+2]; B2 := PF[X]; G2 := PF[X+1]; R2 := PF[X+2]; PB[X] := Trunc((B1*(255-Alphal)+B2*Alphal)/255); PB[X+1] := Trunc((G1*(255-Alphal)+G2*Alphal)/255); PB[X+2] := Trunc((R1*(255-Alphal)+R2*Alphal)/255); end; end; end;end;