本文整理汇总了C#中Android.Hardware.Camera.SetPreviewTexture方法的典型用法代码示例。如果您正苦于以下问题:C# Camera.SetPreviewTexture方法的具体用法?C# Camera.SetPreviewTexture怎么用?C# Camera.SetPreviewTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Hardware.Camera
的用法示例。
在下文中一共展示了Camera.SetPreviewTexture方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartPreview
protected sealed override void StartPreview()
{
_camera = Camera.Open((int)CurrentCamera);
_camera.SetDisplayOrientation(90);
var parameters = _camera.GetParameters();
if (parameters.SupportedFocusModes.Contains(Camera.Parameters.FocusModeContinuousPicture))
{
parameters.FocusMode = Camera.Parameters.FocusModeContinuousPicture;
}
var optimalSize = GetOptimalPreviewSize(_width, _height);
if (optimalSize != null)
{
parameters.SetPreviewSize(optimalSize.Width, optimalSize.Height);
}
_camera.SetParameters(parameters);
try
{
_camera.SetPreviewTexture(_surface);
_camera.StartPreview();
}
catch (Java.IO.IOException ex)
{
Console.WriteLine(ex.Message);
}
}
示例2: OnSurfaceTextureAvailable
public void OnSurfaceTextureAvailable (Android.Graphics.SurfaceTexture surface, int w, int h)
{
_camera = Camera.Open ();
_textureView.LayoutParameters = new FrameLayout.LayoutParams (w, h);
try {
_camera.SetPreviewTexture (surface);
_camera.StartPreview ();
} catch (Java.IO.IOException ex) {
Console.WriteLine (ex.Message);
}
}
示例3: OnSurfaceTextureAvailable
public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int width, int height)
{
// var camInfo = new Camera.CameraInfo();
_camera = Camera.Open(0);
// _camera = Camera.Open();
_textureView.LayoutParameters = new FrameLayout.LayoutParams(width, height);
try
{
_camera.SetPreviewTexture(surface);
_camera.StartPreview();
}
catch (Java.IO.IOException ex)
{
Console.WriteLine(ex.Message);
}
}
示例4: OnSurfaceTextureAvailable
public void OnSurfaceTextureAvailable (Android.Graphics.SurfaceTexture surface, int width, int height)
{
_camera = Camera.Open ();
var previewSize = _camera.GetParameters ().PreviewSize;
_textureView.LayoutParameters =
new FrameLayout.LayoutParams (previewSize.Width, previewSize.Height, (int)GravityFlags.Center);
try {
_camera.SetPreviewTexture (surface);
_camera.StartPreview ();
} catch (Java.IO.IOException ex) {
Console.WriteLine (ex.Message);
}
// this is the sort of thing TextureView enables
_textureView.Rotation = 45.0f;
_textureView.Alpha = 0.5f;
}
示例5: OnSurfaceTextureAvailable
public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int width, int height)
{
_camera = Camera.Open ();
ConfigureCamera ();
Preview preview = new Preview ();
preview.OnFrame += OnPreviewFrame;
_camera.SetPreviewCallback (preview);
_textureView.LayoutParameters = new FrameLayout.LayoutParams (width, height);
try {
_camera.SetPreviewTexture (surface);
_camera.StartPreview ();
} catch (Exception e) {
Console.WriteLine (e.Message);
}
}
示例6: OnSurfaceCreated
public void OnSurfaceCreated(Javax.Microedition.Khronos.Opengles.IGL10 gl, Javax.Microedition.Khronos.Egl.EGLConfig config)
{
// Set the background frame color
GLES20.GlClearColor(0.0f, 0.0f, 0.0f, 1.0f);
initTex();
mSTexture = new SurfaceTexture(hTex[0]);
mSTexture.SetOnFrameAvailableListener(this);
mCamera = Android.Hardware.Camera.Open();
try
{
mCamera.SetPreviewTexture(mSTexture);
}
catch (Exception ioe)
{
}
GLES20.GlClearColor(0.0f, 0.0f, 0.0f, 1.0f);
hProgram = loadShader(vss, fss);
mTriangle = new Triangle();
}