Android Bitmap Rotate reflectionFromBitmap(Bitmap originalBitmap, boolean isFuzzy)

Here you can find the source of reflectionFromBitmap(Bitmap originalBitmap, boolean isFuzzy)

Description

reflection From Bitmap

Declaration

public static Bitmap reflectionFromBitmap(Bitmap originalBitmap,
        boolean isFuzzy) 

Method Source Code

//package com.java2s;

import android.graphics.Bitmap;

import android.graphics.Canvas;

import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Shader.TileMode;

public class Main {

    public static Bitmap reflectionFromBitmap(Bitmap originalBitmap,
            boolean isFuzzy) {
        int width = originalBitmap.getWidth();
        int height = originalBitmap.getHeight();

        Matrix matrix = new Matrix();
        matrix.preScale(1, -1);/*w w w  .ja  v  a2  s.  c o m*/
        Bitmap reflectionBitmap = Bitmap.createBitmap(originalBitmap, 0, 0,
                width, height, matrix, false);

        if (isFuzzy) {
            Canvas canvasFuzzy = new Canvas(reflectionBitmap);
            Paint paint = new Paint();
            LinearGradient shader = new LinearGradient(0, 0, 0, height,
                    0x80ffffff, 0x00ffffff, TileMode.CLAMP);
            // Set the paint to use this shader (linear gradient)
            paint.setShader(shader);
            // Set the Transfer mode to be porter duff and destination in
            paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
            // Draw a rectangle using the paint with our linear gradient
            canvasFuzzy.drawRect(0, 0, width, height, paint);

            return reflectionBitmap;
        }

        return reflectionBitmap;
    }
}

Related

  1. rotatePic(Bitmap bitmap, int degree)
  2. rotation(Bitmap source, int degrees)
  3. GetRotatedBitmap(Bitmap bitmap, int degrees)
  4. computePictureRotation()
  5. GetExifOrientation(String filepath)
  6. rotate(Bitmap bitmap, int angle)
  7. rotate(Bitmap bitmap, int degrees)
  8. rotateBitmap(Bitmap bitmap, float degrees)
  9. rotateBitmap(Bitmap input, int degrees)