diff options
author | Sol Boucher <solb@google.com> | 2014-06-09 12:05:13 -0700 |
---|---|---|
committer | Sol Boucher <solb@google.com> | 2014-07-08 15:17:16 -0700 |
commit | a0842b40441db5332a5290f941021636b1182761 (patch) | |
tree | f87677f9a18112b5b8e4bcff2a502c8a416fa70d /camera2/portability/src/com/android/ex/camera2/portability/Size.java | |
parent | 858edec400cf5c7cf3171f877f81bbc891fc4bcc (diff) | |
download | android_frameworks_ex-a0842b40441db5332a5290f941021636b1182761.tar.gz android_frameworks_ex-a0842b40441db5332a5290f941021636b1182761.tar.bz2 android_frameworks_ex-a0842b40441db5332a5290f941021636b1182761.zip |
camera2-portability: Add support for previews using the camera2 API
At the moment, only SurfaceTextures (and not SurfaceViews/SurfaceHolders) are
supported. The tests still only cover Stringifier and IntegralStringifier.
Change-Id: Ie643c58f8383cd3b9f59c16e0b79239df0ca068d
Diffstat (limited to 'camera2/portability/src/com/android/ex/camera2/portability/Size.java')
-rw-r--r-- | camera2/portability/src/com/android/ex/camera2/portability/Size.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/camera2/portability/src/com/android/ex/camera2/portability/Size.java b/camera2/portability/src/com/android/ex/camera2/portability/Size.java index 9ae21aa..042c443 100644 --- a/camera2/portability/src/com/android/ex/camera2/portability/Size.java +++ b/camera2/portability/src/com/android/ex/camera2/portability/Size.java @@ -45,6 +45,20 @@ public class Size { } /** + * A helper method to build a list of this class from a list of {@link android.util.Size}. + * + * @param cameraSizes Source. + * @return The built list. + */ + public static List<Size> buildListFromAndroidSizes(List<android.util.Size> androidSizes) { + ArrayList<Size> list = new ArrayList<Size>(androidSizes.size()); + for (android.util.Size androidSize : androidSizes) { + list.add(new Size(androidSize)); + } + return list; + } + + /** * Encode List of this class as comma-separated list of integers. * * @param sizes List of this class to encode. @@ -110,6 +124,19 @@ public class Size { } /** + * Constructor from a source {@link android.util.Size}. + * + * @param other The source size. + */ + public Size(android.util.Size other) { + if (other == null) { + val = new Point(0, 0); + } else { + val = new Point(other.getWidth(), other.getHeight()); + } + } + + /** * Constructor from a source {@link android.graphics.Point}. * * @param p The source size. |