Código Delphi
[-]unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
Triple = array[1..3]of Byte;
private
public
end;
var
Form1: TForm1;
implementation
function Multiplicar(b: Byte; x: Integer): byte;
begin
x:= (x * b);
x:= x shr 8;
if x > 255 then Result:= 255
else Result:= x;
end;
procedure OscurecerTImage(Imagen: TImage; Brillo: Integer);
var
Bitmap: TBitmap;
P: ^Triple;
i, j: Integer;
begin
if not (Imagen.Picture.Graphic is TBitmap) then
begin
Bitmap:= TBitmap.Create;
try
Bitmap.Assign(Imagen.Picture.Graphic);
Imagen.Picture.Assign(Bitmap);
finally
Bitmap.Free;
end;
end;
Imagen.Picture.Bitmap.PixelFormat:= pf24bit;
for j:= 0 to Imagen.Picture.Bitmap.Height - 1 do
begin
P:= Imagen.Picture.Bitmap.ScanLine[j];
for i:= 0 to Imagen.Picture.Bitmap.Width - 1 do
begin
P^[1]:= Multiplicar(P^[1],Brillo);
P^[2]:= Multiplicar(P^[2],Brillo);
P^[3]:= Multiplicar(P^[3],Brillo);
inc(P);
end;
end;
Imagen.Refresh;
end;
{$R *.dfm}
end.
Eso es lo que he copiado. Cuando pongo el debugger me sale el mensage: Expected ':'but'=' found.
Tengo la version 7 de Delphi, por si influyese.