美文网首页Android问题汇总(遥远的回忆过去)
Android-自定义View-Canvas-Paint set

Android-自定义View-Canvas-Paint set

作者: MonkeyLei | 来源:发表于2019-08-19 09:16 被阅读0次

    在使用Paint时候下面两个方法都调用了

    Paint.setAlpha()

    Paint.setColor()

    setColor()
    Set the paint's color. Note that the color is an int containing alpha as well as r,g,b. 
    This 32bit value is not premultiplied, meaning that its alpha can be any value,
     regardless of the values of r,g,b. See the Color class for more details.
    
    setAlpha()
    Helper to setColor(), that only assigns the color's alpha value,
     leaving its r,g,b values unchanged.
     Results are undefined if the alpha value is outside of the range [0..255]
    

    setColor()是包含透明度设置的,因为setAlpha()执行在后,所以被setColor重置了,没有看到效把setAlpha()放在setColor()方法之后

    image

    相关文章

      网友评论

        本文标题:Android-自定义View-Canvas-Paint set

        本文链接:https://www.haomeiwen.com/subject/bnbjsctx.html