每日学习一个api
每日学习一个api
別說你還沒有盡力
这个作者很懒,什么都没留下…
展开
-
Android 画布canvas drawText(char[] text, int index, int count, float x, float y, Paint paint)
('H','e','l','l','o',',','w','o','r','l','d'),如果只绘制e到l字符('e','l','l','o',',','w','o','r','l'),如何实现?count:绘制的字符数。从第二个字符开始绘制减1,不绘制最后一个字符再减一。所以是 content.size - 2。index是1,count是content.size - 2。index:字符数组中索引为1的字符开始绘制。原创 2023-03-11 17:43:13 · 97 阅读 · 0 评论 -
Android画布canvas drawLines(float[] pts, int offset, int count, Paint paint)
如果从第一个点开始,那第一条线的起点是(100f, 100f),终点是(200f, 200f)(100f, 100f, 200f, 200f, 300f, 100f, 400f, 200f,500f,100f,600f,200f),如果是offset = 4,那么就是从300f这个值开始算起点。offset = 0,count = 12,从第0个元素算起点,绘制3条线。原创 2023-03-10 14:45:46 · 298 阅读 · 0 评论 -
Android canvas drawDoubleRoundRect使用
outerRadii:外部矩形的四个圆角半径。8个值,floatArrayOf(左上,左上,右上,右上,右下,右下,左下,左下)比如:floatArrayOf(50f,50f,10f,10f,10f,10f,0f,0f)paint:画笔,默认是Paint.Style.FILL。innerRadii:内部矩形的四个圆角半径。作用是用指定画笔绘制两个圆角矩形。如果要绘制这样效果图如何实现?outer:外部矩形。inner:内部矩形。原创 2023-03-09 23:20:08 · 696 阅读 · 0 评论 -
Android 画布canvas drawBitmap(Bitmap bitmap, float left, float top, Paint paint)
void drawBitmap(Bitmap bitmap, float left, float top, Paint paint)Draw the specified bitmap, with its top/left corner at (x,y), using the specified paint, transformed by the current matrix.这个方法从...原创 2019-11-03 19:44:04 · 783 阅读 · 0 评论 -
Android 画布canvas drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint)
void drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint)Draw the specified bitmap, scaling/translating automatically to fill the destination rectangle.绘制指定的位图,自动缩放/平移以填充目标矩形。没有返回值。该方法有三个参...原创 2019-11-02 20:29:41 · 1089 阅读 · 0 评论 -
Android 画布canvas drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint)
void drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint)Draw the bitmap using the specified matrix.使用指定的矩阵绘制位图。也就是可以通过matrix的属性来控制如何绘制位图。该方法有三个参数,分别是:Bitmap bitmap:要绘制的位图Matrix matrix:绘制位图...原创 2019-11-01 21:57:21 · 1451 阅读 · 0 评论 -
Android 画布canvas drawArc方法
void drawArc(RectF oval, float startAngle, float sweepAngle, boolean useCenter, Paint paint)Draw the specified arc, which will be scaled to fit inside the specified oval.也就是在画布上绘制一个指定弧。这个方法有5个参数...原创 2019-11-01 00:12:35 · 412 阅读 · 0 评论 -
Android 画布canvas drawARGB(int a, int r, int g, int b)
void drawARGB(int a, int r, int g, int b)Fill the entire canvas' bitmap (restricted to the current clip) with the specified ARGB color, using srcover porterduff mode.也就是用ARGB颜色填充画布的意思。这个方法有三个参数,...原创 2019-10-30 21:33:34 · 1790 阅读 · 0 评论 -
Android 画布canvas concat(Matrix matrix)
void concat(Matrix matrix)Preconcat the current matrix with the specified matrix.可以理解成对matrix的变换应用到canvas上的所有对象。参数Matrix是The Matrix class holds a 3x3 matrix for transforming coordinates.意思。可以理...原创 2019-10-29 21:40:18 · 2036 阅读 · 0 评论 -
Android 画布canvas clipRect(Rect rect)
clipOutRect(Rectrect)Set the clip to the difference of the current clip and the specified rectangle, which is expressed in local coordinates.Canvas 中clipOutRect(Rectrect)方法,是对画布按照rect进行裁剪的意思。参数re...原创 2019-10-28 16:34:06 · 1084 阅读 · 0 评论 -
Android 画布canvas clipOutPath(Path path)
boolean clipOutPath(Path path)Set the clip to the difference of the current clip and the specified path.Canvas 中clipOutPath(Path path)方法,是对画布按照path进行裁剪的意思。参数path是由直线段,二次曲线和三次曲线组成的复合(多轮廓)几何路径。该方法...原创 2019-10-26 23:21:00 · 2281 阅读 · 0 评论