本文整理汇总了Java中android.graphics.PixelFormat.RGBX_8888属性的典型用法代码示例。如果您正苦于以下问题:Java PixelFormat.RGBX_8888属性的具体用法?Java PixelFormat.RGBX_8888怎么用?Java PixelFormat.RGBX_8888使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.graphics.PixelFormat
的用法示例。
在下文中一共展示了PixelFormat.RGBX_8888属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
private void start(final boolean isCamera) {
Log.d("ImageTakin", "StartCommand()");
pref = getApplicationContext().getSharedPreferences("MyPref", 0);
editor = pref.edit();
if (mCamera != null) {
queue.removeCallbacks(null);
mCamera.setPreviewCallback(null);
mCamera.stopPreview();
mCamera.release();
mCamera = Camera.open();
} else
mCamera = getCameraInstance();
parameters = mCamera.getParameters();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && parameters.getSupportedFocusModes().contains(
Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
} else if (parameters.getSupportedFocusModes().contains(
Camera.Parameters.FOCUS_MODE_AUTO)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
}
mCamera.setParameters(parameters);
size = parameters.getPreviewSize();
if (registeredShieldsIDs.contains(UIShield.COLOR_DETECTION_SHIELD.name()))
mCamera.setPreviewCallback(previewCallback);
windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_PRIORITY_PHONE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.RGBX_8888);
params.gravity = Gravity.TOP | Gravity.LEFT;
DisplayMetrics metrics = new DisplayMetrics();
windowManager.getDefaultDisplay().getMetrics(metrics);
int expectedHeight = metrics.heightPixels - ((int) (250 * metrics.density + .5f));
int expectedWidth = ((expectedHeight * (size == null ? metrics.widthPixels : size.height)) / (size == null ? metrics.heightPixels : size.width));
params.width = 1;// metrics.widthPixels - ((int) (60 * metrics.density + .5f));
params.height = 1;
params.x = (int) ((metrics.widthPixels / 2) - expectedWidth / 2);
params.y = (int) (150 * metrics.density + .5f);
params.alpha = 1;
sv = new SurfaceView(getApplicationContext());
windowManager.addView(sv, params);
params = (WindowManager.LayoutParams) sv.getLayoutParams();
sHolder = sv.getHolder();
sHolder.addCallback(this);
mOrientationEventListener = new OrientationEventListener(this,
SensorManager.SENSOR_DELAY_NORMAL) {
@Override
public void onOrientationChanged(int orientation) {
if (orientation == ORIENTATION_UNKNOWN) return;
mOrientation = (orientation + 45) / 90 * 90;
}
};
if (mOrientationEventListener.canDetectOrientation()) {
mOrientationEventListener.enable();
}
// tells Android that this surface will have its data constantly
// replaced
if (Build.VERSION.SDK_INT < 11)
sHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}