コード例 #1
0
        /// <summary>
        /// Repaints the HALCON window 'window' using BufferWindow
        /// </summary>
        public void repaintUsingBufferWindow(HalconDotNet.HWindow window)
        {
            int          count = HObjList.Count;
            HObjectEntry entry;

            // modified
            if ((windowWidth > 0) && (windowHeight > 0))
            {
                if (bufferWindow == null)
                {
                    bufferWindow = new HWindow(0, 0, windowWidth, windowHeight, "root", "buffer", "");
                    // check the boundatries of the image part
                    if ((ImgRow2 > ImgRow1) && (ImgCol2 > ImgCol1))
                    {
                        bufferWindow.SetPart((int)ImgRow1, (int)ImgCol1, (int)ImgRow2, (int)ImgCol2);
                    }
                    // set the image part to window size
                    else
                    {
                        bufferWindow.SetPart(0, 0, windowHeight - 1, windowWidth - 1);
                    }
                }
                else
                {
                    bufferWindow.ClearWindow();
                }

                mGC.stateOfSettings.Clear();

                // display the graphic stack on the buffer window
                for (int i = 0; i < count; i++)
                {
                    entry = ((HObjectEntry)HObjList[i]);
                    if (entry != null)
                    {
                        mGC.applyContext(window, entry.gContext);
                        mGC.applyContext(bufferWindow, entry.gContext);
                        bufferWindow.DispObj(entry.HObj);
                    }
                }

                addInfoDelegate();

                // if any rois exists add this to buffer window
                if (roiManager != null && (dispROI == MODE_INCLUDE_ROI))
                {
                    roiManager.paintData(bufferWindow);
                }

                // copy the content of buffer window to HWindow
                bufferWindow.CopyRectangle(window, 0, 0, windowHeight - 1, windowWidth - 1, 0, 0);

                // dispose the buffer window
                bufferWindow.Dispose();
                bufferWindow = null;
            }
        }