Forma 2 tane image nesnesi ve bir tane de button ekleyin.
Procedure Highlight(aSource, ATarget: TBitmap; AColor: TColor);
Var
i, j: Integer;
s, t: pRGBTriple;
r, g, b: Byte;
cl: TColor;
Begin
cl:= ColorToRGB(AColor);
r:= GetRValue(cl);
g:= GetGValue(cl);
b:= GetBValue(cl);
aSource.PixelFormat := pf24bit;
ATarget.PixelFormat := pf24bit;
ATarget.Width := aSource.Width;
ATarget.Height := aSource.Height;
For i:= 0 to aSource.Height - 1 Do
Begin
s:= ASource.Scanline;
t:= ATarget.Scanline;
For j := 0 to aSource.Width - 1 Do
Begin
t^.rgbtBlue := (b * s^.rgbtBlue) div 255;
t^.rgbtGreen := (g * s^.rgbtGreen) div 255;
t^.rgbtRed := (r * s^.rgbtRed) div 255;
Inc(s);
Inc(t);
End;
End;
End;
Kullanımı :Var
i, j: Integer;
s, t: pRGBTriple;
r, g, b: Byte;
cl: TColor;
Begin
cl:= ColorToRGB(AColor);
r:= GetRValue(cl);
g:= GetGValue(cl);
b:= GetBValue(cl);
aSource.PixelFormat := pf24bit;
ATarget.PixelFormat := pf24bit;
ATarget.Width := aSource.Width;
ATarget.Height := aSource.Height;
For i:= 0 to aSource.Height - 1 Do
Begin
s:= ASource.Scanline;
t:= ATarget.Scanline;
For j := 0 to aSource.Width - 1 Do
Begin
t^.rgbtBlue := (b * s^.rgbtBlue) div 255;
t^.rgbtGreen := (g * s^.rgbtGreen) div 255;
t^.rgbtRed := (r * s^.rgbtRed) div 255;
Inc(s);
Inc(t);
End;
End;
End;
procedure Form1.Button1OnClick (Sender: TObject);
begin
Highlight(Image1.Picture.Bitmap, Image2.Picture.Bitmap,clWhite);
end;
begin
Highlight(Image1.Picture.Bitmap, Image2.Picture.Bitmap,clWhite);
end;