Mepcuk
December 27, 2008, 08:51:17
Hello!
Can you help me?
Why I can call procedure ICImagingControl1ImageAvailable???
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, ICImagingControl3_TLB, StdCtrls, ComObj, ExtCtrls, Menus;
type
TForm1 = class(TForm)
ICImagingControl1: TICImagingControl;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ICImagingControl1ImageAvailable(Sender: TObject;BufferIndex: Integer);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
tRGB = record
r,g,b: byte;
end;
var
Form1 : TForm1;
ZoomValue : single;
FrameCount : integer = 0;
CurrentBuffer: ImageBuffer;
OB : OverlayBitmap;
ImageA : array [0..1280, 0..960] of tRGB;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
try
ICImagingControl1.LoadDeviceStateFromFile('device. xml',true);
except
ON EOleException do
begin
ICImagingControl1.ShowDeviceSettingsDialog();
if ICImagingControl1.DeviceValid = TRUE then
begin
ICImagingControl1.SaveDeviceStateToFile('device.xm l');
end;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ICImagingControl1.LiveStop;
ICImagingControl1.ShowDeviceSettingsDialog;
ICImagingControl1.LiveStart;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ICImagingControl1.ShowPropertyDialog;
end;
procedure TForm1.ICImagingControl1ImageAvailable(Sender: TObject;BufferIndex: Integer);
var
x,y,sx,sy : integer;
v : byte;
pData : PChar;
pPixel : PChar;
begin
CurrentBuffer:= ICImagingControl1.ImageActiveBuffer;
CurrentBuffer.Lock();
pData := PChar(CurrentBuffer.ImageDataPtr);
sx := ICImagingControl1.ImageWidth;
sy := ICImagingControl1.ImageHeight;
For x:= 0 to sx - 1 do
For y:= 0 To sy - 1 do
begin
{ read fast from the IC buffer }
pPixel := pData + (x + y * sx) * 3;
ImageA[x,y].r := byte((pPixel + 2)^);
ImageA[x,y].g := byte((pPixel + 1)^);
ImageA[x,y].b := byte((pPixel + 0)^);
{ write back fast to the IC buffer }
byte((pPixel + 2)^) := 255 - ImageA[x,y].r;
byte((pPixel + 1)^) := 255 - ImageA[x,y].g;
byte((pPixel + 0)^) := 255 - ImageA[x,y].b;
end;
ICImagingControl1.DisplayImageBuffer(CurrentBuffer );
CurrentBuffer.Unlock();
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if ICImagingcontrol1.DeviceValid = True then
begin
{ZoomSettings}
ICImagingControl1.LiveStop;
ICImagingControl1.LiveDisplayDefault:= false;
{ImageProcSettings}
ICImagingControl1.LiveDisplay:= false;
ICImagingControl1.LiveCaptureLastImage:= false;
ICImagingControl1.LiveCaptureContinuous:= true;
ICImagingControl1.Width:= ICImagingControl1.ImageWidth;
ICImagingControl1.Height:= ICImagingControl1.ImageHeight;
ICImagingControl1.LiveStart();
end;
end;
end.
Can you help me?
Why I can call procedure ICImagingControl1ImageAvailable???
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, ICImagingControl3_TLB, StdCtrls, ComObj, ExtCtrls, Menus;
type
TForm1 = class(TForm)
ICImagingControl1: TICImagingControl;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ICImagingControl1ImageAvailable(Sender: TObject;BufferIndex: Integer);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
tRGB = record
r,g,b: byte;
end;
var
Form1 : TForm1;
ZoomValue : single;
FrameCount : integer = 0;
CurrentBuffer: ImageBuffer;
OB : OverlayBitmap;
ImageA : array [0..1280, 0..960] of tRGB;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
try
ICImagingControl1.LoadDeviceStateFromFile('device. xml',true);
except
ON EOleException do
begin
ICImagingControl1.ShowDeviceSettingsDialog();
if ICImagingControl1.DeviceValid = TRUE then
begin
ICImagingControl1.SaveDeviceStateToFile('device.xm l');
end;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ICImagingControl1.LiveStop;
ICImagingControl1.ShowDeviceSettingsDialog;
ICImagingControl1.LiveStart;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ICImagingControl1.ShowPropertyDialog;
end;
procedure TForm1.ICImagingControl1ImageAvailable(Sender: TObject;BufferIndex: Integer);
var
x,y,sx,sy : integer;
v : byte;
pData : PChar;
pPixel : PChar;
begin
CurrentBuffer:= ICImagingControl1.ImageActiveBuffer;
CurrentBuffer.Lock();
pData := PChar(CurrentBuffer.ImageDataPtr);
sx := ICImagingControl1.ImageWidth;
sy := ICImagingControl1.ImageHeight;
For x:= 0 to sx - 1 do
For y:= 0 To sy - 1 do
begin
{ read fast from the IC buffer }
pPixel := pData + (x + y * sx) * 3;
ImageA[x,y].r := byte((pPixel + 2)^);
ImageA[x,y].g := byte((pPixel + 1)^);
ImageA[x,y].b := byte((pPixel + 0)^);
{ write back fast to the IC buffer }
byte((pPixel + 2)^) := 255 - ImageA[x,y].r;
byte((pPixel + 1)^) := 255 - ImageA[x,y].g;
byte((pPixel + 0)^) := 255 - ImageA[x,y].b;
end;
ICImagingControl1.DisplayImageBuffer(CurrentBuffer );
CurrentBuffer.Unlock();
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if ICImagingcontrol1.DeviceValid = True then
begin
{ZoomSettings}
ICImagingControl1.LiveStop;
ICImagingControl1.LiveDisplayDefault:= false;
{ImageProcSettings}
ICImagingControl1.LiveDisplay:= false;
ICImagingControl1.LiveCaptureLastImage:= false;
ICImagingControl1.LiveCaptureContinuous:= true;
ICImagingControl1.Width:= ICImagingControl1.ImageWidth;
ICImagingControl1.Height:= ICImagingControl1.ImageHeight;
ICImagingControl1.LiveStart();
end;
end;
end.