本文整理了Java中android.util.Size.<init>()
方法的一些代码示例,展示了Size.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Size.<init>()
方法的具体详情如下:
包路径:android.util.Size
类名称:Size
方法名:<init>
暂无
代码示例来源:origin: MasayukiSuda/GPUVideo-android
public GPUMp4Composer size(int width, int height) {
this.outputResolution = new Size(width, height);
return this;
}
代码示例来源:origin: google-ar/sceneform-android-sdk
public void setVideoSize(int width, int height) {
videoSize = new Size(width, height);
}
代码示例来源:origin: yangjie10930/OpenGL4Android
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
Log.v("MP4Sur", "++onSurfaceTextureSizeChanged++");
mPreSize = new Size(width, height);
mp4Edior.setOutputSurface(mSurface, width, height);
}
代码示例来源:origin: yangjie10930/OpenGL4Android
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
mPreSize = new Size(width, height);
mp4Edior.setOutputSurface(mSurface, width, height);
}
代码示例来源:origin: MasayukiSuda/GPUVideo-android
@Override
public void setFrameSize(int width, int height) {
super.setFrameSize(width, height);
setResolution(new Size(width, height));
}
代码示例来源:origin: MasayukiSuda/CameraRecorder-android
@Override
public void setFrameSize(int width, int height) {
super.setFrameSize(width, height);
setResolution(new Size(width, height));
}
代码示例来源:origin: ArkadyGamza/Camera2API_rxJava2
/**
* Sensor could be rotated in the device, this method returns normal orientation sensor dimension
*/
public static Size getSensorSizeRotated(@NonNull CameraCharacteristics characteristics, @NonNull Size sensorSize) {
int sensorOrientationDegrees = CameraOrientationHelper.getSensorOrientation(characteristics);
if (sensorOrientationDegrees % 180 == 0) {
return sensorSize;
}
// swap dimensions
return new Size(sensorSize.getHeight(), sensorSize.getWidth());
}
代码示例来源:origin: yangjie10930/OpenGL4Android
@Override
public void surfaceCreated(SurfaceHolder holder) { //SurfaceView创建
// initCamera2();
// 初始化Camera
mCameraRecord.setOutputSurface(holder.getSurface());
mCameraRecord.setOutputSize(new Size(768, 1080));
mCameraRecord.setRenderer(Camera2Activity.this);
}
代码示例来源:origin: yangjie10930/OpenGL4Android
@Override
public void onSurfaceTextureAvailable(final SurfaceTexture surface, final int width, final int height) {
Log.v("MP4Sur", "++onSurfaceTextureAvailable++");
mPreSize = new Size(width, height);
mSurface = new Surface(surface);
mp4Edior.setOutputSurface(mSurface, width, height);
mp4Edior.setRenderer(new Renderer() {
@Override
public void create() {
mMp4EditFilter.create();
}
@Override
public void sizeChanged(int width2, int height2) {
mMp4EditFilter.sizeChanged(width2, height2);
MatrixUtils.flip(mMp4EditFilter.getVertexMatrix(), true, false);
MatrixUtils.rotation(mMp4EditFilter.getVertexMatrix(), 90);
}
@Override
public void draw(int texture) {
mMp4EditFilter.draw(texture);
}
@Override
public void destroy() {
Log.v("MP4Sur", "++destroy++");
mMp4EditFilter.destroy();
}
});
mp4Edior.startPreview();
}
代码示例来源:origin: MasayukiSuda/GPUVideo-android
private Size getVideoResolution(final String path, final int rotation) {
MediaMetadataRetriever retriever = null;
try {
retriever = new MediaMetadataRetriever();
retriever.setDataSource(path);
int width = Integer.valueOf(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
int height = Integer.valueOf(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT));
return new Size(width, height);
} finally {
try {
if (retriever != null) {
retriever.release();
}
} catch (RuntimeException e) {
Log.e(TAG, "Failed to release mediaMetadataRetriever.", e);
}
}
}
代码示例来源:origin: yangjie10930/OpenGL4Android
@Override
public void onSurfaceTextureAvailable(final SurfaceTexture surface, final int width, final int height) {
mPreSize = new Size(width, height);
mSurface = new Surface(surface);
mp4Edior.setOutputSurface(mSurface, width, height);
mp4Edior.setRenderer(new Renderer() {
@Override
public void create() {
adjustFilter.create();
}
@Override
public void sizeChanged(int width2, int height2) {
adjustFilter.sizeChanged(width2, height2);
MatrixUtils.flip(adjustFilter.getVertexMatrix(), true, false);
MatrixUtils.rotation(adjustFilter.getVertexMatrix(), 90);
}
@Override
public void draw(int texture) {
adjustFilter.draw(texture);
}
@Override
public void destroy() {
adjustFilter.destroy();
}
});
mp4Edior.startPreview();
}
代码示例来源:origin: kongqw/OpenCVForAndroid
return false;
else {
mPreviewSize = new Size(bestWidth, bestHeight);
return true;
代码示例来源:origin: DuckDeck/AndroidDemo
return false;
else {
mPreviewSize = new android.util.Size(bestWidth, bestHeight);
return true;
代码示例来源:origin: tantara/JejuNet
final Size desiredSize = new Size(width, height);
代码示例来源:origin: Nilhcem/tensorflow-classifier-android
@Override
public void onSurfaceTextureAvailable(
final SurfaceTexture texture, final int width, final int height) {
int index = getCameraId();
camera = Camera.open(index);
try {
Camera.Parameters parameters = camera.getParameters();
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
List<Camera.Size> cameraSizes = parameters.getSupportedPreviewSizes();
Size[] sizes = new Size[cameraSizes.size()];
int i = 0;
for (Camera.Size size : cameraSizes) {
sizes[i++] = new Size(size.width, size.height);
}
Size previewSize =
CameraConnectionFragment.chooseOptimalSize(
sizes, desiredSize.getWidth(), desiredSize.getHeight());
parameters.setPreviewSize(previewSize.getWidth(), previewSize.getHeight());
camera.setDisplayOrientation(90);
camera.setParameters(parameters);
camera.setPreviewTexture(texture);
} catch (IOException exception) {
camera.release();
}
camera.setPreviewCallbackWithBuffer(imageListener);
Camera.Size s = camera.getParameters().getPreviewSize();
camera.addCallbackBuffer(new byte[ImageUtils.getYUVByteSize(s.height, s.width)]);
textureView.setAspectRatio(s.height, s.width);
camera.startPreview();
}
代码示例来源:origin: tantara/JejuNet
int i = 0;
for (Camera.Size size : cameraSizes) {
sizes[i++] = new Size(size.width, size.height);
代码示例来源:origin: yangjie10930/OpenGL4Android
mTransformation.setInputSize(new Size(mSize.getWidth(), mSize.getWidth()));
mp4Edior.setTransformation(mTransformation);
break;
代码示例来源:origin: yangjie10930/OpenGL4Android
e.printStackTrace();
return new Size(mInputWidth, mInputHeight);
代码示例来源:origin: MasayukiSuda/GPUVideo-android
@Override
public void onStart(Size previewSize, boolean flash) {
Log.d(TAG, "previewSize : width " + previewSize.getWidth() + " height = " + previewSize.getHeight());
if (glPreviewRenderer != null) {
glPreviewRenderer.setCameraResolution(new Size(previewSize.getWidth(), previewSize.getHeight()));
}
flashSupport = flash;
if (cameraRecordListener != null) {
cameraRecordListener.onGetFlashSupport(flashSupport);
}
final float previewWidth = previewSize.getWidth();
final float previewHeight = previewSize.getHeight();
glSurfaceView.post(new Runnable() {
@Override
public void run() {
if (glPreviewRenderer != null) {
glPreviewRenderer.setAngle(degrees);
glPreviewRenderer.onStartPreview(previewWidth, previewHeight, isLandscapeDevice);
}
}
});
if (glPreviewRenderer != null) {
final SurfaceTexture st = glPreviewRenderer.getPreviewTexture().getSurfaceTexture();
st.setDefaultBufferSize(previewSize.getWidth(), previewSize.getHeight());
}
}
}, surfaceTexture, cameraManager, lensFacing);
代码示例来源:origin: 18Gray/ProCamera
@Override
public void configureCamera(int width, int height, int cameraNum)
{
try
{
mCameraId = manager.getCameraIdList()[cameraNum];
CameraCharacteristics characteristics = manager.getCameraCharacteristics(mCameraId);
//设置输出选项
StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
mSensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
mVideoSize = chooseVideoSize(map.getOutputSizes(MediaRecorder.class));
mPreviewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class), width, height, mVideoSize);
mPreviewSize = new Size(getMeasuredWidth(), getMeasuredHeight());
//如果屏幕旋转需要调整
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE)
{
setAspectRatio(mPreviewSize.getHeight(), mPreviewSize.getWidth());
} else
{
setAspectRatio(mPreviewSize.getWidth(), mPreviewSize.getHeight());
}
} catch (CameraAccessException e)
{
}
}
内容来源于网络,如有侵权,请联系作者删除!