summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2012-10-12 05:52:06 -0700
committerRuben Brunk <rubenbrunk@google.com>2012-10-12 13:02:45 -0700
commit99abd47222e829493b0757fe332bb83926c5d85d (patch)
tree2a629cef3abe01e322385377170bc24f3479ac1b /src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
parent98de2e2ff9ab7959ee7d6035a9f87ed39ebc7537 (diff)
downloadandroid_packages_apps_Snap-99abd47222e829493b0757fe332bb83926c5d85d.tar.gz
android_packages_apps_Snap-99abd47222e829493b0757fe332bb83926c5d85d.tar.bz2
android_packages_apps_Snap-99abd47222e829493b0757fe332bb83926c5d85d.zip
Adding crop UI. Fixes a number of other UI bugs.
Bug:7337191 Change-Id: If63dbdac6722ad4fc6c30c165d6c2eeb7011c240
Diffstat (limited to 'src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java')
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java b/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
index a14e065b2..d412f5890 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
@@ -33,7 +33,6 @@ public class GeometryMetadata {
private final RectF mPhotoBounds = new RectF();
private FLIP mFlip = FLIP.NONE;
-
private RectF mBounds = new RectF();
public enum FLIP {
@@ -47,7 +46,7 @@ public class GeometryMetadata {
set(g);
}
- public Bitmap apply(Bitmap original, float scaleFactor, boolean highQuality){
+ public Bitmap apply(Bitmap original, float scaleFactor, boolean highQuality) {
mImageFilter.setGeometryMetadata(this);
Bitmap m = mImageFilter.apply(original, scaleFactor, highQuality);
return m;
@@ -87,7 +86,6 @@ public class GeometryMetadata {
return new RectF(mPhotoBounds);
}
-
public void setScaleFactor(float scale) {
mScaleFactor = scale;
}
@@ -182,27 +180,34 @@ public class GeometryMetadata {
}
}
- public boolean hasSwitchedWidthHeight(){
+ public boolean hasSwitchedWidthHeight() {
return (((int) (mRotation / 90)) % 2) != 0;
}
- public Matrix buildGeometryMatrix(float width, float height, float scaling, float dx, float dy){
- float dx0 = width/2;
- float dy0 = height/2;
+ public Matrix buildGeometryMatrix(float width, float height, float scaling, float dx, float dy,
+ float rotation) {
+ float dx0 = width / 2;
+ float dy0 = height / 2;
Matrix m = getFlipMatrix(width, height);
m.postTranslate(-dx0, -dy0);
- float rot = mRotation % 360;
- if (rot < 0)
- rot += 360;
- m.postRotate(rot + mStraightenRotation);
+ m.postRotate(rotation);
m.postScale(scaling, scaling);
m.postTranslate(dx, dy);
return m;
}
- public Matrix buildGeometryUIMatrix(float scaling, float dx, float dy){
+ public Matrix buildGeometryMatrix(float width, float height, float scaling, float dx, float dy,
+ boolean onlyRotate) {
+ float rot = mRotation;
+ if (!onlyRotate) {
+ rot += mStraightenRotation;
+ }
+ return buildGeometryMatrix(width, height, scaling, dx, dy, rot);
+ }
+
+ public Matrix buildGeometryUIMatrix(float scaling, float dx, float dy) {
float w = mPhotoBounds.width();
float h = mPhotoBounds.height();
- return buildGeometryMatrix(w, h, scaling, dx, dy);
+ return buildGeometryMatrix(w, h, scaling, dx, dy, false);
}
}