Example #1
0
        public bool seqprogress(IntPtr pData, ref MicroView.MV_IMAGEINFO pImageInfo, IntPtr pUserData, uint Index)
        {
            int stride = 0;

            switch (bits)
            {
            case MicroView.DATA_MONOCHOY8:
                stride = width;
                bm     = new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format8bppIndexed, pData);
                //创建灰阶
                ColorPalette palette = bm.Palette;
                for (int i = 0; i < palette.Entries.Length; i++)
                {
                    palette.Entries[i] = Color.FromArgb(i, i, i);
                }
                bm.Palette = palette;
                break;

            case MicroView.DATA_aRGB8888:
                stride = 4 * width;
                bm     = new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format32bppRgb, pData);
                break;

            case MicroView.DATA_CO_RGB24:
                stride = 3 * width;
                bm     = new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, pData);
                break;

            case MicroView.DATA_CO_RGB565:
                stride = 2 * width;
                bm     = new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format16bppRgb565, pData);
                break;

            default:
                MessageBox.Show("没找到卡!");
                CloseCard();
                break;
            }
            GetCallBackEventHandler temp = GetCallBack;

            if (temp != null)
            {
                temp(bm);
            }
            return(true);
        }
Example #2
0
        public bool seqprogress(IntPtr hBoard, int No)
        {
            OK.okReadRect(hBoard, 1, No, a);
            switch (this.GETHIWORD(bits))
            {
            case 8:
                bm = new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format8bppIndexed, a);
                //创建灰阶
                palette = bm.Palette;
                for (int i = 0; i < palette.Entries.Length; i++)
                {
                    palette.Entries[i] = Color.FromArgb(i, i, i);
                }
                bm.Palette = palette;
                break;

            //case 32:
            //    bm = new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format32bppArgb, a);
            //    break;
            case 24:
                bm = new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, a);
                break;

            case 16:
                bm = new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format16bppRgb565, a);
                break;

            default:
                MessageBox.Show("没找到卡!");
                ok.CloseBoard(cardHandle);
                break;
            }
            GetCallBackEventHandler temp = GetCallBack;

            if (temp != null)
            {
                temp(bm);
            }
            return(true);
        }