what is the relation between Canvas and Bitmap?
Basically, the Canvas
is backed by a Bitmap
, so when you draw anything using the canvas, the canvas will draw into the Bitmap
it was created with. So, when you draw those two bitmaps using the canvas, it's going to composite the bitmaps together and the result will be stored in drawingBitmap
, as it's backing the canvas.
Anh's analogy is correct-ish, though probably confusing (and over-simplifying, which I'm also doing above) – as I mentioned in a comment, you can think of the Canvas
as the pen, the Paint
as a configuration of that pen (e.g., replaceable ink or something - whatever you can fit into the idea of a configurable pen), and the Bitmap
as the paper you draw onto. The analogy becomes confusing if you focus too much on the accepted meaning of the words.
Canvas
is the place or medium where perfroms/executes the operation of drawing, and Bitmap
is responsible for storing the pixel of the picture you draw.
Let's think canvas
as a pen, and drawingBitmap
as a paper. You use your pen to draw something on your paper, and you get what you draw.
Technically, you can construct Canvas
object from Bitmap
to draw others bitmaps on it.