1.ColorMatrix矩阵运算(乘法)
色彩:针对每个像素处理。
Bitmap的内存从3.0以前的位于native,后来改成jvm,8.0以后,再次放在虚拟机里面-native层。
public static Bitmap gray(Bitmap src){
// 变成灰色,使用矩阵操作
Bitmap dst = Bitmap.createBitmap(src.getWidth(),src.getHeight(),src.getConfig());
Canvas canvas = new Canvas();
Paint paint = new Paint();
paint.setDither(false);
piant.setAntAlias(true);
ColorMatrix colorMatrix = new ColorMatrix();
canvas.drawBitmap(src, 0,0,paint);
return dst;
}
2.JavaBitmap获取像素操作
3.Native层操作像素指针
4.ARGB_8888 和RGB_565
5.Bitmap 内存复用