예제 #1
0
        public Bitmap Step()
        {
            IntPtr buffer = IntPtr.Zero;
            int    bytes = 0, width = 0, height = 0, stride = 0;

            API.Inpaint(_handle, ref buffer, ref bytes, ref width, ref height, ref stride);

            if (buffer == IntPtr.Zero)
            {
                return(null);
            }

            return(ImageConversion.CreateRGB(buffer, width, height, stride));
        }
예제 #2
0
        protected void StageOutputCallback(Stage stage, BufferColorSpace cs, IntPtr buffer, int bytes, int width, int height, int stride)
        {
            Bitmap img = null;

            switch (cs)
            {
            case BufferColorSpace.R8:
                img = ImageConversion.CreateGrayscale8(buffer, width, height, stride);
                break;

            case BufferColorSpace.R16:
                img = ImageConversion.CreateGrayscale16(buffer, width, height, stride);
                break;

            case BufferColorSpace.RGB888_RGB:
                img = ImageConversion.CreateRGB(buffer, width, height, stride);
                break;

            case BufferColorSpace.HISTOGRAM:
                img = ImageConversion.MakeHistogram(buffer);
                break;

            default:
                return;
            }

            if (img != null)
            {
                if (_outputs.ContainsKey(stage))
                {
                    _outputs[stage].Dispose();
                }
                _outputs[stage] = img;
            }
            else
            {
                _outputs.Remove(stage);
            }
        }