由网友(金钱主宰人生)分享简介:我要画线像这样光晕效果这个问题 - ACTION_MOVE )。I want to draw line with glow effect like this The problem - i must generate this line in program in dependence on user's in...
我要画线像这样光晕效果
这个问题 - ACTION_MOVE )。
I want to draw line with glow effect like this
The problem - i must generate this line in program in dependence on user's interaction ( the form of line will be generated in onTouchEvent
- ACTION_MOVE
).
我可以生成这一效果的XML文件或绘图premaid位图?
Can i generate this effect without xml files or drawing premaid bitmap ?
推荐答案
我模仿这种效果是这样的:
I imitate this effect in this way :
与 BlurMaskFilter
绘制行
在画了它正常的线路。
Draw line with BlurMaskFilter
Draw over it normal line.
我使用Path类来生成线,节省 MOVE_ACTION
的坐标事件生成路径的一部分我需要什么。
I use Path class to generate line and save coordinates of MOVE_ACTION
event to generate only part of path what i need.
创建2 油漆()
S:
_paintSimple = new Paint();
_paintSimple.setAntiAlias(true);
_paintSimple.setDither(true);
_paintSimple.setColor(Color.argb(248, 255, 255, 255));
_paintSimple.setStrokeWidth(20f);
_paintSimple.setStyle(Paint.Style.STROKE);
_paintSimple.setStrokeJoin(Paint.Join.ROUND);
_paintSimple.setStrokeCap(Paint.Cap.ROUND);
_paintBlur = new Paint();
_paintBlur.set(_paintSimple);
_paintBlur.setColor(Color.argb(235, 74, 138, 255));
_paintBlur.setStrokeWidth(30f);
_paintBlur.setMaskFilter(new BlurMaskFilter(15, BlurMaskFilter.Blur.NORMAL));
和借鉴两次我路径()
:
@Override
protected void onDraw(Canvas canvas) {
canvas.drawPath(mPath, _paintBlur);
canvas.drawPath(mPath, _paintSimple);
}
相关推荐
最新文章