1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ExtDlgs;
type
TRGBArray = array[0..10000] of TRGBTriple;
pTRGBArray =^TRGBArray;
TForm1 = class(TForm)
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ Déclarations privées }
bmp : TBitmap;
procedure FiltreRouge;
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
bmp:=TBitmap.Create;
Position:=PoScreenCenter;
Height:=Image1.Picture.Height;
Width:=Image1.Picture.Width;
With bmp do
begin
Width:=Self.Width;
Height:=self.Height;
end;
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
bmp.Assign(Image1.Picture.Bitmap);
FiltreRouge;
Canvas.Draw(0,0,bmp);
end;
procedure TForm1.FiltreRouge;
var bitmap : TBitmap;
x,y : integer;
P : pTRGBArray;
begin
bitmap:=TBitmap.Create;
With bitmap do
begin
Assign(Bmp);
PixelFormat:=pf24Bit;
end;
For x:=0 to bitmap.Height-1 do
begin
P:=bitmap.ScanLine[x];
end;
For y:=0 to bitmap.Width-1 do
begin
P[y].rgbtBlue:=0;
P[y].rgbtGreen:=0;
end;
Bmp.Assign(bitmap);
bitmap.Free;
end;
end. |
Partager