Skip to content

Instantly share code, notes, and snippets.

@kgilmer
Created April 8, 2015 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgilmer/8aaad8f3d0dd844dff05 to your computer and use it in GitHub Desktop.
Save kgilmer/8aaad8f3d0dd844dff05 to your computer and use it in GitHub Desktop.
A picasso transform that creates a mirror (flip X) image.
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