public void imageUpdate(Rectangle regionRect, FrameBuffer frameBuffer)
        {
            Bitmap bucketBmp = new Bitmap(regionRect.Width, regionRect.Height);
            frameBuffer.toBitmap(bucketBmp);

            lock (lockObject)
            {

                CopyRegionIntoImage(bucketBmp, new Rectangle(0, 0, regionRect.Width, regionRect.Height), ref bitmap, regionRect);

                fireImageUpdateEvent();
            }
        }
        public FrameBuffer startSamplingRegion(Rectangle region)
        {
            m_pixelSampler.setParams(m_imgPlaneRect, m_scene);

            FrameBuffer frameBuffer = new FrameBuffer(region.Width, region.Height);

            Camera camera = m_scene.getCamera();

            for (int y = 0; y < region.Height; ++y) {
                for (int x = 0; x < region.Width; ++x) {
                    ImageSample sample = new ImageSample();
                    sample.x = x;
                    sample.y = y;
                    sample.color = m_pixelSampler.samplePixel(x, y, region, camera);
                    frameBuffer.addSample(x, y, sample);
                }//x
            }//y

            return frameBuffer;
        }