本文整理汇总了Java中android.graphics.ComposePathEffect类的典型用法代码示例。如果您正苦于以下问题:Java ComposePathEffect类的具体用法?Java ComposePathEffect怎么用?Java ComposePathEffect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComposePathEffect类属于android.graphics包,在下文中一共展示了ComposePathEffect类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onDraw
import android.graphics.ComposePathEffect; //导入依赖的package包/类
@Override protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//无效果
mEffects[0] = null;
//拐角处变得圆滑
mEffects[1] = new CornerPathEffect(30);
//线段上就会产生许多杂点
mEffects[2] = new DiscretePathEffect(3.0F, 5.0F);
//绘制虚线
mEffects[3] = new DashPathEffect(new float[] { 20, 10, 5, 10 }, 0);
Path path = new Path();
path.addRect(0, 0, 8, 8, Path.Direction.CCW);
//设置点的图形,即方形点的虚线,圆形点的虚线
mEffects[4] = new PathDashPathEffect(path, 12, 0, PathDashPathEffect.Style.ROTATE);
//组合PathEffect
mEffects[5] = new ComposePathEffect(mEffects[3], mEffects[1]);
for (int i = 0; i < mEffects.length; i++) {
mPaint.setPathEffect(mEffects[i]);
canvas.drawPath(mPath, mPaint);
canvas.translate(0, 200);
}
}
开发者ID:liuguoquan727,项目名称:android-study,代码行数:23,代码来源:PathEffectView.java
示例2: assignPaint
import android.graphics.ComposePathEffect; //导入依赖的package包/类
protected CiPaint assignPaint() {
CiPaint paint = new CiPaint(drawingContext.getPaint());
paint.setStyle(Paint.Style.STROKE);
paint.setAntiAlias(true);
paint.setStrokeJoin(Paint.Join.ROUND);
paint.setStrokeCap(Paint.Cap.ROUND);
if (smoothRadius > 0) {
CornerPathEffect effect = new CornerPathEffect(smoothRadius);
if (paint.getPathEffect() == null) {
paint.setPathEffect(effect);
} else {
ComposePathEffect composeEffect = new ComposePathEffect(paint.getPathEffect(), effect);
paint.setPathEffect(composeEffect);
}
}
return paint;
}
开发者ID:mocircle,项目名称:cidrawing,代码行数:18,代码来源:SmoothStrokeMode.java
示例3: createPaint
import android.graphics.ComposePathEffect; //导入依赖的package包/类
private Paint createPaint(int color, float lineWidth, boolean isWorking){
Paint paint = new Paint();
paint.setStyle(Style.STROKE);
paint.setAntiAlias(true);
paint.setColor(color);
if (isWorking) {
paint.setStrokeWidth(lineWidth);
paint.setPathEffect(
new CornerPathEffect(lineWidth * 0.2f));
} else {
paint.setStrokeWidth(lineWidth * 0.75f);
paint.setPathEffect(new ComposePathEffect(
new DashPathEffect(new float[]{lineWidth * 0.8f, lineWidth * 0.2f}, 0),
new CornerPathEffect(lineWidth * 0.2f)
));
}
return paint;
}
开发者ID:RomanGolovanov,项目名称:ametro,代码行数:20,代码来源:SegmentElement.java
示例4: initPaint
import android.graphics.ComposePathEffect; //导入依赖的package包/类
private void initPaint() {
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(5);
mPaint.setColor(Color.RED);
mPath = new Path();
mPath.moveTo(0, 0);
for(int i = 0;i<=30;i++){
mPath.lineTo(i*35, (float)Math.random()*100);
}
mEffects = new PathEffect[7];
mEffects[0] = null;
mEffects[1] = new CornerPathEffect(10);
mEffects[2] = new DiscretePathEffect(3.0F, 5.0F);
mEffects[3] = new DashPathEffect(new float[] { 20, 10, 5, 10 }, mPhase);
Path path = new Path();
path.addRect(0, 0, 8, 8, Path.Direction.CCW);
mEffects[4] = new PathDashPathEffect(path, 12, mPhase, PathDashPathEffect.Style.ROTATE);
mEffects[5] = new ComposePathEffect(mEffects[2], mEffects[4]);
mEffects[6] = new SumPathEffect(mEffects[4], mEffects[3]);
}
开发者ID:xu6148152,项目名称:binea_project_for_android,代码行数:28,代码来源:PathEffectView.java
示例5: makeEffects
import android.graphics.ComposePathEffect; //导入依赖的package包/类
private static void makeEffects(PathEffect[] e, float phase) {
e[0] = null; // no effect
e[1] = new CornerPathEffect(10);
e[2] = new DashPathEffect(new float[] {10, 5, 5, 5}, phase);
e[3] = new PathDashPathEffect(makePathDash(), 12, phase,
PathDashPathEffect.Style.ROTATE);
e[4] = new ComposePathEffect(e[2], e[1]);
e[5] = new ComposePathEffect(e[3], e[1]);
}
开发者ID:garlicG,项目名称:CUT-IN-material,代码行数:10,代码来源:PathEffectsCutin.java
示例6: init
import android.graphics.ComposePathEffect; //导入依赖的package包/类
private void init(Context context) {
mainTitlePaint = new Paint();
mainTitlePaint.setColor(ContextCompat.getColor(context, R.color.white));
mainTitlePaint.setTextAlign(Paint.Align.CENTER);
mainTitlePaint.setTextSize(DensityUtils.sp2px(context, MAIN_TITLE_FONT_SIZE_SP));
mainTitleOffsetY = -(mainTitlePaint.getFontMetrics().ascent +
mainTitlePaint.getFontMetrics().descent) / 2;
mainTitlePaint.setAntiAlias(true);
circleColor = ContextCompat.getColor(context, R.color.whiteTransparent);
subTitlePaint = new Paint();
subTitlePaint.setColor(circleColor);
subTitlePaint.setTextSize(DensityUtils.sp2px(context, SUB_TITLE_FONT_SIZE_SP));
subTitleOffsetY = DensityUtils.sp2px(context, SUB_TITLE_FONT_OFFSET_DP);
subTitleSeparator = getResources().getString(R.string.sub_title_separator);
subTitlePaint.setAntiAlias(true);
bigCirclePaint = new Paint();
bigCirclePaint.setStrokeWidth(DensityUtils.dp2px(context, BIG_CIRCLE_SIZE));
bigCirclePaint.setStyle(Paint.Style.STROKE);
bigCirclePaint.setAntiAlias(true);
blurPaint = new Paint(bigCirclePaint);
blurSize = DensityUtils.dp2px(context, CIRCLE_BLUR_SIZE);
PathEffect pathEffect1 = new CornerPathEffect(DensityUtils.dp2px(getContext(), BIG_CIRCLE_SHAKE_RADIUS));
PathEffect pathEffect2 = new DiscretePathEffect(DensityUtils.dp2px(getContext(), BIG_CIRCLE_SHAKE_RADIUS),
DensityUtils.dp2px(getContext(), BIG_CIRCLE_SHAKE_OFFSET));
PathEffect pathEffect = new ComposePathEffect(pathEffect1, pathEffect2);
bigCirclePaint.setPathEffect(pathEffect);
dottedCirclePaint = new Paint();
dottedCirclePaint.setStrokeWidth(DensityUtils.dp2px(context, DOTTED_CIRCLE_WIDTH));
dottedCirclePaint.setColor(ContextCompat.getColor(context, R.color.whiteTransparent));
dottedCirclePaint.setStyle(Paint.Style.STROKE);
float gagPx = DensityUtils.dp2px(context, DOTTED_CIRCLE_GAG);
dottedCirclePaint.setPathEffect(new DashPathEffect(new float[]{gagPx, gagPx}, 0));
dottedCirclePaint.setAntiAlias(true);
solidCirclePaint = new Paint();
solidCirclePaint.setStrokeWidth(DensityUtils.dp2px(context, SOLID_CIRCLE_WIDTH));
solidCirclePaint.setColor(ContextCompat.getColor(context, R.color.white));
solidCirclePaint.setStyle(Paint.Style.STROKE);
solidCirclePaint.setStrokeCap(Paint.Cap.ROUND);
solidCirclePaint.setAntiAlias(true);
dotPaint = new Paint();
dotPaint.setStrokeWidth(DensityUtils.dp2px(context, DOT_SIZE));
dotPaint.setStrokeCap(Paint.Cap.ROUND);
dotPaint.setColor(ContextCompat.getColor(context, R.color.white));
dotPaint.setAntiAlias(true);
backgroundBitmap = BitmapFactory.decodeResource(context.getResources(), R.mipmap.bg_step_law);
// 设置手表 icon 的大小
watchBitmap = BitmapFactory.decodeResource(context.getResources(), R.mipmap.icon_headview_watch);
float scale = DensityUtils.dp2px(context, WATCH_SIZE) / watchBitmap.getWidth();
Matrix matrix = new Matrix();
matrix.postScale(scale, scale);
watchBitmap = Bitmap.createBitmap(watchBitmap,
0, 0, watchBitmap.getWidth(), watchBitmap.getHeight(),
matrix, true);
watchOffset = DensityUtils.sp2px(context, WATCH_OFFSET_DP);
fireworksCircle = new FireworksCircleGraphics(context);
animationThread = new AnimationThread();
animationThread.start();
}
开发者ID:sickworm,项目名称:MISportsConnectWidget,代码行数:70,代码来源:MISportsConnectView.java
示例7: getCornerDashPathEffect
import android.graphics.ComposePathEffect; //导入依赖的package包/类
private PathEffect getCornerDashPathEffect(int strokeWidth) {
PathEffect dash = getDashPathEffect(strokeWidth);
PathEffect corner = new CornerPathEffect(strokeWidth);
return new ComposePathEffect(dash, corner);
}
开发者ID:chiuki,项目名称:android-graphics-demo,代码行数:6,代码来源:HollowTextActivity.java
注:本文中的android.graphics.ComposePathEffect类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论