Example usage for android.graphics Path Path

List of usage examples for android.graphics Path Path

Introduction

In this page you can find the example usage for android.graphics Path Path.

Prototype

public Path() 

Source Link

Document

Create an empty path

Usage

From source file:com.luseen.spacenavigation.BezierView.java

public BezierView(Context context, int backgroundColor) {
    super(context);
    this.context = context;
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    path = new Path();
    paint.setColor(backgroundColor);//from   ww w . j  ava  2  s. c om
    paint.setStrokeWidth(0);
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL);
}

From source file:com.gosuncn.core.ui.widget.BezierView.java

public BezierView(Context context, AttributeSet attrs) {
    super(context, attrs);
    this.context = context;
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    path = new Path();
    paint.setColor(((ColorDrawable) getBackground()).getColor());
    paint.setStrokeWidth(0);//from   w  w  w  .  java 2 s.c  o  m
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL);
}

From source file:com.imczy.customactivitytransition.transition.ChangePosition.java

public ChangePosition() {
    // ? ???//  w  ww .j  a  va 2s. com
    setPathMotion(new PathMotion() {
        @Override
        public Path getPath(float startX, float startY, float endX, float endY) {
            Path path = new Path();
            path.moveTo(startX, startY);

            float controlPointX = (startX + endX) / 3;
            float controlPointY = (startY + endY) / 2;

            // ??, (controlPointX, controlPointY) 
            path.quadTo(controlPointX, controlPointY, endX, endY);
            return path;
        }
    });
}

From source file:com.facebook.keyframes.util.KFPathInterpolator.java

public KFPathInterpolator(float controlX1, float controlY1, float controlX2, float controlY2) {
    Path path = new Path();
    path.moveTo(0, 0);/*from ww w . ja va 2s.  c o  m*/
    path.cubicTo(controlX1, controlY1, controlX2, controlY2, 1f, 1f);
    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];
    }
}

From source file:com.imczy.customactivitytransition.transition.ShareElemReturnChangePosition.java

public ShareElemReturnChangePosition() {
    setPathMotion(new PathMotion() {
        @Override//from  ww  w  .j a  v  a2 s  . c  om
        public Path getPath(float startX, float startY, float endX, float endY) {
            Path path = new Path();
            path.moveTo(startX, startY);

            float controlPointX = (startX + endX) / 3;
            float controlPointY = (startY + endY) / 2;

            path.quadTo(controlPointX, controlPointY, endX, endY);
            return path;
        }
    });
}

From source file:andoridhost.imczy.com.activitymaterial.custom.ReturnChangePosition.java

public ReturnChangePosition() {
    setPathMotion(new PathMotion() {
        @Override/*from   w  ww  .j  a va2s  .  com*/
        public Path getPath(float startX, float startY, float endX, float endY) {
            Path path = new Path();
            path.moveTo(startX, startY);

            Log.d(TAG, "getPath() called with: " + "startX = [" + startX + "], startY = [" + startY
                    + "], endX = [" + endX + "], endY = [" + endY + "]");

            float controlPointX = (startX + endX) / 3;
            float controlPointY = (startY + endY) / 2;

            path.quadTo(controlPointX, controlPointY, endX, endY);
            return path;
        }
    });
}

From source file:andoridhost.imczy.com.activitymaterial.custom.ChangePosition.java

public ChangePosition() {
    setPathMotion(new PathMotion() {
        @Override/*from w  w w.  ja  v a 2 s.c  om*/
        public Path getPath(float startX, float startY, float endX, float endY) {
            Path path = new Path();
            path.moveTo(startX, startY);

            Log.d(TAG, "getPath() called with: " + "startX = [" + startX + "], startY = [" + startY
                    + "], endX = [" + endX + "], endY = [" + endY + "]");

            float controlPointX = (startX + endX) / 3;
            float controlPointY = (startY + endY) / 2;

            path.quadTo(controlPointX, controlPointY, endX, endY);
            return path;
        }
    });
}

From source file:net.yanzm.actionbarprogress.MaterialIndeterminateProgressDrawable.java

public MaterialIndeterminateProgressDrawable(int trackColor, int accentColor) {
    this.trackColor = trackColor;
    this.accentColor = accentColor;

    {/*from  w ww  . jav  a2  s  .  c om*/
        Path path = new Path();
        path.moveTo(0, 0);
        path.cubicTo(0.0375f, 0f, 0.128764607715f, 0.0895380946618f, 0.25f, 0.218553507947f);
        path.cubicTo(0.322410320025f, 0.295610602487f, 0.436666666667f, 0.417591408114f, 0.483333333333f,
                0.489826169306f);
        path.cubicTo(0.69f, 0.80972296795f, 0.793333333333f, 0.950016125212f, 1.0f, 1.0f);
        translateInterpolator2 = PathInterpolatorCompat.create(path);
    }
    {
        Path path = new Path();
        path.moveTo(0, 0);
        path.cubicTo(0.06834272400867f, 0.01992566661414f, 0.19220331656133f, 0.15855429260523f,
                0.33333333333333f, 0.34926160892842f);
        path.cubicTo(0.38410433133433f, 0.41477913453861f, 0.54945792615267f, 0.68136029463551f,
                0.66666666666667f, 0.68279962777002f);
        path.cubicTo(0.752586273196f, 0.68179620963216f, 0.737253971954f, 0.878896194318f, 1f, 1f);
        scaleInterpolator2 = PathInterpolatorCompat.create(path);
    }
    {
        Path path = new Path();
        path.moveTo(0, 0);
        path.lineTo(0.2f, 0f);
        path.cubicTo(0.3958333333336f, 0.0f, 0.474845090492f, 0.206797621729f, 0.5916666666664f,
                0.417082932942f);
        path.cubicTo(0.7151610251224f, 0.639379624869f, 0.81625f, 0.974556908664f, 1.0f, 1.0f);
        translateInterpolator1 = PathInterpolatorCompat.create(path);
    }
    {
        Path path = new Path();
        path.moveTo(0, 0);
        path.lineTo(0.3665f, 0f);
        path.cubicTo(0.47252618112021f, 0.062409910275f, 0.61541608570164f, 0.5f, 0.68325f, 0.5f);
        path.cubicTo(0.75475061236836f, 0.5f, 0.75725829093844f, 0.814510098964f, 1f, 1f);
        scaleInterpolator1 = PathInterpolatorCompat.create(path);
    }
}

From source file:com.jjoe64.graphview.series.TitleLineGraphSeries.java

public TitleLineGraphSeries(E[] data) {
    super(data);//  w w w  .j  av  a2s  .c  o  m

    paint = new Paint();
    paint.setStrokeCap(Paint.Cap.ROUND);
    paint.setStyle(Paint.Style.STROKE);

    paintTitle = new TextPaint();
    paintTitle.setTextAlign(Paint.Align.CENTER);

    paintBackground = new Paint();

    path = new Path();
    pathBackground = new Path();
}

From source file:com.grarak.kerneladiutor.views.XYGraph.java

public XYGraph(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mPaintLine = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintEdge = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintGraph = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintGraphStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPathGraph = new Path();

    mPaintEdge.setStyle(Paint.Style.STROKE);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.XYGraph, defStyleAttr, 0);

    int accentColor = ContextCompat.getColor(context, R.color.colorAccent);
    mPaintLine.setColor(a.getColor(R.styleable.XYGraph_linecolor, accentColor));
    mPaintEdge.setColor(a.getColor(R.styleable.XYGraph_edgecolor, accentColor));
    mPaintEdge.setStrokeWidth(a.getDimension(R.styleable.XYGraph_edgestrokewidth,
            getResources().getDimension(R.dimen.xygraph_edge_stroke_width)));

    int graphColor = a.getColor(R.styleable.XYGraph_graphcolor, accentColor);

    mPaintGraphStroke.setColor(graphColor);
    mPaintGraphStroke.setStyle(Paint.Style.STROKE);
    mPaintGraphStroke.setStrokeWidth(a.getDimension(R.styleable.XYGraph_graphstrokewidth,
            getResources().getDimension(R.dimen.xygraph_graph_stroke_width)));

    graphColor = Color.argb(120, Color.red(graphColor), Color.green(graphColor), Color.blue(graphColor));

    mPaintGraph.setColor(graphColor);//from w  ww. j  a v  a 2s. c  om
    mPaintGraph.setStyle(Paint.Style.FILL);
    mPathGraph.setFillType(Path.FillType.EVEN_ODD);

    mEdgeVisible = a.getBoolean(R.styleable.XYGraph_edgevisibile, true);

    a.recycle();
}