diff options
author | Owen Lin <owenlin@google.com> | 2009-05-18 15:31:17 -0700 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2009-05-22 01:47:45 -0700 |
commit | 059daa36dc6e83ca24a16d9b99925e71010bcceb (patch) | |
tree | 5e93d058a7f870a26ed214784ad60dd1ddad6ee5 /src/com/android/camera/Util.java | |
parent | 938aad0bd611642c121c4ca28f2d79502aa3cff9 (diff) | |
download | LegacyCamera-059daa36dc6e83ca24a16d9b99925e71010bcceb.zip LegacyCamera-059daa36dc6e83ca24a16d9b99925e71010bcceb.tar.gz LegacyCamera-059daa36dc6e83ca24a16d9b99925e71010bcceb.tar.bz2 |
New UI for donut's camera !!
Diffstat (limited to 'src/com/android/camera/Util.java')
-rw-r--r-- | src/com/android/camera/Util.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java index 261965a..028725b 100644 --- a/src/com/android/camera/Util.java +++ b/src/com/android/camera/Util.java @@ -25,7 +25,10 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; +import android.graphics.Paint; +import android.graphics.Path; import android.graphics.Rect; +import android.graphics.RectF; import android.media.MediaMetadataRetriever; import android.net.Uri; import android.os.ParcelFileDescriptor; @@ -412,4 +415,21 @@ public class Util { throw new AssertionError(); } } + + public static Bitmap makeRoundedCorner(Bitmap thumb, int rx, int ry) { + if (thumb == null) return null; + int width = thumb.getWidth(); + int height = thumb.getHeight(); + + Bitmap result = Bitmap.createBitmap( + width, height, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(result); + Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); + Path path = new Path(); + path.addRoundRect(new RectF( + 0, 0, width, height), rx, ry, Path.Direction.CCW); + canvas.clipPath(path); + canvas.drawBitmap(thumb, 0, 0, paint); + return result; + } } |