标签:
zw版【转发·台湾nvp系列Delphi例程】HALCON DispArc
zw版【转发·台湾nvp系列Delphi例程】HALCON DispArc
----------
RAD Studio XE Delphi x64
procedure TForm1.Button1Click(Sender: TObject);
var
ho_Image: HImageX;
w, h: OleVariant;
cr, br: OleVariant;
cc, bc: OleVariant;
rd: OleVariant;
tuple: HTupleX;
Style: OleVariant;
begin
ho_Image := CoHImageX.Create;
tuple := CoHTupleX.Create;
ho_Image.ReadImage(‘ic0‘);
w := ho_Image.GetImageSize(h);
HWindowX1.SetPart(0, 0, h - 1, w - 1);
HWindowX1.SetDraw(‘margin‘);
ho_Image.DispObj(HWindowX1);
cr := tuple.TupleConcat(150, 150);
cc := tuple.TupleConcat(150, 150);
br := tuple.TupleConcat(150, 150);
bc := tuple.TupleConcat(200, 250);
rd := tuple.TupleConcat(Pi / 2, Pi / 2);
Style := tuple.TupleConcat(tuple.TupleConcat(tuple.TupleConcat(20, 7), 3), 7);
HWindowX1.SetColor(‘red‘);
HWindowX1.SetLineStyle(Style);
HWindowX1.DispArc(cr, cc, rd, br, bc);
cr := tuple.TupleConcat(150, 150);
cc := tuple.TupleConcat(150, 150);
br := tuple.TupleConcat(150, 150);
bc := tuple.TupleConcat(300, 350);
rd := tuple.TupleConcat(-Pi / 4, -Pi / 4);
Style := tuple.TupleConcat(3, 3);
HWindowX1.SetColor(‘magenta‘);
HWindowX1.SetLineStyle(Style);
HWindowX1.DispArc(cr, cc, rd, br, bc);
cr := tuple.TupleConcat(150, 150);
cc := tuple.TupleConcat(150, 150);
br := tuple.TupleConcat(150, 150);
bc := tuple.TupleConcat(100, 50);
rd := tuple.TupleConcat(Pi / 2, Pi / 2);
Style := Null;
HWindowX1.SetColor(‘white‘);
HWindowX1.SetLineStyle(Style);
HWindowX1.DispArc(cr, cc, rd, br, bc);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
op.CloseWindow(HWindowX1.HalconID);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Self.Caption := Self.Caption + ‘ Delphi ‘ + IntToStr(Sizeof(Pointer) * 8);
op := CoHOperatorSetX.Create;
op.SetCheck(‘~father‘);
HWindowX1 := CoHWindowX.Create();
HWindowX1.OpenWindow(0, 0, Panel1.ClientWidth, Panel1.ClientHeight,
Int64(Panel1.Handle), ‘visible‘, ‘‘);
end;
--------------------
Delphi
procedure TForm1.Button1Click(Sender: TObject);
var
ho_Image : HImageX;
w, h : OleVariant;
cr, br : OleVariant;
cc, bc : OleVariant;
rd : OleVariant;
tuple: HTupleX;
Style : OleVariant;
begin
ho_Image := CoHImageX.Create;
tuple := CoHTupleX.Create;
ho_Image.ReadImage(‘ic0‘);
w := ho_Image.GetImageSize(h);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, h - 1, w - 1);
HWindowXCtrl1.HalconWindow.SetDraw(‘margin‘);
ho_Image.DispObj(HWindowXCtrl1.HalconWindow);
cr := tuple.TupleConcat(150, 150);
cc := tuple.TupleConcat(150, 150);
br := tuple.TupleConcat(150, 150);
bc := tuple.TupleConcat(200, 250);
rd := tuple.TupleConcat(Pi / 2, Pi / 2);
Style := tuple.TupleConcat(tuple.TupleConcat(tuple.TupleConcat(20, 7), 3), 7);
HWindowXCtrl1.HalconWindow.SetColor(‘red‘);
HWindowXCtrl1.HalconWindow.SetLineStyle(Style);
HWindowXCtrl1.HalconWindow.DispArc(cr, cc, rd, br, bc);
cr := tuple.TupleConcat(150, 150);
cc := tuple.TupleConcat(150, 150);
br := tuple.TupleConcat(150, 150);
bc := tuple.TupleConcat(300, 350);
rd := tuple.TupleConcat(-Pi / 4, -Pi / 4);
Style := tuple.TupleConcat(3, 3);
HWindowXCtrl1.HalconWindow.SetColor(‘magenta‘);
HWindowXCtrl1.HalconWindow.SetLineStyle(Style);
HWindowXCtrl1.HalconWindow.DispArc(cr, cc, rd, br, bc);
cr := tuple.TupleConcat(150, 150);
cc := tuple.TupleConcat(150, 150);
br := tuple.TupleConcat(150, 150);
bc := tuple.TupleConcat(100, 50);
rd := tuple.TupleConcat(Pi / 2, Pi / 2);
Style := Null;
HWindowXCtrl1.HalconWindow.SetColor(‘white‘);
HWindowXCtrl1.HalconWindow.SetLineStyle(Style);
HWindowXCtrl1.HalconWindow.DispArc(cr, cc, rd, br, bc);
end;
zw版【转发·台湾nvp系列Delphi例程】HALCON DispArc
标签:
原文地址:http://www.cnblogs.com/ziwang/p/4851048.html