正常状况下的绘图刷新
new Thread(new ThreadStart(() =>
{
HOperatorSet.ClearWindow(hWindow1.HalconWindow);
DateTime d1 = DateTime.Now;
HObject hobj;
HTuple Row, Col;
HOperatorSet.ReadImage(out hobj, @“C:\Users\Public\Documents\MVTec\HALCON- 13.0\examples\images\autobahn\scene_00.png”);
HOperatorSet.GetImageSize(hobj, out Col, out Row);
HOperatorSet.SetPart(hWindow1.HalconWindow, 0, 0, Col - 1, Row - 1);
hobj.DispObj(hWindow1.HalconWindow);
hobj.Dispose();
Random ran = new Random();
HOperatorSet.GenCircleContourXld(out hobj, 200, 200, 100, 0, 6.28318, “positive”, 1);
for (int i = 0; i < 5000; i++)
{
hobj.DispObj(hWindow1.HalconWindow);
HOperatorSet.WriteString(hWindow1.HalconWindow, “文本数据”);
}
hobj.Dispose();
Log1.Dispatcher.BeginInvoke(new Action(() => {
Log1.Text = “普通耗时” + DateTime.Now.Subtract(d1).TotalMilliseconds + “ms”;
}));
}))
{ IsBackground = true}.Start();
Buffer图像刷新
new Thread(new ThreadStart(() =>
{
HOperatorSet.ClearWindow(BufferWindow);
DateTime d1 = DateTime.Now;
HObject hobj;
HTuple Row, Col;
HOperatorSet.ReadImage(out hobj, @“C:\Users\Public\Documents\MVTec\HALCON-13.0\examples\images\autobahn\scene_00.png”);
HOperatorSet.GetImageSize(hobj, out Col, out Row);
HOperatorSet.SetPart(BufferWindow, 0, 0, Row - 1, Col - 1);
HTuple row, column, width, height;
HOperatorSet.GetWindowExtents(hWindow1.HalconWindow, out row, out column, out width, out height);
HOperatorSet.SetWindowExtents(BufferWindow, row, column, width, height);
HOperatorSet.DispObj(hobj, BufferWindow);
hobj.Dispose();
Random ran = new Random();
HOperatorSet.GenCircleContourXld(out hobj, 200, 200, 100, 0, 6.28318, "positive", 1);
for (int i = 0; i < 5000; i++)
{
HOperatorSet.DispObj(hobj, BufferWindow);
HOperatorSet.WriteString(BufferWindow, "文本数据");
}
hobj.Dispose();
HOperatorSet.DumpWindowImage(out hobj, BufferWindow);
HOperatorSet.GetImageSize(hobj, out Col, out Row);
HOperatorSet.SetPart(hWindow2.HalconWindow, 0, 0, Row - 1, Col - 1);
HOperatorSet.DispObj(hobj, hWindow2.HalconWindow);
Log2.Dispatcher.BeginInvoke(new Action(() => {
Log2.Text = "缓存耗时" + DateTime.Now.Subtract(d1).TotalMilliseconds + "ms";
}));
}))
{ IsBackground = true }.Start();