Esempio n. 1
0
        partial void ScreenButton_down(UIButton sender)
        {
            if (!isScreen)
            {
                ScreenshotView.Hidden = false;
                ScreenBtn.SetTitle("Hide screen", UIControlState.Normal);
                isScreen = true;

                int    val = 1920 * 1080 * 4 + 8;              //ARGB 1920x1080 + 8(iosspecific)
                IntPtr b   = Marshal.AllocHGlobal(val);


                int val1 = -1;                 //return realsize after getvideoshot
                int val2 = -1;                 //return realsize after getvideoshot
                int val3 = 0;                  //return realsize after getvideoshot

                int rc = _mediaPlayer.GetVideoShot(b, ref val, ref val1, ref val2, ref val3);
                if (rc == -2)
                {
                    System.Console.WriteLine(String.Format("<binary> rc: {0} , not enough space allocated", rc));
                    Marshal.FreeHGlobal(b);
                    return;
                }
                else if (rc == -1)
                {
                    System.Console.WriteLine(String.Format("<binary> rc: {0} , error", rc));
                    Marshal.FreeHGlobal(b);
                    return;
                }


                CGDataProvider provider         = new CGDataProvider(b, val);
                int            bitsPerComponent = 8;
                int            bitsPerPixel     = 32;
                int            bytesPerRow      = val3;

                CGColorSpace           colorspaceref = CGColorSpace.CreateDeviceRGB();
                CGBitmapFlags          bitmapinfo    = CGBitmapFlags.ByteOrder32Little | CGBitmapFlags.NoneSkipFirst;
                CGColorRenderingIntent renderintent  = CGColorRenderingIntent.Default;
                CGImage imageref = new CGImage(val1, val2, bitsPerComponent, bitsPerPixel, val3, colorspaceref, bitmapinfo, provider, null, true, renderintent);

                UIImage img = new UIImage(imageref);
                ScrenShotImageView.Image = img;
                Marshal.FreeHGlobal(b);
            }
            else
            {
                ScreenBtn.SetTitle("Screen", UIControlState.Normal);
                ScreenshotView.Hidden = true;
                isScreen = false;
            }
        }
Esempio n. 2
0
        void ReleaseDesignerOutlets()
        {
            if (ConnectBtn != null)
            {
                ConnectBtn.Dispose();
                ConnectBtn = null;
            }

            if (DebugLbl != null)
            {
                DebugLbl.Dispose();
                DebugLbl = null;
            }

            if (ScreenBtn != null)
            {
                ScreenBtn.Dispose();
                ScreenBtn = null;
            }

            if (ScreenshotView != null)
            {
                ScreenshotView.Dispose();
                ScreenshotView = null;
            }

            if (ScrenShotImageView != null)
            {
                ScrenShotImageView.Dispose();
                ScrenShotImageView = null;
            }

            if (URL_textfield != null)
            {
                URL_textfield.Dispose();
                URL_textfield = null;
            }

            if (VideoContentView != null)
            {
                VideoContentView.Dispose();
                VideoContentView = null;
            }
        }