• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ISurfaceHolder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: SurfaceChanged

        public void SurfaceChanged (ISurfaceHolder holder, Format format, int wx, int hx)
        {
            tcsSurfaceReady.TrySetResult (null);

            if (wasStarted) {
                SetupCamera ().ContinueWith (t => {
                    MobileBarcodeScanner.LogError ("SetupCamera Failed: {0}", t.Exception);
                }, TaskContinuationOptions.OnlyOnFaulted);
            }
        }
开发者ID:geffzhang,项目名称:ZxingSharp.Mobile,代码行数:10,代码来源:ZXingSurfaceView.cs


示例17: SurfaceCreated

		public void SurfaceCreated (ISurfaceHolder holder)
		{
			// The Surface has been created, now tell the camera where to draw the preview.
			try {
				camera.SetPreviewDisplay (holder);
				camera.StartPreview ();
				CommonSampleLibrary.Log.Debug (TAG, "Camera preview started.");
			} catch (Exception e) {
				Log.Debug (TAG, "Error setting camera preview: " + e.Message);
			}
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:11,代码来源:CameraPreview.cs


示例18: SurfaceChanged

        public void SurfaceChanged(ISurfaceHolder holder, Android.Graphics.Format format, int width, int height)
        {
            var measuredWidth = View.MeasureSpec.MakeMeasureSpec(width, MeasureSpecMode.Exactly);
            var measuredHeight = View.MeasureSpec.MakeMeasureSpec(height, MeasureSpecMode.Exactly);

            _countDownView.Measure(measuredWidth, measuredHeight);
            _countDownView.Layout(0, 0, _countDownView.MeasuredWidth, _countDownView.MeasuredHeight);

            _chronometerView.Measure(measuredWidth, measuredHeight);
            _chronometerView.Layout(0, 0, _chronometerView.MeasuredWidth, _chronometerView.MeasuredHeight);
        }
开发者ID:42Spikes,项目名称:F2S,代码行数:11,代码来源:ChronometerRenderer.cs


示例19: SurfaceCreated

 public void SurfaceCreated(ISurfaceHolder holder)
 {
     try
     {
         camera.SetPreviewDisplay(surfaceHolder);
         camera.StartPreview();
     }
     catch 
     {
         // Ignore for now
     }
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:12,代码来源:CameraPreview.cs


示例20: SurfaceChanged

 public void SurfaceChanged(ISurfaceHolder holder, [GeneratedEnum] Format format, int width, int height)
 {
     if (previewing)
     {
         camera.StopPreview();
         previewing = false;
     }
     if (camera != null)
     {
         startCamera();
     }
 }
开发者ID:Armoken,项目名称:Learning,代码行数:12,代码来源:NewContactTakePhotoScreen.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISurrogateSelector类代码示例发布时间:2022-05-24
下一篇:
C# ISurface类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap