当前位置: 首页>>代码示例>>C#>>正文


C# ISurfaceHolder类代码示例

本文整理汇总了C#中ISurfaceHolder的典型用法代码示例。如果您正苦于以下问题:C# ISurfaceHolder类的具体用法?C# ISurfaceHolder怎么用?C# ISurfaceHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ISurfaceHolder类属于命名空间,在下文中一共展示了ISurfaceHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnCreate

            public override void OnCreate(ISurfaceHolder surfaceHolder)
            {
                base.OnCreate (surfaceHolder);

                // By default we don't get touch events, so enable them.
                SetTouchEventsEnabled (true);
            }
开发者ID:rudini,项目名称:monodroid-samples,代码行数:7,代码来源:CubeWallpaper.cs

示例2: SurfaceChanged

        public void SurfaceChanged(ISurfaceHolder holder, [GeneratedEnum] Android.Graphics.Format format, int width, int height)
        {
            if (surfaceHolder.Surface == null) return;

            try
            {
                camera.StopPreview();
            }
            catch (Exception)
            {
                // ignored
            }

            try
            {
                camera.SetDisplayOrientation(90);
                camera.SetPreviewDisplay(surfaceHolder);
                camera.SetPreviewCallback(previewCallback);
                camera.StartPreview();

            }
            catch (Exception e)
            {
                Log.Debug("Cub.Xdroid.zbar", $"SurfaceChanged: error {e}");
            }

        }
开发者ID:joacar,项目名称:MonoDroid.ZBar,代码行数:27,代码来源:CameraPreview.cs

示例3: SurfaceCreated

        public void SurfaceCreated(ISurfaceHolder holder)
        {
            var outputFile = System.IO.Path.Combine(Android.OS.Environment.ExternalStorageDirectory.ToString(),
                                                    "myvideooutputfile.mp4");
            if (!recording)
            {
                mediaRecorder = new MediaRecorder();
                //correctCamera();
                //if (camera != null)
                //    mediaRecorder.SetCamera(camera);

                mediaRecorder.SetAudioSource(AudioSource.Mic);
                mediaRecorder.SetVideoSource(VideoSource.Camera);
                mediaRecorder.SetOutputFormat(OutputFormat.ThreeGpp);
                mediaRecorder.SetAudioEncoder(AudioEncoder.Aac);
                mediaRecorder.SetVideoEncoder(VideoEncoder.Mpeg4Sp);

                if (System.IO.File.Exists(outputFile))
                    System.IO.File.Delete(outputFile);
                System.IO.File.Create(outputFile);

                CamcorderProfile camProf = CamcorderProfile.Get(CamcorderQuality.Low);
                fps = camProf.VideoFrameRate;

                mediaRecorder.SetOutputFile(outputFile);
                mediaRecorder.SetPreviewDisplay(holder.Surface);
                mediaRecorder.Prepare();
            } else
            {
                mediaPlayer.SetDisplay(holder);
                mediaPlayer.SetDataSource(outputFile);
                mediaPlayer.Prepared += new EventHandler(mediaPlayer_Prepared);
                mediaPlayer.PrepareAsync();
            }
        }
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:35,代码来源:VideoMessageActivity.cs

示例4: SurfaceChanged

		public void SurfaceChanged (ISurfaceHolder holder, Android.Graphics.Format format, int w, int h)
		{
			// If your preview can change or rotate, take care of those events here.
			// Make sure to stop the preview before resizing or reformatting it.

			if (holder.Surface == null) {
				// preview surface does not exist
				CommonSampleLibrary.Log.Debug (TAG, "Preview surface does not exist");
				return;
			}

			// stop preview before making changes
			try {
				camera.StopPreview ();
				CommonSampleLibrary.Log.Debug (TAG, "Preview stopped.");
			} catch (Exception e) {
				// ignore: tried to stop a non-existent preview
				CommonSampleLibrary.Log.Debug(TAG, "Error starting camera preview: " + e.Message);
			}

			int orientation = CalculatePreviewOrientation (cameraInfo, displayOrientation);
			camera.SetDisplayOrientation (orientation);

			try {
				camera.SetPreviewDisplay (holder);
				camera.StartPreview ();
				CommonSampleLibrary.Log.Debug (TAG, "Camera preview started.");
			} catch (Exception e) {
				CommonSampleLibrary.Log.Debug (TAG, "Error starting camera preview: " + e.Message);
			}
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:31,代码来源:CameraPreview.cs

示例5: DrawThread

 public DrawThread(ISurfaceHolder holder, PointVector screenCenter, Player player)
 {
     mHolder = holder;
     mPlayer = player;
     mScreenCenter = screenCenter;
     UpdateInterval = 1000 / 60;
 }
开发者ID:harrisse,项目名称:Lotus,代码行数:7,代码来源:DrawThread.cs

示例6: SurfaceCreated

 public void SurfaceCreated(ISurfaceHolder holder)
 {
     mediaPlayer.SetDisplay(holder);
     mediaPlayer.SetDataSource(filename);
     mediaPlayer.Prepared += new EventHandler(mediaPlayer_Prepared);
     mediaPlayer.PrepareAsync();
 }
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:7,代码来源:EditVideo.cs

示例7: SurfaceDestroyed

        public void SurfaceDestroyed(ISurfaceHolder holder)
        {
            if (aNativeWindow != IntPtr.Zero)
                NativeMethods.ANativeWindow_release (aNativeWindow);

            aNativeWindow = IntPtr.Zero;
        }
开发者ID:yongweisun,项目名称:VulkanSharp,代码行数:7,代码来源:VulkanView.cs

示例8: SurfaceChanged

        void ISurfaceHolderCallback.SurfaceChanged(ISurfaceHolder holder, Android.Graphics.Format format, int width, int height)
        {
            if ((int)Android.OS.Build.VERSION.SdkInt >= 19)
            {
                if (!_isSurfaceChanged)
                {
                    _isSurfaceChanged = true;
                    _prevSurfaceWidth = width;
                    _prevSurfaceHeight = height;
                }
                else
                {
                    // Forcing reinitialization of the view if SurfaceChanged() is called more than once to fix shifted drawing on KitKat.
                    // See https://github.com/mono/MonoGame/issues/2492.
                    if (!ScreenReceiver.ScreenLocked && Game.Instance.Platform.IsActive &&
                        (_prevSurfaceWidth != width || _prevSurfaceHeight != height))
                    {
                        _prevSurfaceWidth = width;
                        _prevSurfaceHeight = height;

                        base.SurfaceDestroyed(holder);
                        base.SurfaceCreated(holder);
                    }
                }
            }

            SurfaceChanged(holder, format, width, height);
            Android.Util.Log.Debug("MonoGame", "MonoGameAndroidGameView.SurfaceChanged: format = " + format + ", width = " + width + ", height = " + height);

            if (_game.GraphicsDevice != null)
                _game.graphicsDeviceManager.ResetClientBounds();
        }
开发者ID:Breadmouth,项目名称:Gravitas,代码行数:32,代码来源:MonoGameAndroidGameView.cs

示例9: AcquireNativeWindow

        void AcquireNativeWindow(ISurfaceHolder holder)
        {
            if (aNativeWindow != IntPtr.Zero)
                NativeMethods.ANativeWindow_release (aNativeWindow);

            aNativeWindow = NativeMethods.ANativeWindow_fromSurface (JniEnvironment.EnvironmentPointer, Holder.Surface.Handle);
            NativeWindowAcquired ();
        }
开发者ID:yongweisun,项目名称:VulkanSharp,代码行数:8,代码来源:VulkanView.cs

示例10: SurfaceCreated

        public void SurfaceCreated(ISurfaceHolder holder)
        {
            this.holder = holder;

            var canvas = holder.LockCanvas();
            canvas.DrawColor(Android.Graphics.Color.Aquamarine);
            holder.UnlockCanvasAndPost(canvas);
        }
开发者ID:garuma,项目名称:raydroid,代码行数:8,代码来源:MainActivity.cs

示例11: CameraPreview

 /// <summary>
 /// Default ctor
 /// </summary>
 public CameraPreview(Context context, Camera camera)
     : base(context)
 {
     this.camera = camera;
     surfaceHolder = GetHolder();
     surfaceHolder.AddCallback(this);
     surfaceHolder.SetType(ISurfaceHolderConstants.SURFACE_TYPE_PUSH_BUFFERS);
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:11,代码来源:CameraPreview.cs

示例12: SurfaceCreated

 public void SurfaceCreated(ISurfaceHolder holder)
 {
     Log.Info("PERSPEX", "Surface Created");
     _renderTarget =
         PerspexLocator.Current.GetService<IPlatformRenderInterface>()
             .CreateRenderer(new PlatformHandle(holder.Surface.Handle, "Surface"));
     Draw();
 }
开发者ID:j123123,项目名称:Perspex,代码行数:8,代码来源:SkiaView.cs

示例13: SurfaceDestroyed

 public void SurfaceDestroyed(ISurfaceHolder holder)
 {
     if (!isPhotoTaken)
     {
         camera.StopPreview();
         camera.Release();
         previewing = false;
     }
 }
开发者ID:Armoken,项目名称:Learning,代码行数:9,代码来源:NewContactTakePhotoScreen.cs

示例14: SurfaceCreated

 public void SurfaceCreated (ISurfaceHolder holder)
 {
     if (camera == null) {
         this.camera = Android.Hardware.Camera.Open ();
         this.camera.SetPreviewDisplay (holder);
         this.camera.SetPreviewCallback (this);
         this.camera.StartPreview ();
     }
 }
开发者ID:Tolulope,项目名称:Tesseract.Xamarin,代码行数:9,代码来源:MainActivity.cs

示例15: SurfaceCreated

		public void SurfaceCreated (ISurfaceHolder holder)
		{
			try {
				if (Preview != null) {
					Preview.SetPreviewDisplay (holder);
				}
			} catch (Exception ex) {
				System.Diagnostics.Debug.WriteLine (@"			ERROR: ", ex.Message);
			}
		}
开发者ID:RickySan65,项目名称:xamarin-forms-samples,代码行数:10,代码来源:CameraPreview.cs


注:本文中的ISurfaceHolder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。