本文整理汇总了C#中Android.Hardware.Camera.SetParameters方法的典型用法代码示例。如果您正苦于以下问题:C# Camera.SetParameters方法的具体用法?C# Camera.SetParameters怎么用?C# Camera.SetParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Hardware.Camera
的用法示例。
在下文中一共展示了Camera.SetParameters方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Liga
public bool Liga()
{
if (TemFlash)
{
camera = Camera.Open();
var parametros = camera.GetParameters();
parametros.FlashMode = Camera.Parameters.FlashModeTorch;
camera.SetParameters(parametros);
camera.StartPreview();
return true;
}
return false;
}
示例3: SetCameraOptimalPreviewSize
private static Camera.Size SetCameraOptimalPreviewSize(Camera camera, int w, int h)
{
Camera.Parameters parameters = camera.GetParameters();
IList<Camera.Size> sizes = parameters.SupportedPreviewSizes;
int maxWidth = 512, maxHeight = 512;
Camera.Size optimalSize = GetOptimalPreviewSize(sizes, w, h, maxWidth, maxHeight);
parameters.SetPreviewSize(optimalSize.Width, optimalSize.Height);
camera.SetParameters(parameters);
return optimalSize;
}
示例4: SwitchCamera
public void SwitchCamera(Camera camera)
{
SetCamera (camera);
try {
camera.SetPreviewDisplay (mHolder);
} catch (IOException exception) {
Log.Error (TAG, "IOException caused by setPreviewDisplay()", exception);
}
Camera.Parameters parameters = camera.GetParameters ();
parameters.SetPreviewSize (mPreviewSize.Width, mPreviewSize.Height);
RequestLayout();
camera.SetParameters (parameters);
}
示例5: CreateCamera
/// <summary>
/// Create the camera and try to set auto focus with flash
/// </summary>
/// <param name="holder"></param>
public void CreateCamera(ISurfaceHolder holder) {
try
{
_camera = Camera.Open();
Camera.Parameters p = _camera.GetParameters();
p.PictureFormat = Android.Graphics.ImageFormatType.Jpeg;
p.JpegQuality = 100;
hasAutoFocus = (p.SupportedFocusModes.Contains(Camera.Parameters.FocusModeAuto));
if (hasAutoFocus)
{
p.FocusMode = Camera.Parameters.FocusModeAuto;
focusReady = true;
}
else if (p.SupportedFocusModes.Contains(Camera.Parameters.FocusModeContinuousPicture))
{
p.FocusMode = Camera.Parameters.FocusModeContinuousPicture;
}
if (p.SupportedFlashModes.Contains(Camera.Parameters.FlashModeOn))
{
p.FlashMode = Camera.Parameters.FlashModeOn;
}
_camera.SetParameters(p);
_camera.SetDisplayOrientation(90);
_camera.SetPreviewCallback(this);
_camera.Lock();
_camera.SetPreviewDisplay(holder);
_camera.StartPreview();
if (hasAutoFocus)
{
Toast.MakeText(this, "Press screen to focus", ToastLength.Long).Show();
}
}
catch (Exception e)
{
}
}