/**
* 全倒影
*
* @param originalImage
* @return
*/
public static Bitmap createReflectedImage(Bitmap originalImage, int imageHeight) {
int width = originalImage.getWidth();
int height = originalImage.getHeight();
Matrix matrix = new Matrix();
matrix.preScale(1, -1);
Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0, height - imageHeight, width, imageHeight, matrix, false);
Bitmap bitmapWithReflection = Bitmap.createBitmap(width, (height + imageHeight), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmapWithReflection);
Paint defaultpPaint = new Paint();
canvas.drawBitmap(originalImage, 0, 0, defaultpPaint);
canvas.drawBitmap(reflectionImage, 0, height, defaultpPaint);
Paint paint = new Paint();
LinearGradient shader = new LinearGradient(0, originalImage.getHeight(), 0, bitmapWithReflection.getHeight(), 0x70ffffff, 0x00ffffff, TileMode.MIRROR);
paint.setShader(shader);
paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
canvas.drawRect(0, height, width, bitmapWithReflection.getHeight(), paint);
reflectionImage.recycle();
return bitmapWithReflection;
}
Reflect3DImage.java 文件源码
java
阅读 32
收藏 0
点赞 0
评论 0
项目:IMKBaseFrameworkLibrary
作者:
评论列表
文章目录