Loading src/com/android/gallery3d/app/PhotoPage.java +1 −1 Original line number Diff line number Diff line Loading @@ -1240,7 +1240,7 @@ public class PhotoPage extends ActivityState implements if (resultCode == Activity.RESULT_OK) { Context context = mActivity.getAndroidContext(); String message = context.getString(R.string.crop_saved, context.getString(R.string.folder_download)); context.getString(R.string.folder_edited_online_photos)); Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } break; Loading src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java +7 −17 Original line number Diff line number Diff line Loading @@ -63,21 +63,6 @@ public class ImageFilterGeometry extends ImageFilter { native protected void nativeApplyFilterStraighten(Bitmap src, int srcWidth, int srcHeight, Bitmap dst, int dstWidth, int dstHeight, float straightenAngle); public Matrix buildMatrix(RectF r) { float dx = r.width()/2; float dy = r.height()/2; if(mGeometry.hasSwitchedWidthHeight()){ float temp = dx; dx = dy; dy = temp; } float w = r.left * 2 + r.width(); float h = r.top * 2 + r.height(); Matrix m = mGeometry.buildGeometryMatrix(w, h, 1f, dx, dy, false); return m; } @Override public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) { // TODO: implement bilinear or bicubic here... for now, just use Loading @@ -94,7 +79,12 @@ public class ImageFilterGeometry extends ImageFilter { temp = Bitmap.createBitmap(cropBounds.width(), cropBounds.height(), mConfig); } Matrix drawMatrix = buildMatrix(crop); RectF rp = mGeometry.getPhotoBounds(); RectF rc = mGeometry.getPreviewCropBounds(); Matrix drawMatrix = mGeometry.buildTotalXform(rp.width(), rp.height(), rc.width(), rc.height(), rc.left, rc.top, mGeometry.getRotation(), mGeometry.getStraightenRotation(), bitmap.getWidth() / rp.width(), null); Canvas canvas = new Canvas(temp); canvas.drawBitmap(bitmap, drawMatrix, new Paint()); return temp; Loading src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java +17 −0 Original line number Diff line number Diff line Loading @@ -239,4 +239,21 @@ public class GeometryMetadata { float h = mPhotoBounds.height(); return buildGeometryMatrix(w, h, scaling, dx, dy, false); } public Matrix buildTotalXform(float pwidth, float pheight, float cwidth, float cheight, float cleft, float ctop, float rotation, float straighten, float scale, RectF dst) { Matrix m = getFlipMatrix(pwidth, pheight); m.postRotate(rotation + straighten, pwidth / 2, pheight / 2); Matrix m1 = new Matrix(); m1.setRotate(rotation, pwidth / 2, pheight / 2); // find new top left for crop. RectF crop = new RectF(cleft, ctop, cleft + cwidth, ctop + cheight); if (!m1.mapRect(crop)) return null; if (dst != null) dst.set(crop); m.postTranslate(-crop.left, -crop.top); m.postScale(scale, scale); return m; } } src/com/android/gallery3d/filtershow/imageshow/ImageFlip.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import com.android.gallery3d.filtershow.imageshow.GeometryMetadata.FLIP; public class ImageFlip extends ImageGeometry { private static final Paint gPaint = new Paint(); private static final float MIN_FLICK_DIST_FOR_FLIP = 0.2f; private static final float MIN_FLICK_DIST_FOR_FLIP = 0.1f; private static final String LOGTAG = "ImageFlip"; private FLIP mNextFlip = FLIP.NONE; Loading Loading
src/com/android/gallery3d/app/PhotoPage.java +1 −1 Original line number Diff line number Diff line Loading @@ -1240,7 +1240,7 @@ public class PhotoPage extends ActivityState implements if (resultCode == Activity.RESULT_OK) { Context context = mActivity.getAndroidContext(); String message = context.getString(R.string.crop_saved, context.getString(R.string.folder_download)); context.getString(R.string.folder_edited_online_photos)); Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } break; Loading
src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java +7 −17 Original line number Diff line number Diff line Loading @@ -63,21 +63,6 @@ public class ImageFilterGeometry extends ImageFilter { native protected void nativeApplyFilterStraighten(Bitmap src, int srcWidth, int srcHeight, Bitmap dst, int dstWidth, int dstHeight, float straightenAngle); public Matrix buildMatrix(RectF r) { float dx = r.width()/2; float dy = r.height()/2; if(mGeometry.hasSwitchedWidthHeight()){ float temp = dx; dx = dy; dy = temp; } float w = r.left * 2 + r.width(); float h = r.top * 2 + r.height(); Matrix m = mGeometry.buildGeometryMatrix(w, h, 1f, dx, dy, false); return m; } @Override public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) { // TODO: implement bilinear or bicubic here... for now, just use Loading @@ -94,7 +79,12 @@ public class ImageFilterGeometry extends ImageFilter { temp = Bitmap.createBitmap(cropBounds.width(), cropBounds.height(), mConfig); } Matrix drawMatrix = buildMatrix(crop); RectF rp = mGeometry.getPhotoBounds(); RectF rc = mGeometry.getPreviewCropBounds(); Matrix drawMatrix = mGeometry.buildTotalXform(rp.width(), rp.height(), rc.width(), rc.height(), rc.left, rc.top, mGeometry.getRotation(), mGeometry.getStraightenRotation(), bitmap.getWidth() / rp.width(), null); Canvas canvas = new Canvas(temp); canvas.drawBitmap(bitmap, drawMatrix, new Paint()); return temp; Loading
src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java +17 −0 Original line number Diff line number Diff line Loading @@ -239,4 +239,21 @@ public class GeometryMetadata { float h = mPhotoBounds.height(); return buildGeometryMatrix(w, h, scaling, dx, dy, false); } public Matrix buildTotalXform(float pwidth, float pheight, float cwidth, float cheight, float cleft, float ctop, float rotation, float straighten, float scale, RectF dst) { Matrix m = getFlipMatrix(pwidth, pheight); m.postRotate(rotation + straighten, pwidth / 2, pheight / 2); Matrix m1 = new Matrix(); m1.setRotate(rotation, pwidth / 2, pheight / 2); // find new top left for crop. RectF crop = new RectF(cleft, ctop, cleft + cwidth, ctop + cheight); if (!m1.mapRect(crop)) return null; if (dst != null) dst.set(crop); m.postTranslate(-crop.left, -crop.top); m.postScale(scale, scale); return m; } }
src/com/android/gallery3d/filtershow/imageshow/ImageFlip.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import com.android.gallery3d.filtershow.imageshow.GeometryMetadata.FLIP; public class ImageFlip extends ImageGeometry { private static final Paint gPaint = new Paint(); private static final float MIN_FLICK_DIST_FOR_FLIP = 0.2f; private static final float MIN_FLICK_DIST_FOR_FLIP = 0.1f; private static final String LOGTAG = "ImageFlip"; private FLIP mNextFlip = FLIP.NONE; Loading