Code example for Canvas

Methods: drawBitmapdrawBitmapMeshdrawColortranslate

-1
 
        @Override 
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
 
            canvas.drawColor(0xffffffff);
            canvas.drawBitmap(mBitmap1, 0.0f, 0.0f, mBitmapPaint);
 
            Matrix matrix = new Matrix();
            matrix.setScale(2.0f, 2.0f);
            matrix.postTranslate(0.0f, mBitmap1.getHeight());
            canvas.drawBitmap(mBitmap1, matrix, mBitmapPaint);
 
            Rect src = new Rect(0, 0, mBitmap1.getWidth() / 2, mBitmap1.getHeight() / 2);
            Rect dst = new Rect(0, mBitmap1.getHeight() * 3, mBitmap1.getWidth(),
                    mBitmap1.getHeight() * 4);
            canvas.drawBitmap(mBitmap1, src, dst, mBitmapPaint);
 
            canvas.translate(0.0f, mBitmap1.getHeight() * 4);
            canvas.drawBitmapMesh(mBitmap1, 3, 3, mVertices, 0, null, 0, mBitmapPaint);
 
            invalidate();
        } 
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE