public void SetOutput(CameraViewOutput o) { output = o; output.SideGot += Redraw; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); SetContentView(Resource.Layout.Main); mFrame = FindViewById <AbsoluteLayout>(Resource.Id.layout); //4 mContext = this; mCamera = Android.Hardware.Camera.Open(0); //1 if (mCamera == null) { //2 Toast.MakeText(this, "Opening camera failed", ToastLength.Long).Show(); return; } mask = new CameraViewElement(this) { Clickable = true }; mask.Click += OnMaskClick; photoOutput = new CameraViewOutput(this) { CubeSize = mask.Size }; mask.SetOutput(photoOutput); preview = new CameraPreview(this, mCamera) { a = this, output = photoOutput, Clickable = true }; mask.LayoutParameters = new AbsoluteLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, 0, 0 ); photoOutput.LayoutParameters = new AbsoluteLayout.LayoutParams( 300, 533, 0, 0 );; mFrame = FindViewById <AbsoluteLayout>(Resource.Id.layout); //4 mFrame.AddView(preview); mFrame.AddView(mask); mFrame.AddView(photoOutput); /* * CubeAnimation cb = new CubeAnimation(this); * cb.LayoutParameters = new AbsoluteLayout.LayoutParams( * ViewGroup.LayoutParams.MatchParent, * ViewGroup.LayoutParams.MatchParent, * 0, 0 * ); * mFrame.AddView(cb); */ /* * mFrame.AddView(b = new Button(this) { * LayoutParameters = new AbsoluteLayout.LayoutParams( * ViewGroup.LayoutParams.MatchParent, * ViewGroup.LayoutParams.WrapContent, * 0, 0 * ), * Text = "Pick me" * }); * b.Click += OnClick; */ }