Android ColorMatrix 变换 饱和度 缩放
2017-12-07 19:44
176 查看
矩阵的一些操作
@Override protected void onDraw(Canvas canvas) { //关闭硬件加速 setLayerType(View.LAYER_TYPE_SOFTWARE,null); //NORMAL: 内外都模糊绘制 Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setColor(Color.RED); //图片 Bitmap resource = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher); //绘制原图 canvas.drawBitmap(resource,100,100,paint); //设置颜色过滤器 ColorMatrix matrix = new ColorMatrix(); paint.setColorFilter(new ColorMatrixColorFilter(matrix)); canvas.drawBitmap(resource,500,100,paint); }
常用的一些API
Colormatrix 类中的方法 /** * 色彩缩放 */ public void setScale(float rScale, float gScale, float bScale,float aScale) {} /** * 饱和度设置 * 0 == 灰色图片 * 1 == 保持不变 * >1 增加饱和度 */ public void setSaturation(float sat) {} /** * 色彩旋转 * @axis 绕着那个轴旋转(0,1,2) * <code>axis=0</code> 绕着红轴 * <code>axis=1</code> 绕着绿轴 * <code>axis=2</code> 绕着蓝轴 * @degrees 旋转的度数 */ public void setRotate(int axis, float degrees) {}
相关文章推荐
- Android图片旋转,缩放,位移,倾斜,对称完整示例(二)——Bitmap.createBitmap()和Matrix
- Android开发之ImageView通过matrix实现两点缩放和图片拖动
- android.graphics.Camera实现图像的旋转、缩放,配合Matrix...
- Android中图像变换Matrix的原理、代码验证和应用(二)
- Android:视图绘制(六) ------Paint进阶之ColorMatrix(一)
- Android中图像变换Matrix的原理、代码验证和应用(二)
- Android中图像变换Matrix的原理应用
- Android缩放drawable 压缩图片 matrix
- Android matrix 控制图片的旋转、缩放、移动
- Android图片旋转,缩放,位移,倾斜,对称完整示例(二)——Bitmap.createBitmap()和Matrix
- Decomposing a matrix(用于分解变换矩阵至旋转、平移,缩放分量)
- android使用matrix控制图片的旋转,缩放
- Android图片处理(Matrix,ColorMatrix)
- Android 使用Matrix进行图像变换,和矩阵分析!
- Android中图像变换Matrix的原理、代码验证和应用(三)
- Android matrix 控制图片的旋转、缩放、移动
- Android matrix 控制图片的旋转、缩放、移动
- Android矩阵原理详解(Matrix,ColorMatrix)
- Android中图像变换Matrix的原理、代码验证和应用(三)
- [Android]android.graphics.Camera实现图像的旋转、缩放,配合Matrix实现图像的倾斜