Code example for Rect

0
      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;
    } 
  } 
 
  /** 
   * A factory method to build the appropriate LuminanceSource object based on the format 
   * of the preview buffers, as described by Camera.Parameters. 
   * 
   * @param data A preview frame. 
   * @param width The width of the image. 
   * @param height The height of the image.