相关疑难解决方法(0)

使用TextureView缩放Camera2预览

我对Camera2 API的预览缩放有问题.我正在使用TextureView.

我想只缩放TextureView中显示的预览流.

我想缩放我使用Zoom Gesture的区域.

我使用SimpleOnScaleGestureListener!

我添加了以下代码.zoomingFactor和x和y位置都是正确的.

 private void updateTextureViewSize(float xPosi,float yPosi, float scale){
        float scaleX = 1.0f;
        float scaleY = 1.0f;




        float mVideoWidth = mCamcontrol.getmPreviewSize().getWidth();
        float mVideoHeight = mCamcontrol.getmPreviewSize().getHeight();

        int rotation = getWindowManager().getDefaultDisplay().getRotation();
        RectF viewRect = new RectF(0, 0, 1440, 2560);
        RectF bufferRect = new RectF(0, 0, mVideoHeight, mVideoWidth);

        bufferRect.offset(xPosi - bufferRect.centerX(), yPosi -    bufferRect.centerY());

         //16:9 faktor
        scaleX = ((mScale * scale) / 9f) * 16f;
        scaleY = ((mScale * scale) / 16f) * 9f;

        Matrix matrix = new …
Run Code Online (Sandbox Code Playgroud)

java android image zoom android-camera2

9
推荐指数
3
解决办法
1万
查看次数

标签 统计

android ×1

android-camera2 ×1

image ×1

java ×1

zoom ×1