android 图片处理
来源:互联网 发布:中国最大的unity3d论坛 编辑:程序博客网 时间:2024/06/09 15:02
android圆角处理
public static Bitmap getRoundedCornerbitmap(Bitmap bitmap,float roundpx)
{
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint p = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectf = new RectF(rect);
p.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
p.setColor(color);
canvas.drawRoundRect(rectf, roundpx, roundpx, p);
p.setXfermode(new PorterDuffXfermode(android.graphics.PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, p);
return output;
}
倒影效果:
public static Bitmap creatReflection(Bitmap bitmap)
{
final int reflectionGap = 4;
int w = bitmap.getWidth();
int h = bitmap.getHeight();
Matrix matrix = new Matrix();
matrix.preScale(1, -1);
Bitmap reflectionImage = Bitmap.createBitmap(bitmap, 0, h/2, w, h/2, matrix, false);
Bitmap bitreflection = Bitmap.createBitmap(w, h+h/2, Config.ARGB_8888);
Canvas canvas = new Canvas(bitreflection);
Paint p = new Paint();
canvas.drawRect(0, h, w, h+reflectionGap, p);
canvas.drawBitmap(reflectionImage, 0, h+reflectionGap, null);
Paint p1 = new Paint();
LinearGradient shader = new LinearGradient(0, bitmap.getHeight(), 0, bitreflection.getHeight()+reflectionGap, 0x70ffffff, 0x00ffffff, TileMode.CLAMP);
p1.setShader(shader);
p1.setXfermode(new PorterDuffXfermode(android.graphics.PorterDuff.Mode.DST_IN));
canvas.drawRect(0, h, w, bitreflection.getHeight()+reflectionGap, p1);
return bitreflection;
}
- android图片处理一
- android 图片放大处理
- android 处理图片资源
- Android处理图片
- android图片处理技巧
- android处理图片
- Android图片处理技巧
- Android图片处理技巧
- android图片处理方法
- android 图片处理
- Android 图片处理特效
- android 图片处理
- android 图片处理
- android 图片处理
- android图片处理方法
- android图片处理
- android 处理图片工具
- Android图片处理
- uva10010 - Where's Waldorf?
- 引用和指针
- jfreechat
- [hdu-] Sum Problem
- MapReduce工作原理图文详解
- android 图片处理
- 成功人的共同特点
- poj 3185 The Water Bowls(高斯消元)
- 【InversionCount 逆序对数 + MergeSort】
- mapreduce程序实现排序
- dojo小例子(12)form转换成带内部对象的json数据
- j2ee规范13种
- jquery mobile如何实现滑动屏幕跳转页面
- 使用ImageSwitcher实现换图片