Class Overview
The Paint class holds the style and color information about how to draw geometries, text and bitmaps.
这个类拥有如何绘制集合、文本、位图的style和color的信息。
这个类的方法都比较简单。主要由:
1.getXxx某些信息的函数
2. isXxx...判断某些标识值的函数
3.setXxx 定义某些属性的函数
Paint类的函数主要由这三类函数组成。各个函数还是比较容易看懂的。具体来看几个。
public final boolean isLinearText ()
Helper for getFlags(), returning true if LINEAR_TEXT_FLAG bit is set 要查看LINEAR_TEXT_FLAG这个位的值
Returns
- true if the lineartext bit is set in the paint's flags
public final boolean isStrikeThruText ()
Helper for getFlags(), returning true if STRIKE_THRU_TEXT_FLAG bit is set
要查看STRIKE_THRU_TEXT_FLAG这个位的值
Returns
- true if the strikeThruText bit is set in the paint's flags.
public final boolean isSubpixelText ()
Helper for getFlags(), returning true if SUBPIXEL_TEXT_FLAG bit is set
要查看SUBPIXEL_TEXT_FLAG这个位的值
Returns
- true if the subpixel bit is set in the paint's flags
public final boolean isUnderlineText ()
Helper for getFlags(), returning true if UNDERLINE_TEXT_FLAG bit is set
要查看UNDERLINE_TEXT_FLAG这个位的值
Returns
- true if the underlineText bit is set in the paint's flags
这四个方法都是用来检查一些bit值是true or false。
再列举几个set某些属性的函数来结束本文。。。有空了再详细整理一下这个类
public void setAlpha (int a) 定义Paint一个实例的透明度
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]
Parameters
a | set the alpha component [0..255] of the paint's color. |
---|
public void setAntiAlias (boolean aa) 定义Paint实例是否antialias(true or false)
Helper for setFlags(), setting or clearing the ANTI_ALIAS_FLAG bit AntiAliasing smooths out the edges of what is being drawn, but is has no impact on the interior of the shape. See setDither() and setFilterBitmap() to affect how colors are treated.
Parameters
aa | true to set the antialias bit in the flags, false to clear it |
---|
public void setColor (int color) 定义Paint实例的颜色,注意这里颜色的表示方法
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.
Parameters
color | The new color (including alpha) to set in the paint. |
---|
总之,不要有畏难心理,一上来就应该查看开发者帮助文档,没那么困难。