예제 #1
0
        public void OnCaptured(CaptureResult captureResult)
        {
            Console.WriteLine(captureResult.ToString());

            Fid.Fiv f      = captureResult.Data.Views[0];
            int     height = f.Height;
            int     width  = f.Width;

            Console.WriteLine(height * width);
            byte[] bytes = f.RawImage;

            byte[] rgbBytes = new byte[bytes.Length * 3];

            for (int i = 0; i <= bytes.Length - 1; i++)
            {
                rgbBytes[(i * 3)]     = bytes[i];
                rgbBytes[(i * 3) + 1] = bytes[i];
                rgbBytes[(i * 3) + 2] = bytes[i];
            }
            Console.WriteLine(bytes.Length);
            Console.WriteLine("Bytes = " + bytes.Length);

            Bitmap final = new Bitmap(width, height);

            for (int hi = 0; hi < height; hi++)
            {
                for (int wi = 0; wi < width; wi = wi + 3)
                {
                    System.Drawing.Color color = System.Drawing.Color.FromArgb(bytes[hi * width + wi], bytes[hi * width + wi + 1], bytes[hi * width + wi + 2]);
                    Console.WriteLine(hi * width * 3 + wi);
                    Console.WriteLine(hi);
                    Console.WriteLine(wi);
                    Console.WriteLine();
                    //System.Drawing.Color color = SystemDrawing.Color.FromArgb(bytes[width * wi + hi], bytes[(width * wi + hi) + 1], bytes[(width * wi + hi) + 2]);
                    final.SetPixel(wi / 3, hi, color);
                }
            }


            actual.Source = ToSource(final);
        }
예제 #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            String msg;

            print("btnSign clicked");
            CaptureResult res = axSigCtl1.CtlCapture("Who", "Why");

            switch (res)
            {
            case CaptureResult.CaptureOK:
                msg = "Signature captured successfully";
                break;

            case CaptureResult.CaptureCancel:
                msg = "Signature cancelled";
                break;

            default: msg = "Capture error: " + res.ToString();
                break;
            }
            print(msg);
        }