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
| unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
carreau: TImage;
procedure FormActivate(Sender: TObject);
procedure ecran (im : TImage) ;
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
bmp : TBitmap;
implementation
{$R *.DFM}
procedure TForm1.FormActivate(Sender: TObject);
var
logo : TImage;
begin
logo.Picture.bitmap := carreau.picture.bitmap;
ecran (logo);
end;
procedure TForm1.ecran (im : TImage);
const
MaxPixelRed : integer = 10000000; // Hauteur de la couleur rouge dans pixel
ColorRed : integer = 255; // couleur rouge
CouleurFond : integer = 32512; // couleur du fond de l'aire de jeux
var x, y : integer;
begin
for y:= 0 to im.height - 1 do begin
for x := 0 to im.Width - 1 do begin
// im.Canvas.Pixels[x, y] := rgb (getRvalue(im.Canvas.Pixels[x, y]),getGvalue(im.Canvas.Pixels[x, y]),getBvalue(im.Canvas.Pixels[x, y]));
// Memo1.Lines.Add( IntToStr ( im.Canvas.Pixels[x, y]));
if im.Canvas.Pixels[x, y] < MaxPixelRed
then im.Canvas.Pixels[x, y]:=ColorRed
else begin
im.Canvas.Pixels[x, y]:= CouleurFond;
end;
end;
end;
im.Repaint;
end;
end |
Partager