android paint滤镜API

ColorMatrix colorMatrix =newColorMatrix(

newfloat[]{1, 0, 0, 0, 0,

                0, 1, 0, 0, 0,

                0, 0, 1, 0, 0,

                0, 0, 0, 1, 0});

mPaint.setColorFilter(newColorMatrixColorFilter(colorMatrix));

mPaint.setColor(Color.argb(255, 255, 128, 103));

canvas.drawCircle(240, 600 / 2, 200, mPaint);

Bitmap bitmap=BitmapFactory.decodeResource(mContext.getResources(), R.drawable.kale);

canvas.drawBitmap(bitmap,240,600,mPaint);

canvas真正的画笔颜色为colorMatrix*(255, 255, 128, 103,1)。颜色混合即滤镜。

你可能感兴趣的:(android paint滤镜API)