Code example for Path

Methods: isEmpty, drawPath

0
                                     Canvas.CLIP_TO_LAYER_SAVE_FLAG);
 
        // Do a default draw. 
        mDrawManager.defaultDraw(canvas);
 
        if (path != null && !path.isEmpty()) {
            // ICS added double-buffering, which made it easier for drawing the Path directly over the DST. 
            // In pre-ICS, drawPath() doesn't seem to use ARGB_8888 mode for performance, hence transparency is not preserved. 
            if (Build.VERSION.SDK_INT >= 14) {
                mPaint.setXfermode(mMode);
                canvas.drawPath(path, mPaint);
            } else { 
                // Allocate a bitmap and draw the masking/clipping path. 
                Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
                (new Canvas(bitmap)).drawPath(path, mPaint);
 
                mPaint.setXfermode(mMode);
                canvas.drawBitmap(bitmap, 0, 0, mPaint);
 
                mPaint.setXfermode(null);
            }