コード例 #1
0
        public static SUBACQERR copydib(ref Bitmap bitmap, DCAMBUF_FRAME src, ref Rectangle rect, int lutmax, int lutmin)
        {
            int w = rect.Width;
            int h = rect.Height;

            if (w > bitmap.Width)
            {
                w = bitmap.Width;
            }
            if (h > bitmap.Height)
            {
                h = bitmap.Height;
            }
            if (w > src.width)
            {
                w = src.width;
            }
            if (h > src.height)
            {
                h = src.height;
            }

            BitmapData     dst   = bitmap.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb);
            SUBACQ_COPYDIB param = new SUBACQ_COPYDIB();

            param.size   = Marshal.SizeOf(typeof(SUBACQ_COPYDIB));
            param.option = 0;

            param.src          = src.buf;
            param.srcrowbytes  = src.rowbytes;
            param.srcpixeltype = src.type;

            param.dst            = dst.Scan0;
            param.dstrowbytes    = dst.Stride;
            param.dstpixelformat = dst.PixelFormat;

            param.width  = w;
            param.height = h;
            param.left   = rect.Left;
            param.top    = rect.Top;

            param.lut    = IntPtr.Zero;
            param.lutmax = lutmax;
            param.lutmin = lutmin;

            // ---- call subacq4_copydib function in subacq4.dll ----

            SUBACQERR err = subacqdll.copydib(ref param);

            bitmap.UnlockBits(dst);

            return(err);
        }
コード例 #2
0
        public bool buf_lockframe(ref DCAMBUF_FRAME aFrame)
        {
            if (m_hdcam == IntPtr.Zero)
            {
                m_lasterr = DCAMERR.INVALIDHANDLE;
            }
            else
            {
                m_lasterr = dcambuf.lockframe(m_hdcam, ref aFrame);
            }

            return(!m_lasterr.failed());
        }
コード例 #3
0
        public static SUBACQERR copydib(ref Bitmap bitmap, DCAMBUF_FRAME src, ref Rectangle rect, int lutmax, int lutmin)
        {
            int w = rect.Width;
            int h = rect.Height;

            if (w > bitmap.Width)
            {
                w = bitmap.Width;
            }
            if (h > bitmap.Height)
            {
                h = bitmap.Height;
            }
            if (w > src.width)
            {
                w = src.width;
            }
            if (h > src.height)
            {
                h = src.height;
            }

            BitmapData dst = bitmap.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb);

            SUBACQERR err;

            if (src.type == DCAM_PIXELTYPE.MONO16)
            {
                err = copydib_rgb32_from_mono16(dst.Scan0, dst.Stride, src.buf, src.rowbytes, w, h, lutmax, lutmin);
            }
            else
            {
                err = SUBACQERR.INVALID_SRCPIXELTYPE;
            }
            bitmap.UnlockBits(dst);

            return(err);
        }
コード例 #4
0
 public MyImage()
 {
     bufframe = new DCAMBUF_FRAME(0);
 }