下面列出了android.graphics.Paint#Join ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private Paint.Join getStrokeLineJoin(int id, Paint.Join defValue) {
switch (id) {
case LINEJOIN_MITER:
return Paint.Join.MITER;
case LINEJOIN_ROUND:
return Paint.Join.ROUND;
case LINEJOIN_BEVEL:
return Paint.Join.BEVEL;
default:
return defValue;
}
}
public Paint.Join paintLineJoin()
{
if (lineJoin == kCALineJoinMiter)
return Paint.Join.MITER;
if (lineJoin == kCALineJoinRound)
return Paint.Join.ROUND;
return Paint.Join.BEVEL;
}
private LineMorphingDrawable(State[] states, int curState, int paddingLeft, int paddingTop, int paddingRight, int paddingBottom, int animDuration, Interpolator interpolator, int strokeSize, int strokeColor, Paint.Cap strokeCap, Paint.Join strokeJoin, boolean clockwise, boolean isRtl){
mStates = states;
mPaddingLeft = paddingLeft;
mPaddingTop = paddingTop;
mPaddingRight = paddingRight;
mPaddingBottom = paddingBottom;
mAnimDuration = animDuration;
mInterpolator = interpolator;
mStrokeSize = strokeSize;
mStrokeColor = strokeColor;
mStrokeCap = strokeCap;
mStrokeJoin = strokeJoin;
mClockwise = clockwise;
mIsRtl = isRtl;
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeCap(mStrokeCap);
mPaint.setStrokeJoin(mStrokeJoin);
mPaint.setColor(mStrokeColor);
mPaint.setStrokeWidth(mStrokeSize);
mDrawBound = new RectF();
mPath = new Path();
switchLineState(curState, false);
}
private Paint.Join getStrokeLineJoin(int id, Paint.Join defValue) {
switch (id) {
case LINEJOIN_MITER:
return Paint.Join.MITER;
case LINEJOIN_ROUND:
return Paint.Join.ROUND;
case LINEJOIN_BEVEL:
return Paint.Join.BEVEL;
default:
return defValue;
}
}
public Paint.Join toPaintJoin() {
switch (this) {
case BEVEL:
return Paint.Join.BEVEL;
case MITER:
return Paint.Join.MITER;
case ROUND:
return Paint.Join.ROUND;
}
return null;
}
private Paint.Join convertStrokeJoin(int join){
switch ( join ){
case Stroke.JOIN_BEVEL:
return Paint.Join.BEVEL;
case Stroke.JOIN_MITER:
return Paint.Join.MITER;
case Stroke.JOIN_ROUND:
return Paint.Join.ROUND;
default:
return Paint.Join.BEVEL;
}
}
RichShape(final int zIndex,
final List<RichPoint> points,
final int strokeWidth,
final Paint.Cap strokeCap,
final Paint.Join strokeJoin,
final PathEffect pathEffect,
final MaskFilter maskFilter,
final Shader strokeShader,
final boolean linearGradient,
final Integer strokeColor,
final boolean antialias,
final boolean closed) {
this.zIndex = zIndex;
this.strokeWidth = strokeWidth;
this.strokeCap = strokeCap;
this.strokeJoin = strokeJoin;
this.pathEffect = pathEffect;
this.maskFilter = maskFilter;
this.strokeShader = strokeShader;
this.linearGradient = linearGradient;
this.strokeColor = strokeColor;
this.antialias = antialias;
this.closed = closed;
if (points != null) {
for (RichPoint point : points) {
add(point);
}
}
}
RichPolyline(final int zIndex,
final List<RichPoint> points,
final int strokeWidth,
final Paint.Cap strokeCap,
final Paint.Join strokeJoin,
final PathEffect pathEffect,
final MaskFilter maskFilter,
final Shader strokeShader,
final boolean linearGradient,
final Integer strokeColor,
final boolean antialias,
final boolean closed) {
super(zIndex, points, strokeWidth, strokeCap, strokeJoin, pathEffect, maskFilter,
strokeShader, linearGradient, strokeColor, antialias, closed);
}
private Paint.Join getStrokeLineJoin(int id, Paint.Join defValue) {
switch (id) {
case LINEJOIN_MITER:
return Paint.Join.MITER;
case LINEJOIN_ROUND:
return Paint.Join.ROUND;
case LINEJOIN_BEVEL:
return Paint.Join.BEVEL;
default:
return defValue;
}
}
private Paint.Join getStrokeLineJoin(int id, Paint.Join defValue) {
switch (id) {
case LINEJOIN_MITER:
return Paint.Join.MITER;
case LINEJOIN_ROUND:
return Paint.Join.ROUND;
case LINEJOIN_BEVEL:
return Paint.Join.BEVEL;
default:
return defValue;
}
}
/**
* This will get the line join style.
*
* @return null or the LJ value in the dictionary.
*/
public Paint.Join getLineJoinStyle()
{
switch(dict.getInt( COSName.LJ )) {
case 0:
return Paint.Join.MITER;
case 1:
return Paint.Join.ROUND;
case 2:
return Paint.Join.BEVEL;
default:
return null;
}
}
private LineMorphingDrawable(State[] states, int curState, int width, int height, int paddingLeft, int paddingTop, int paddingRight, int paddingBottom, int animDuration, Interpolator interpolator, int strokeSize, int strokeColor, Paint.Cap strokeCap, Paint.Join strokeJoin, boolean clockwise, boolean isRtl){
mStates = states;
mWidth = width;
mHeight = height;
mPaddingLeft = paddingLeft;
mPaddingTop = paddingTop;
mPaddingRight = paddingRight;
mPaddingBottom = paddingBottom;
mAnimDuration = animDuration;
mInterpolator = interpolator;
mStrokeSize = strokeSize;
mStrokeColor = strokeColor;
mStrokeCap = strokeCap;
mStrokeJoin = strokeJoin;
mClockwise = clockwise;
mIsRtl = isRtl;
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeCap(mStrokeCap);
mPaint.setStrokeJoin(mStrokeJoin);
mPaint.setColor(mStrokeColor);
mPaint.setStrokeWidth(mStrokeSize);
mDrawBound = new RectF();
mPath = new Path();
switchLineState(curState, false);
}
/**
* Set the paint's Join.
*
* @param join set the paint's Join, used whenever the paint's style is
* Stroke or StrokeAndFill.
*/
public void setStrokeJoin(Paint.Join join) {
if (mPaint.getStrokeJoin() == join)
return;
mPaint.setStrokeJoin(join);
invalidateSelf();
}
/**
* Set the paint's Join.
*
* @param join set the paint's Join, used whenever the paint's style is
* Stroke or StrokeAndFill.
*/
public void setStrokeJoin(Paint.Join join) {
if (mPaint.getStrokeJoin() == join)
return;
mPaint.setStrokeJoin(join);
if (mProvider != null)
invalidateSelf();
}
private int convertStrokeJoin(Paint.Join join){
if ( Paint.Join.BEVEL.equals(join)){
return Stroke.JOIN_BEVEL;
} else if ( Paint.Join.MITER.equals(join)){
return Stroke.JOIN_MITER;
} else if ( Paint.Join.ROUND.equals(join)){
return Stroke.JOIN_ROUND;
} else {
return Stroke.JOIN_BEVEL;
}
}
public Builder strokeJoin(Paint.Join join){
mStrokeJoin = join;
return this;
}
BaseStrokeContent(final LottieDrawable lottieDrawable, BaseLayer layer, Paint.Cap cap,
Paint.Join join, float miterLimit, AnimatableIntegerValue opacity, AnimatableFloatValue width,
List<AnimatableFloatValue> dashPattern, AnimatableFloatValue offset) {
this.lottieDrawable = lottieDrawable;
this.layer = layer;
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeCap(cap);
paint.setStrokeJoin(join);
paint.setStrokeMiter(miterLimit);
opacityAnimation = opacity.createAnimation();
widthAnimation = width.createAnimation();
if (offset == null) {
dashPatternOffsetAnimation = null;
} else {
dashPatternOffsetAnimation = offset.createAnimation();
}
dashPatternAnimations = new ArrayList<>(dashPattern.size());
dashPatternValues = new float[dashPattern.size()];
for (int i = 0; i < dashPattern.size(); i++) {
dashPatternAnimations.add(dashPattern.get(i).createAnimation());
}
layer.addAnimation(opacityAnimation);
layer.addAnimation(widthAnimation);
for (int i = 0; i < dashPatternAnimations.size(); i++) {
layer.addAnimation(dashPatternAnimations.get(i));
}
if (dashPatternOffsetAnimation != null) {
layer.addAnimation(dashPatternOffsetAnimation);
}
opacityAnimation.addUpdateListener(this);
widthAnimation.addUpdateListener(this);
for (int i = 0; i < dashPattern.size(); i++) {
dashPatternAnimations.get(i).addUpdateListener(this);
}
if (dashPatternOffsetAnimation != null) {
dashPatternOffsetAnimation.addUpdateListener(this);
}
}
/**
* Get the value of the line join.
*
* @return The current line join value.
*/
public Paint.Join getLineJoin()
{
return lineJoin;
}
/**
* Return the paint's stroke join type.
*
* @return the paint's Join.
*/
public Paint.Join getStrokeJoin() {
return mPaint.getStrokeJoin();
}
/**
* Return the paint's stroke join type.
*
* @return the paint's Join.
*/
public Paint.Join getStrokeJoin() {
return mPaint.getStrokeJoin();
}