Example usage for android.graphics Path rewind

List of usage examples for android.graphics Path rewind

Introduction

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

Prototype

public void rewind() 

Source Link

Document

Rewinds the path: clears any lines and curves from the path but keeps the internal data structure for faster reuse.

Usage

From source file:com.codename1.impl.android.AndroidImplementation.java

static Path cn1ShapeToAndroidPath(com.codename1.ui.geom.Shape shape, Path p) {
    //Path p = new Path();
    p.rewind();
    com.codename1.ui.geom.PathIterator it = shape.getPathIterator();
    //p.setWindingRule(it.getWindingRule() == com.codename1.ui.geom.PathIterator.WIND_EVEN_ODD ? GeneralPath.WIND_EVEN_ODD : GeneralPath.WIND_NON_ZERO);
    float[] buf = new float[6];
    while (!it.isDone()) {
        int type = it.currentSegment(buf);
        switch (type) {
        case com.codename1.ui.geom.PathIterator.SEG_MOVETO:
            p.moveTo(buf[0], buf[1]);//from   w  w w  . j ava  2s.c o m
            break;
        case com.codename1.ui.geom.PathIterator.SEG_LINETO:
            p.lineTo(buf[0], buf[1]);
            break;
        case com.codename1.ui.geom.PathIterator.SEG_QUADTO:
            p.quadTo(buf[0], buf[1], buf[2], buf[3]);
            break;
        case com.codename1.ui.geom.PathIterator.SEG_CUBICTO:
            p.cubicTo(buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
            break;
        case com.codename1.ui.geom.PathIterator.SEG_CLOSE:
            p.close();
            break;

        }
        it.next();
    }

    return p;
}