Created
April 8, 2015 05:52
-
-
Save kgilmer/8aaad8f3d0dd844dff05 to your computer and use it in GitHub Desktop.
A picasso transform that creates a mirror (flip X) image.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final Transformation mirror = new Transformation() { | |
@Override | |
public Bitmap transform(Bitmap source) { | |
Matrix m = new Matrix(); | |
m.preScale(-1, 1); | |
Bitmap src = source; | |
Bitmap dst = Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), m, false); | |
dst.setDensity(DisplayMetrics.DENSITY_DEFAULT); | |
src.recycle(); | |
return dst; | |
} | |
@Override | |
public String key() { | |
return "mirror"; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment