CameraManager.java 文件源码

java
阅读 77 收藏 0 点赞 0 评论 0

项目:tvConnect_android 作者:
/**
 * Allows third party apps to specify the scanning rectangle dimensions, rather than determine
 * them automatically based on screen resolution.
 *
 * @param width The width in pixels to scan.
 * @param height The height in pixels to scan.
 */
public synchronized void setManualFramingRect(int width, int height) {
  if (initialized) {
    Point screenResolution = configManager.getScreenResolution();
    if (width > screenResolution.x) {
      width = screenResolution.x;
    }
    if (height > screenResolution.y) {
      height = screenResolution.y;
    }
    int leftOffset = (screenResolution.x - width) / 2;
    int topOffset = (screenResolution.y - height) / 2;
    framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
    Log.d(TAG, "Calculated manual framing rect: " + framingRect);
    framingRectInPreview = null;
  } else {
    requestedFramingRectWidth = width;
    requestedFramingRectHeight = height;
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号