前言:猛然知道姥姥79了,我好怕,好想哭在给大家讲解了paint的几个方法之后,我觉得有必要插一篇有关Canvas画布的知识,在开始paint之前,我们讲解了canvas绘图的几篇文章和cavas的save()、store()的知识,这篇是对Canvas的一个系统的补充,前几篇文章链接如下:《自定义控件之绘图篇(一):概述及基本几何图形绘制》《 自定义控件之绘图篇(二):路径及文字》《自定义控件之...
分类:
其他好文 时间:
2016-05-06 15:28:46
阅读次数:
229
一、阴影:
Paint 类定义了一个名为 setShadowLayer 的方法:
public void
setShadowLayer(float radius,float dx,float dy,int shadowColor), 参数意义如下:
radius:阴影半径
dx: x 方向阴影的偏移量
dy: y 方向阴影的偏移量
shadowColor: 阴影的颜色
阴影lay...
分类:
其他好文 时间:
2016-05-06 13:11:47
阅读次数:
345
一、Canvas类android.graphics.Canvas
Canvas类好比手机中的画纸,我们可以在Canvas上画图形或者图像。一般我们用android来绘画的时候,需要四个组成部分:
1、位图:包含像素
2、Canvas画板:包含绘画内容,写入位图
3、初始图形:如Rect、Bitmap、text等
4、Paint:用来描述上面初始图形的颜色和类型等
Canvas类提供...
分类:
移动开发 时间:
2016-05-05 22:44:21
阅读次数:
231
Paint是填充像素并且最后合成在用户的屏幕上的过程。 通常是在管道中耗费最大的,你要尽可能的避免使用paint。 动画中使用除了transform和opacity的动画属性都将触发paint paint是像素管道中耗费最大的部分,所以避免使用之 在层提升(layer promotion)和编配动画 ...
分类:
其他好文 时间:
2016-05-05 19:09:35
阅读次数:
203
There is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two adjacent f ...
分类:
其他好文 时间:
2016-04-30 13:01:23
阅读次数:
214
There are a row of n houses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with a certai ...
分类:
其他好文 时间:
2016-04-30 13:00:19
阅读次数:
140
There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. Yo ...
分类:
其他好文 时间:
2016-04-30 12:44:50
阅读次数:
215
Android 自定义View的一些总结
Paint与Canvas
下面先说下Paint的基本设置函数:
paint.setAntiAlias(true);//抗锯齿功能
paint.setColor(Color.RED); //设置画笔颜色
paint.setStyle(Style.FILL);//设置填充样式
paint.setStrokeWidth(30);//设置画笔宽度
p...
分类:
移动开发 时间:
2016-04-29 15:24:03
阅读次数:
223
项目:具有圆形效果的自定义View 一、继承View并重写onDraw方法 public class CircleView extends View{ private static final int COLOR = Color.RED; private Paint mPaint = new Pai ...
分类:
其他好文 时间:
2016-04-24 15:37:58
阅读次数:
166
实现刮刮卡我们可以Get到哪些技能?* 圆形圆角图片的实现
* 双缓冲技术绘图
* Bitmap获取像素值数据
* 获取绘制文本的长宽
* 自定义View的掌握
* 获取屏幕密度
* TypeValue.applyDemension
* Canvas的一些绘制方法
* Paint的一些常用的属性
* Path的一些方法
刮刮卡的实现原理图
这里用到了13中模式中的DstOut这种模式。
对于这幅...
分类:
移动开发 时间:
2016-04-22 20:20:16
阅读次数:
289