我正在使用opentok,我已经实现了一个自定义的视频捕获,以便能够获取一个帧,并将其保存在手机上(帧大小是宽度:480xheight:640)。我在屏幕中央画了一个矩形,像这样
this.screenHeight = screenSize.getHeight();
this.screenWidth = screenSize.getWidth();
this.externalRect = new RectF(0, 0, screenWidth, screenHeight);
float desiredHeight;
float desiredWidth;
desiredWidth = (float) (externalRect.width() * 0.80);
desiredHeight = (float) (desiredWidth / ratio);
internalRect = new RectF(externalRect.left + ((externalRect.width() - desiredWidth) /2),
externalRect.top + ((externalRect.height() - desiredHeight) / 2),
externalRect.right - ((externalRect.width() - desiredWidth) / 2),
externalRect.bottom - ((externalRect.height() - desiredHeight) / 2));
int contourRectOffset = 0;
contourRect = new RectF(internalRect.left - CONTOURS_STROKE_WIDTH - contourRectOffset,
internalRect.top - CONTOURS_STROKE_WIDTH - contourRectOffset,
internalRect.right + CONTOURS_STROKE_WIDTH + contourRectOffset,
internalRect.bottom + CONTOURS_STROKE_WIDTH + contourRectOffset);
现在捕获的帧是480x640大,在进行裁剪时我得到一个错误(x+宽度必须小于或等于位图大小)
如何根据矩形裁剪位图?
暂无答案!
目前还没有任何答案,快来回答吧!