Code example for Path

Methods: isEmptymoveTorewind

0
displayMatrix.setRectToRect(r, displayBounds, Matrix.ScaleToFit.FILL);
    } 
 
    private void drawDoodle(Canvas canvas) {
        if ((canvas != null) && !normalizedPath.isEmpty()) {
            drawingPath.set(normalizedPath);
            drawingPath.transform(pathMatrix);
            canvas.drawPath(drawingPath, doodlePaint);
        } 
    } 
 
    public void setColor(int color) {
        // Reset path to draw in a new color. 
        finishCurrentPath(); 
        normalizedPath.moveTo(lastPoint.x, lastPoint.y);
        doodlePaint.setColor(Color.argb(192, Color.red(color), Color.green(color),
                Color.blue(color)));
    } 
 
    private void finishCurrentPath() { 
        if (!normalizedPath.isEmpty()) {
            // Update the finished path to the bitmap. 
            drawDoodle(bitmapCanvas);
            if (listener != null) {
                listener.onDoodleFinished(new Path(normalizedPath), doodlePaint.getColor());
            } 
            normalizedPath.rewind();
            invalidate(); 
        } 
    } 
 
    private void checkCurrentPathInBounds() {