本文整理汇总了Java中android.graphics.Paint.setStrokeMiter方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.setStrokeMiter方法的具体用法?Java Paint.setStrokeMiter怎么用?Java Paint.setStrokeMiter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Paint
的用法示例。
在下文中一共展示了Paint.setStrokeMiter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupStrokePaint
import android.graphics.Paint; //导入方法依赖的package包/类
/**
* Sets up paint according to the props set on a shadow view. Returns {@code true}
* if the stroke should be drawn, {@code false} if not.
*/
protected boolean setupStrokePaint(Paint paint, float opacity, @Nullable RectF box) {
paint.reset();
if (TextUtils.isEmpty(mStrokeColor)) {
return false;
}
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeCap(mStrokeLinecap);
paint.setStrokeJoin(mStrokeLinejoin);
paint.setStrokeMiter(mStrokeMiterlimit * mScale);
paint.setStrokeWidth(mStrokeWidth * mScale);
setupPaint(paint, opacity, mStrokeColor, box);
if (mStrokeDasharray != null && mStrokeDasharray.length > 0) {
paint.setPathEffect(new DashPathEffect(mStrokeDasharray, mStrokeDashoffset));
}
return true;
}
示例2: setStroke
import android.graphics.Paint; //导入方法依赖的package包/类
private void setStroke(Cap cap, Join join, float miter, Style style, PathEffect pathEffect,
Paint paint) {
paint.setStrokeCap(cap);
paint.setStrokeJoin(join);
paint.setStrokeMiter(miter);
paint.setPathEffect(pathEffect);
paint.setStyle(style);
}
示例3: renderGo
import android.graphics.Paint; //导入方法依赖的package包/类
private void renderGo(Canvas canvas, ColorFilter filter, Paint paint, int i) {
if (i >= 0 && i <= 8) {
renderByProvince1(i);
} else if (i >= 9 && i <= 19) {
renderByProvince2(i);
} else if (i >= 20 && i <= 29) {
renderByProvince3(i);
} else if (i >= 29 && i <= 33) {
renderByProvince4(i);
}
mRenderPath.addPath(mPath, mFinalPathMatrix);
paint.setStrokeJoin(Paint.Join.MITER);
paint.setStrokeCap(Paint.Cap.BUTT);
paint.setStrokeMiter(4.0f);
paint.setColorFilter(filter);
canvas.drawPath(mRenderPath, paint);
// Region
mRegion = mRegionList.get(i);
mRegion.setPath(mRenderPath, mGlobalRegion);
mRegionList.set(i, mRegion);
mPath.reset();
mRenderPath.reset();
mFinalPathMatrix.setValues(
new float[]{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
);
mFinalPathMatrix.postScale(scaleX, scaleY);
}
示例4: drawPath
import android.graphics.Paint; //导入方法依赖的package包/类
private void drawPath(VGroup vGroup, VPath vPath, Canvas canvas, int w, int h, ColorFilter filter) {
float scaleX = ((float) w) / this.mViewportWidth;
float scaleY = ((float) h) / this.mViewportHeight;
float minScale = Math.min(scaleX, scaleY);
Matrix groupStackedMatrix = vGroup.mStackedMatrix;
this.mFinalPathMatrix.set(groupStackedMatrix);
this.mFinalPathMatrix.postScale(scaleX, scaleY);
float matrixScale = getMatrixScale(groupStackedMatrix);
if (matrixScale != 0.0f) {
vPath.toPath(this.mPath);
Path path = this.mPath;
this.mRenderPath.reset();
if (vPath.isClipPath()) {
this.mRenderPath.addPath(path, this.mFinalPathMatrix);
canvas.clipPath(this.mRenderPath, Op.REPLACE);
return;
}
VFullPath fullPath = (VFullPath) vPath;
if (!(fullPath.mTrimPathStart == 0.0f && fullPath.mTrimPathEnd == 1.0f)) {
float start = (fullPath.mTrimPathStart + fullPath.mTrimPathOffset) % 1.0f;
float end = (fullPath.mTrimPathEnd + fullPath.mTrimPathOffset) % 1.0f;
if (this.mPathMeasure == null) {
this.mPathMeasure = new PathMeasure();
}
this.mPathMeasure.setPath(this.mPath, false);
float len = this.mPathMeasure.getLength();
start *= len;
end *= len;
path.reset();
if (start > end) {
this.mPathMeasure.getSegment(start, len, path, true);
this.mPathMeasure.getSegment(0.0f, end, path, true);
} else {
this.mPathMeasure.getSegment(start, end, path, true);
}
path.rLineTo(0.0f, 0.0f);
}
this.mRenderPath.addPath(path, this.mFinalPathMatrix);
if (fullPath.mFillColor != 0) {
if (this.mFillPaint == null) {
this.mFillPaint = new Paint();
this.mFillPaint.setStyle(Style.FILL);
this.mFillPaint.setAntiAlias(true);
}
Paint fillPaint = this.mFillPaint;
fillPaint.setColor(VectorDrawableCompat.applyAlpha(fullPath.mFillColor, fullPath.mFillAlpha));
fillPaint.setColorFilter(filter);
canvas.drawPath(this.mRenderPath, fillPaint);
}
if (fullPath.mStrokeColor != 0) {
if (this.mStrokePaint == null) {
this.mStrokePaint = new Paint();
this.mStrokePaint.setStyle(Style.STROKE);
this.mStrokePaint.setAntiAlias(true);
}
Paint strokePaint = this.mStrokePaint;
if (fullPath.mStrokeLineJoin != null) {
strokePaint.setStrokeJoin(fullPath.mStrokeLineJoin);
}
if (fullPath.mStrokeLineCap != null) {
strokePaint.setStrokeCap(fullPath.mStrokeLineCap);
}
strokePaint.setStrokeMiter(fullPath.mStrokeMiterlimit);
strokePaint.setColor(VectorDrawableCompat.applyAlpha(fullPath.mStrokeColor, fullPath.mStrokeAlpha));
strokePaint.setColorFilter(filter);
strokePaint.setStrokeWidth(fullPath.mStrokeWidth * (minScale * matrixScale));
canvas.drawPath(this.mRenderPath, strokePaint);
}
}
}