In the Canvas class document :
In the Canvas class, “drawing” calls are performed. To draw something, you need 4 main components: a bitmap for pixels, a canvas for placing anyone’s calls (writing to a bitmap), (for example, Rect, Path, text, bitmap) and paint (to describe the colors and styles for drawing).
So, you need 4 components to draw something.
- Raster
- Canvas
- Drawable
- Paint
Suppose you want to draw a circle on a background image from your available folder.
Canvas canvas; Bitmap mBG; Paint mPaint = new mPaint(); mBG = BitmapFactory.decodeResource(res, R.drawable.apple);
source share