I'm struggling to understand the process of drawing to SurfaceView
and therefore the whole Surface
/Canvas
/Bitmap
system, which is used in Android.
I've read all articles and API documentation pages, which I was able to find on android-developers site, a few tutorials of android graphics, LunarLander source code and this question.
Please tell me, which of these statements are true, which are not, and why.
Canvas
has its ownBitmap
attached to it.Surface
has its ownCanvas
attached to it.- All
View
's of window share the sameSurface
and thus share the sameCanvas
. SurfaceView
is subclass ofView
, which, unlike otherView
's subclasses andView
itself, has its ownSurface
to draw in.
There is also one additional question:
- Why is there a need for a
Surface
class, if there is already aCanvas
for high-level operations with bitmap. Give an example of a situation whereCanvas
is non-suitable for doing work whichSurface
can do.