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, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function ModifierFondImage(ValRouge,ValVert,ValBleu:integer):TbitMap;
type
TRGBTripleArray = ARRAY[Word] of TRGBTriple; // ' <----- j''obtiens une erreur ici : le "TRGBTriple" est souligné '
pRGBTripleArray = ^TRGBTripleArray; // ' et j''ai le message suivant à la compil : E2003 Identificateur non déclaré ':
var
x,y : Integer;
BitMap, NewBitMap : TBitMap;
P, NewP : pRGBTripleArray;
begin
BitMap := TBitMap.create;
NewBitMap := TBitMap.create;
try
Bitmap.LoadFromResourceName(hInstance,'MonImage' ); // MonImage est une ressource bitmap en mémoire
BitMap.PixelFormat := pf24bit;
NewBitMap.PixelFormat := pf24bit;
NewBitMap.Height := BitMap.Height;
NewBitMap.Width := BitMap.Width;
for y := 0 to BitMap.Height - 1 do begin
for x := 0 to BitMap.Width - 1 do begin
P := BitMap.ScanLine[y];
NewP := NewBitMap.ScanLine[y];
if P[x].rgbtRed=255 then P[x].rgbtRed:=255-ValRouge; // Modification du rouge
if P[x].rgbtGreen=255 then P[x].rgbtGreen:=255-ValVert; // " '' vert
if P[x].rgbtBlue=255 then P[x].rgbtBlue:=255-ValBleu; // '' '' bleu
NewP[x] := P[x];
end;
end;
result:= NewBitMap; // Ma nouvelle image modifiée
finally
BitMap.Free;
NewBitMap.Free;
end;
end;
end. |
Partager