Ver Mensaje Individual
  #19  
Antiguo 19-06-2006
turminator turminator is offline
Miembro
 
Registrado: abr 2006
Ubicación: Barcelona, Spain
Posts: 91
Reputación: 21
turminator Va por buen camino
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
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
 // Realiza la operacion (b * x) / 256
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
  // Si no es un bitmap, lo convertimos en un bitmap
  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.
Responder Con Cita