コード例 #1
0
ファイル: CameraSource.java プロジェクト: sommayah/Alexandria
 /**
  * Sets the desired width and height of the camera frames in pixels. If the exact desired values
  * are not available options, the best matching available options are selected. Also, we try to
  * select a preview size which corresponds to the aspect ratio of an associated full picture
  * size, if applicable. Default: 1024x768.
  */
 public Builder setRequestedPreviewSize(int width, int height) {
   // Restrict the requested range to something within the realm of possibility.  The
   // choice of 1000000 is a bit arbitrary -- intended to be well beyond resolutions that
   // devices can support.  We bound this to avoid int overflow in the code later.
   final int MAX = 1000000;
   if ((width <= 0) || (width > MAX) || (height <= 0) || (height > MAX)) {
     throw new IllegalArgumentException(
         mCameraSource.mContext.getString(R.string.invalid_preview_size)
             + width
             + mCameraSource.mContext.getString(R.string.x)
             + height);
   }
   mCameraSource.mRequestedPreviewWidth = width;
   mCameraSource.mRequestedPreviewHeight = height;
   return this;
 }
コード例 #2
0
ファイル: CameraSource.java プロジェクト: sommayah/Alexandria
 /**
  * Sets the camera to use (either {@link #CAMERA_FACING_BACK} or {@link #CAMERA_FACING_FRONT}).
  * Default: back facing.
  */
 public Builder setFacing(int facing) {
   if ((facing != CAMERA_FACING_BACK) && (facing != CAMERA_FACING_FRONT)) {
     throw new IllegalArgumentException(
         mCameraSource.mContext.getString(R.string.invalid_camera) + facing);
   }
   mCameraSource.mFacing = facing;
   return this;
 }
コード例 #3
0
ファイル: CameraSource.java プロジェクト: sommayah/Alexandria
 /**
  * Sets the requested frame rate in frames per second. If the exact requested value is not not
  * available, the best matching available value is selected. Default: 30.
  */
 public Builder setRequestedFps(float fps) {
   if (fps <= 0) {
     throw new IllegalArgumentException(
         mCameraSource.mContext.getString(R.string.invalid_fps) + fps);
   }
   mCameraSource.mRequestedFps = fps;
   return this;
 }
コード例 #4
0
ファイル: CameraSource.java プロジェクト: sommayah/Alexandria
    /**
     * Creates a camera source builder with the supplied context and detector. Camera preview images
     * will be streamed to the associated detector upon starting the camera source.
     */
    public Builder(Context context, Detector<?> detector) {
      if (context == null) {
        throw new IllegalArgumentException(
            "No context supplied."); // can't put it in string when context is null
      }
      if (detector == null) {
        throw new IllegalArgumentException("No detector supplied.");
      }

      mDetector = detector;
      mCameraSource.mContext = context;
    }
コード例 #5
0
ファイル: CameraSource.java プロジェクト: sommayah/Alexandria
 /** Creates an instance of the camera source. */
 public CameraSource build() {
   mCameraSource.mFrameProcessor = mCameraSource.new FrameProcessingRunnable(mDetector);
   return mCameraSource;
 }
コード例 #6
0
ファイル: CameraSource.java プロジェクト: sommayah/Alexandria
 public Builder setFlashMode(@FlashMode String mode) {
   mCameraSource.mFlashMode = mode;
   return this;
 }
コード例 #7
0
ファイル: CameraSource.java プロジェクト: sommayah/Alexandria
 public Builder setFocusMode(@FocusMode String mode) {
   mCameraSource.mFocusMode = mode;
   return this;
 }