微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.graphics.PathMeasure的实例源码

项目:GitHub    文件PathInterpolatorGingerbread.java   
public PathInterpolatorGingerbread(Path path) {
    final PathMeasure pathMeasure = new PathMeasure(path,false /* forceClosed */);

    final float pathLength = pathMeasure.getLength();
    final int numPoints = (int) (pathLength / PRECISION) + 1;

    mX = new float[numPoints];
    mY = new float[numPoints];

    final float[] position = new float[2];
    for (int i = 0; i < numPoints; ++i) {
        final float distance = (i * pathLength) / (numPoints - 1);
        pathMeasure.getPosTan(distance,position,null /* tangent */);

        mX[i] = position[0];
        mY[i] = position[1];
    }
}
项目:AndroidRelationshipView    文件RelationshipView.java   
@Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.translate(x,y);

        for (int i = 0; i < pathMeasures.size(); i++) {
            Path path1 = new Path();
            PathMeasure pathMeasure = pathMeasures.get(i);
            MyPath path = paths.get(i);
            if (!isReverse) {
                pathMeasure.getSegment(0,pathMeasure.getLength() * animatorValue,path1,true);
                canvas.drawPath(path1,linePaint);
            } else {
                pathMeasure.getSegment(0,pathMeasure.getLength() * (1 - animatorValue),linePaint);
            }
            drawCircles(radiusArray.get(i),canvas,path.endPoint,path.endDirection,i);
        }

        drawCenterCircle(canvas);
//        drawCircles(radiusArray.get(0),paths.get(0).endPoint,paths.get(0).endDirection);
    }
项目:GitHub    文件FreshDownloadView.java   
public FreshDownloadView(Context context,AttributeSet attrs,int defStyleAttr) {
    super(context,attrs,defStyleAttr);
    circular_edge = getResources().getDimension(R.dimen.edge);

    bounds = new Rect();
    mTempBounds = new RectF();
    publicPaint = new Paint();
    path1 = new Path();
    path2 = new Path();
    path3 = new Path();
    pathMeasure1 = new PathMeasure();
    pathMeasure2 = new PathMeasure();
    pathMeasure3 = new PathMeasure();
    textBounds = new Rect();

    parseAttrs(context.obtainStyledAttributes(attrs,R.styleable.FreshDownloadView));
    initPaint();
}
项目:miaosou    文件BounceBallView.java   
private void initData() {

        defaultPadding = 2 * radius + dp2px(2);
        defaultPaddingBottom = 2 * radius + dp2px(15);
        defaultWidth = (int) (2 * defaultPadding + dp2px(200));
        defaultHeight = (int) (defaultPadding + defaultPaddingBottom + dp2px(80));

        paint = new Paint[ballCount];
        for (int i = 0; i < paint.length; i++) {
            paint[i] = new Paint(Paint.ANTI_ALIAS_FLAG);
            paint[i].setColor(ballColor);
            paint[i].setStyle(Paint.Style.FILL);
        }

        path = new Path();
        pathMeasure = new PathMeasure();
        randomBallColors = new int[ballCount];
        randomradius = new float[ballCount];
        randomTransRatioX = new float[ballCount];
        randomTransRatioY = new float[ballCount];

        translateFraction = new float[ballCount];
        translateAnim = new ValueAnimator[ballCount];

    }
项目:YiZhi    文件HistoryChartView.java   
private void initRoomTempPath(float[] data) {
    mRoomTempPath.reset();
    // Path path = new Path();
    float pointX;
    float pointY;
    // 横向
    mRoomTempPath.moveto(Xpoint + xFirstPointOffset,getDataY(data[0],Ylabel));
    mRoomTempPath.moveto(Xpoint + xFirstPointOffset,Ylabel));
    for (int i = 0; i < Xlabel.length; i++) {
        float startX = Xpoint + i * Xscale + xFirstPointOffset;
        // 绘制数据连线
        if (i != 0) {
            pointX = Xpoint + (i - 1) * Xscale + xFirstPointOffset;
            pointY = getDataY(data[i - 1],Ylabel);
            mRoomTempPath.lineto(pointX,pointY);
        }
        if (i == Xlabel.length - 1) {
            pointX = startX;
            pointY = getDataY(data[i],pointY);
        }
    }
    mRoomTempPathMeasure = new PathMeasure(mRoomTempPath,false);
}
项目:YiZhi    文件HistoryChartView.java   
/**
 * 获取target temp绘线Path数据
 *
 * @param data target temp绘线Path数据
 */
private void initTargetTempPath(float[] data) {
    mTargetTempPath.reset();
    float pointX;
    float pointY;
    // 横向
    mTargetTempPath.moveto(Xpoint + xFirstPointOffset,Ylabel);
            mTargetTempPath.lineto(pointX,pointY);
        }
    }
    mTargetTempPathMeasure = new PathMeasure(mTargetTempPath,false);
}
项目:Mire    文件PathBitmapMesh.java   
public void matchVertsToPath(Path path,float bottomCoord,float extraOffset) {
    PathMeasure pm = new PathMeasure(path,false);

    for (int i = 0; i < staticVerts.length / 2; i++) {

        float yIndexValue = staticVerts[i * 2 + 1];
        float xIndexValue = staticVerts[i * 2];


        float percentOffsetX = (0.000001f + xIndexValue) / bitmap.getWidth();
        float percentOffsetX2 = (0.000001f + xIndexValue) / (bitmap.getWidth() + extraOffset);
        percentOffsetX2 += pathOffsetPercent;
        pm.getPosTan(pm.getLength() * (1f - percentOffsetX),coords,null);
        pm.getPosTan(pm.getLength() * (1f - percentOffsetX2),coords2,null);

        if (yIndexValue == 0) {
            setXY(drawingVerts,i,coords[0],coords2[1]);
        } else {
            float desiredYCoord = bottomCoord;
            setXY(drawingVerts,desiredYCoord);

        }
    }
}
项目:Depth    文件PathBitmapMesh.java   
public void matchVertsToPath(Path path,desiredYCoord);

        }
    }
}
项目:Depth    文件Foam.java   
public void matchVertsToPath(Path path,false);
    int index = 0;
    for (int i = 0; i < staticVerts.length / 2; i++) {

        float yIndexValue = staticVerts[i * 2 + 1];
        float xIndexValue = staticVerts[i * 2];


        float percentOffsetX = (0.000001f + xIndexValue) / bitmap.getWidth();
        float percentOffsetX2 = (0.000001f + xIndexValue) / (bitmap.getWidth() + extraOffset);
        percentOffsetX2 += pathOffsetPercent;
        pm.getPosTan(pm.getLength() * (1f - percentOffsetX),coords2[1] + verticalOffset);
        } else {
            float desiredYCoord = Math.max(coords2[1],coords2[1] + easedFoamCoords[Math.min(easedFoamCoords.length - 1,index)]);
            setXY(drawingVerts,desiredYCoord + verticalOffset);

            index += 1;

        }
    }
}
项目:atlas    文件PathKeyframeAnimation.java   
@Override public PointF getValue(Keyframe<PointF> keyframe,float keyframeProgress) {
  PathKeyframe pathKeyframe = (PathKeyframe) keyframe;
  Path path = pathKeyframe.getPath();
  if (path == null) {
    return keyframe.startValue;
  }

  if (pathMeasureKeyframe != pathKeyframe) {
    pathMeasure = new PathMeasure(path,false);
    pathMeasureKeyframe = pathKeyframe;
  }

  pathMeasure.getPosTan(keyframeProgress * pathMeasure.getLength(),pos,null);
  point.set(pos[0],pos[1]);
  return point;
}
项目:FakeWeather    文件SunnyType.java   
public SunnyType(Context context,ShortWeatherInfo info) {
    super(context);
    mPathFront = new Path();
    mPathRear = new Path();
    sunPath = new Path();
    mPaint = new Paint();
    pos = new float[2];
    tan = new float[2];
    mMatrix = new Matrix();
    measure = new PathMeasure();
    sunMeasure = new PathMeasure();
    currentSunPosition = TimeUtils.getTimeDiffPercent(info.getSunrise(),info.getSunset());
    currentMoonPosition = TimeUtils.getTimeDiffPercent(info.getMoonrise(),info.getMoonset());
    if (currentSunPosition >= 0 && currentSunPosition <= 1) {
        setColor(colorDay);
        boat = BitmapFactory.decodeResource(getContext().getResources(),R.drawable.ic_boat_day);
    } else {
        setColor(colorNight);
        boat = BitmapFactory.decodeResource(getContext().getResources(),R.drawable.ic_boat_night);
    }

    cloud = BitmapFactory.decodeResource(getContext().getResources(),R.drawable.ic_cloud);

}
项目:FakeWeather    文件RainType.java   
public RainType(Context context,@RainLevel int rainLevel,@WindLevel int windLevel) {
    super(context);
    setColor(0xFF6188DA);
    this.rainLevel = rainLevel;
    this.windLevel = windLevel;
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(Color.WHITE);
    mPaint.setstrokeWidth(5);
    mPaint.setStyle(Paint.Style.stroke);
    mRains = new ArrayList<>();
    mSNows = new ArrayList<>();
    matrix = new Matrix();
    bitmap = BitmapFactory.decodeResource(context.getResources(),R.drawable.ic_rain_ground);
    mdstFlash1 = new Path();
    flashPathMeasure1 = new PathMeasure();

    mdstFlash2 = new Path();
    flashPathMeasure2 = new PathMeasure();

    mdstFlash3 = new Path();
    flashPathMeasure3 = new PathMeasure();
}
项目:PopupCircleMenu    文件PopupLayer.java   
/**
 * 用来给每一个button设置一个中心点
 *
 * @param orbit 一个特定角度的path
 */
private void setPos(Path orbit) {
    PathMeasure measure = new PathMeasure(orbit,false);
    TextLableView tv;
    for (int i = 0; i < mButtons.size(); i++) {
        PopupButton pp = mButtons.get(i);
        tv = kvs.get(pp);
        float[] coords = new float[]{0f,0f};
        int length = (int) ((i) * measure.getLength() / mButtons.size());
        measure.getPosTan(length,null);
        int px = (int) coords[0] - pp.getMeasuredWidth() / 2;
        int py = (int) coords[1] - pp.getMeasuredHeight() / 2;
        int tvx = (int) coords[0] - tv.getMeasuredWidth() / 2;
        tv.x = tvx;
        tv.y = py - 60;
        pp.x = px;
        pp.y = py;
    }
}
项目:AndroidAnimationTools    文件PathInterpolatorDonut.java   
public PathInterpolatorDonut(Path path) {
    final PathMeasure pathMeasure = new PathMeasure(path,null /* tangent */);

        mX[i] = position[0];
        mY[i] = position[1];
    }
}
项目:EasyChart    文件EasyGraphHistogram.java   
private void init() {
    borderPaint = new Paint();
    borderPaint.setColor(borderColor);
    borderPaint.setStyle(Paint.Style.stroke);
    borderPaint.setstrokeWidth(borderWidth);
    rectPaint = new Paint();
    rectPaint.setColor(rectColor);
    rectPaint.setStyle(Paint.Style.FILL);
    linePaint = new Paint();
    linePaint.setAntiAlias(true);
    linePaint.setColor(lineColor);
    linePaint.setStyle(Paint.Style.stroke);
    linePaint.setstrokeWidth(linewidth);
    linePaint.setstrokeJoin(Paint.Join.ROUND);
    textPaint = new TextPaint();
    textPaint.setAntiAlias(true);
    textPaint.setColor(textColor);
    textPaint.setTextSize(textSize);
    fm = textPaint.getFontMetrics();
    path = new Path();
    pathDst = new Path();
    pm = new PathMeasure();
    selectedindex = -1;
}
项目:EasyChart    文件EasyGraphLine.java   
private void init(int selectedBgColor,float pointstrokeWidth,int pathColor,float pathWidth) {
    pointPaint = new Paint();
    pointPaint.setAntiAlias(true);
    pointPaint.setColor(pointColor);
    pointPaint.setstrokeWidth(pointstrokeWidth);
    pointPaint.setStyle(Paint.Style.stroke);
    pathPaint = new Paint();
    pathPaint.setAntiAlias(true);
    pathPaint.setColor(pathColor);
    pathPaint.setstrokeWidth(pathWidth);
    pathPaint.setStyle(Paint.Style.stroke);
    selectedBgPaint = new Paint();
    selectedBgPaint.setAntiAlias(true);
    selectedBgPaint.setColor(selectedBgColor);
    selectedBgPaint.setstrokeWidth(0);
    selectedBgPaint.setStyle(Paint.Style.FILL);
    selectedBgPaint.setAlpha(100);
    path = new Path();
    pathDst = new Path();
    pm = new PathMeasure();
    rectoval = new RectF();
    selectedindex = -1;
}
项目:DailyStudy    文件Win8Search.java   
private void init() {
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.stroke); // 设置为空心
    mPaint.setstrokeWidth(15); // 宽度
    mPaint.setColor(Color.RED); // 颜色
    mPaint.setstrokeCap(Paint.Cap.ROUND); // 设置画笔为园笔
    mPaint.setAntiAlias(true); // 抗锯齿
    mPath = new Path(); // 路径
    RectF rect = new RectF(-100,-100,100,100); // 测定圆弧的范围
    mPath.addArc(rect,-90,359.9f); // 设置路径范围,起始角度,终止角度
    mPathMeasure = new PathMeasure(mPath,false); // 初始化要截取的路径

    valueAnimator = ValueAnimator.ofFloat(0f,1f).setDuration(2500);
    valueAnimator.setRepeatCount(ValueAnimator.INFINITE); // 设置动画播放模式
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            animationValue = (float) animation.getAnimatedValue();
            invalidate();
        }
    });
    valueAnimator.start();
}
项目:android-dialer    文件PathInterpolatorCompat.java   
public PathInterpolatorBase(Path path) {
  final PathMeasure pathMeasure = new PathMeasure(path,false /* forceClosed */);

  final float pathLength = pathMeasure.getLength();
  final int numPoints = (int) (pathLength / PRECISION) + 1;

  mX = new float[numPoints];
  mY = new float[numPoints];

  final float[] position = new float[2];
  for (int i = 0; i < numPoints; ++i) {
    final float distance = (i * pathLength) / (numPoints - 1);
    pathMeasure.getPosTan(distance,null /* tangent */);

    mX[i] = position[0];
    mY[i] = position[1];
  }
}
项目:SmartRefreshLayout    文件PathInterpolatorGingerbread.java   
public PathInterpolatorGingerbread(Path path) {
    final PathMeasure pathMeasure = new PathMeasure(path,null /* tangent */);

        mX[i] = position[0];
        mY[i] = position[1];
    }
}
项目:floatingMenu    文件FloatingMenuButton.java   
private Point calculateItemPositions(Integer startAngle,Integer endAngle) {
    final Point center = getActionViewCenter();
    RectF area = new RectF(center.x - radius,center.y - radius,center.x + radius,center.y + radius);
    Path orbit = new Path();
    orbit.addArc(area,startAngle,endAngle - startAngle);
    PathMeasure measure = new PathMeasure(orbit,false);
    // Prevent overlapping when it is a full circle
    int divisor;
    if (Math.abs(endAngle - startAngle) >= 360 || subMenuButtons.size() <= 1) {
        divisor = subMenuButtons.size();
    } else {
        divisor = subMenuButtons.size() - 1;
    }
    // Measure the path in order to find points that have the same distance between each other
    for (int i = 0; i < subMenuButtons.size(); i++) {
        SubButton currentSubButton = subMenuButtons.get(i);
        float[] coordinates = new float[]{0f,0f};
        int factor = animationType == AnimationType.RADIAL ? 0 : i;
        measure.getPosTan(factor * measure.getLength() / divisor,coordinates,null);
        currentSubButton.setX((int) coordinates[0] - currentSubButton.getWidth() / 2);
        currentSubButton.setY((int) coordinates[1] - currentSubButton.getHeight() / 2);
    }
    return center;
}
项目:TagViewGroup    文件TagViewGroup.java   
public TagViewGroup(Context context,defStyleAttr);
    Resources.Theme theme = context.getTheme();
    TypedArray array = theme.obtainStyledAttributes(attrs,R.styleable.TagViewGroup,defStyleAttr,0);
    mRadius = array.getDimensionPixelSize(R.styleable.TagViewGroup_radius,DipConvertUtils.dip2px(context,DEFAULT_RADIUS));
    mInnerRadius = array.getDimensionPixelSize(R.styleable.TagViewGroup_inner_radius,DEFAULT_INNER_RADIUS));
    mtdistance = array.getDimensionPixelSize(R.styleable.TagViewGroup_tilt_distance,DEFAULT_TILT_disTANCE));
    mVdistance = array.getDimensionPixelSize(R.styleable.TagViewGroup_v_distance,DEFAULT_V_disTANCE));
    mLinesWidth = array.getDimensionPixelSize(R.styleable.TagViewGroup_line_width,DEFAULT_LInes_WIDTH));
    mRippleMaxRadius = array.getDimensionPixelSize(R.styleable.TagViewGroup_ripple_maxRadius,DEFAULT_RIPPLE_MAX_RADIUS));
    mRippleAlpha = array.getInteger(R.styleable.TagViewGroup_ripple_alpha,DEFULT_RIPPLE_ALPHA);
    mRippleMinRadius = mInnerRadius + (mRadius - mInnerRadius) / 2;
    array.recycle();
    mPaint = new Paint();
    mPath = new Path();
    mdstPath = new Path();
    mPathMeasure = new PathMeasure();
    mPaint.setAntiAlias(true);
    mGestureDetector = new GestureDetectorCompat(context,new TagOnGestureListener());
    mChildUsed = new int[4];
    mCenterRect = new RectF();
}
项目:TanTanPaneView    文件CircleMenu.java   
private void initTool() {
    oPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    oPaint.setStyle(Paint.Style.FILL_AND_stroke);

    cPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    cPaint.setStyle(Paint.Style.stroke);
    cPaint.setstrokeCap(Paint.Cap.ROUND);

    sPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    sPaint.setStyle(Paint.Style.FILL);

    path = new Path();
    dstPath = new Path();
    pathMeasure = new PathMeasure();

    for (int i = 0; i < menuRectFs.length; i++) {
        menuRectFs[i] = new RectF();
    }
}
项目:permissionsModule    文件PathInterpolatorDonut.java   
public PathInterpolatorDonut(Path path) {
    final PathMeasure pathMeasure = new PathMeasure(path,null /* tangent */);

        mX[i] = position[0];
        mY[i] = position[1];
    }
}
项目:HaiNaBaiChuan    文件PathBitmapMesh.java   
public void matchVertsToPath(Path path,desiredYCoord);

        }
    }
}
项目:AndroidAnimationExercise    文件AlipayFailureView.java   
private void reMeasure() {
    int mViewWidth = getWidth();
    int mViewHeight = getHeight();
    mCenterX = mViewWidth / 2;
    mCenterY = mViewHeight / 2;

    temp = mRadius / 2.0f * factor;
    Path path = new Path();
    path.moveto(mCenterX - temp,mCenterY - temp);
    path.lineto(mCenterX + temp,mCenterY + temp);
    pathLeftMeasure = new PathMeasure(path,false);

    path = new Path();
    path.moveto(mCenterX + temp,mCenterY - temp);
    path.lineto(mCenterX - temp,mCenterY + temp);
    pathRightMeasure = new PathMeasure(path,false);


}
项目:LeafChart    文件LeafLineRenderer.java   
/**
 * 画折线
 *
 * @param canvas
 */
public void drawLines(Canvas canvas,Line line) {
    if (line != null && isShow) {
        linePaint.setColor(line.getLineColor());
        linePaint.setstrokeWidth(LeafUtil.dp2px(mContext,line.getlinewidth()));
        linePaint.setStyle(Paint.Style.stroke);
        List<PointValue> values = line.getValues();
        Path path = line.getPath();
        int size = values.size();
        for (int i = 0; i < size; i++) {
            PointValue point = values.get(i);
            if (i == 0) path.moveto(point.getoriginX(),point.getoriginY());
            else path.lineto(point.getoriginX(),point.getoriginY());
        }

        measure = new PathMeasure(path,false);
        linePaint.setPathEffect(createPathEffect(measure.getLength(),phase,0.0f));
        canvas.drawPath(path,linePaint);

    }
}
项目:LeafChart    文件OutsideLineRenderer.java   
/**
 * 画折线
 *
 * @param canvas
 */
public void drawLines(Canvas canvas,Line line,Axis axisY,int moveX) {
    if(line != null && isShow){
        linePaint.setColor(line.getLineColor());
        linePaint.setstrokeWidth(LeafUtil.dp2px(mContext,line.getlinewidth()));
        linePaint.setStyle(Paint.Style.stroke);
        List<PointValue> values = line.getValues();
        Path path = line.getPath();
        int size = values.size();
        for (int i = 0; i < size; i++) {
            PointValue point = values.get(i);
            if(i == 0)  path.moveto(point.getoriginX() + moveX,point.getoriginY());
            else  path.lineto(point.getoriginX() + moveX,0.0f));
        canvas.save(Canvas.CLIP_SAVE_FLAG);
        canvas.clipRect(axisY.getStartX(),mWidth,mHeight);
        canvas.drawPath(path,linePaint);
        canvas.restore();
    }
}
项目:RxTools    文件PathInterpolatorDonut.java   
public PathInterpolatorDonut(Path path) {
    final PathMeasure pathMeasure = new PathMeasure(path,null /* tangent */);

        mX[i] = position[0];
        mY[i] = position[1];
    }
}
项目:Learn    文件SearchView.java   
/**
 * 初始化 Path
 */
private void initPath() {
    mSearchPath = new Path();
    mCirclePath = new Path();
    mMeasure = new PathMeasure();

    RectF oval1 = new RectF(-50,-50,50,50);
    mSearchPath.addArc(oval1,45,359.9f); // 放大镜的圆框

    RectF oval2 = new RectF(-100,100);
    mCirclePath.addArc(oval2,359.9f); // 搜索的圆圈

    float[] pos = new float[2];
    mMeasure.setPath(mCirclePath,false);
    mMeasure.getPosTan(0,null); // 放大镜手柄的末端

    mSearchPath.lineto(pos[0],pos[1]); // 放大镜的手柄
}
项目:lottie-android    文件PathKeyframeAnimation.java   
@Override public PointF getValue(Keyframe<PointF> keyframe,pos[1]);
  return point;
}
项目:Android-SpinKit    文件PathInterpolatorDonut.java   
public PathInterpolatorDonut(Path path) {
    final PathMeasure pathMeasure = new PathMeasure(path,null /* tangent */);

        mX[i] = position[0];
        mY[i] = position[1];
    }
}
项目:BaseLibrary    文件PathInterpolatorDonut.java   
public PathInterpolatorDonut(Path path) {
    final PathMeasure pathMeasure = new PathMeasure(path,null /* tangent */);

        mX[i] = position[0];
        mY[i] = position[1];
    }
}
项目:ShoppingApp    文件PathInterpolatorDonut.java   
public PathInterpolatorDonut(Path path) {
    final PathMeasure pathMeasure = new PathMeasure(path,null /* tangent */);

        mX[i] = position[0];
        mY[i] = position[1];
    }
}
项目:FreshDownloadView    文件FreshDownloadView.java   
public FreshDownloadView(Context context,R.styleable.FreshDownloadView));
    initPaint();
}
项目:DxLoadingButton    文件LoadingButton.java   
private void createSuccesspath(){

        if(mSuccesspath != null){
            mSuccesspath.reset();
        }else{
            mSuccesspath = new Path();
        }

        float mLineWith = 2*mDensity;

        float left = width/2 - mRadius + mRadius/3 + mLineWith;
        float top = mPadding + mRadius/2 + mLineWith;
        float right = width/2 + mRadius - mLineWith - mRadius/3;
        float bottom = (mLineWith + mRadius) * 1.5f + mPadding/2;
        float xPoint = width/2 - mRadius/6;

        mSuccesspath = new Path();
        mSuccesspath.moveto(left,mPadding+mRadius + mLineWith);
        mSuccesspath.lineto(xPoint,bottom);
        mSuccesspath.lineto(right,top);

        PathMeasure measure = new PathMeasure(mSuccesspath,false);
        mSuccesspathLength = measure.getLength();
        mSuccesspathIntervals = new float[]{mSuccesspathLength,mSuccesspathLength};
    }
项目:DxLoadingButton    文件LoadingButton.java   
private void createFailedPath(){

        if(mFailedPath != null){
            mFailedPath.reset();
            mFailedPath2.reset();
        }else{
            mFailedPath = new Path();
            mFailedPath2 = new Path();
        }

        float left = width/2 - mRadius + mRadius/2;
        float top = mRadius/2 + mPadding;

        mFailedPath.moveto(left,top);
        mFailedPath.lineto(left+mRadius,top+mRadius);

        mFailedPath2.moveto(width/2 + mRadius/2,top);
        mFailedPath2.lineto(width/2 - mRadius + mRadius/2,top+mRadius);

        PathMeasure measure = new PathMeasure(mFailedPath,false);
        mFailedPathLength = measure.getLength();
        mFailedPathIntervals = new float[]{mFailedPathLength,mFailedPathLength};

        PathEffect PathEffect = new DashPathEffect(mFailedPathIntervals,mFailedPathLength);
        mPathEffectPaint2.setPathEffect(PathEffect);
    }
项目:AndroidStudyDemo    文件FllowerAnimation.java   
private void init(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);

    width = wm.getDefaultdisplay().getWidth();
    height = (int) (wm.getDefaultdisplay().getHeight() * 3 / 2f);

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setstrokeWidth(2);
    mPaint.setColor(Color.BLUE);
    mPaint.setStyle(Paint.Style.stroke);

    pathMeasure = new PathMeasure();

    builderFollower(fllowerCount,fllowers1);
    builderFollower(fllowerCount,fllowers2);
    builderFollower(fllowerCount,fllowers3);
}
项目:CreditSesameRingView    文件NewCreditSesameView.java   
/**
 * 绘制外层圆环进度和小圆点
 */
private void drawRingProgress(Canvas canvas) {

  Path path = new Path();
  path.addArc(mMiddleProgressRect,mStartAngle,mCurrentAngle);
  PathMeasure pathMeasure = new PathMeasure(path,false);
  pathMeasure.getPosTan(pathMeasure.getLength() * 1,tan);
  matrix.reset();
  matrix.postTranslate(pos[0] - bitmap.getWidth() / 2,pos[1] - bitmap.getHeight() / 2);
  canvas.drawPath(path,marcProgresspaint);
  //起始角度不为0时候才进行绘制小圆点
  if (mCurrentAngle == 0) {
    return;
  }
  canvas.drawBitmap(bitmap,matrix,mBitmapPaint);
  mBitmapPaint.setColor(Color.WHITE);
  canvas.drawCircle(pos[0],pos[1],8,mBitmapPaint);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。