LightingColorFilterView.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:zone-sdk 作者:
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);


    System.out.println("View.isHardwareAccelerated:"+isHardwareAccelerated());
    int width  = 300;
    //这里是为了等比缩放
    int height = width * mBmp.getHeight()/mBmp.getWidth();
    canvas.drawBitmap(mBmp,null,new Rect(0,0,width,height),mPaint);

    //为什么是ff而不能是01呢 因为A默认值是ff 所以 矩阵相乘的时候  会在mod255
    canvas.translate(0,height);
    mPaint.setColorFilter(new LightingColorFilter(0xffffff,0x0000f0));
    canvas.drawBitmap(mBmp,null,new Rect(0,0,width,height),mPaint);

    canvas.translate(0,height);
    mPaint.setColorFilter(new LightingColorFilter(0x00ff00,0x000000));
    canvas.drawBitmap(mBmp,null,new Rect(0,0,width,height),mPaint);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号