안드로이드 graphics는 custom 2D library와 고성능 3D를 위한 OpenGL ES1.0을 제공한다.
Consider your option
2D graphics를 그릴 때 다음 두 가지 중 하나를 사용하게 될 것이다.
1) Layout에서 View object로 graphic이나 animation을 그리는 경우.
- 동적인 변화가 필요없는 graphic, 그리고 성능에 민감한 게임이 아닌 경우에 적합하다.
- static graphic이나 미리정의된 animation을 출력할 경우에 사용할 수 있다.
2) Canvas에 직접 graphic을 그리는 경우
- 규칙적으로 re-draw가 필요한 경우에 적합
- UI Activity로서 동일한 Thread에서 layout에 custom View object를 생성 시 invalidate()를 호출하고 onDraw callback을 다루면 된다.
- 다른 Thread에서는 SurfaceView를 관리하고 thread의 성능 맞추어 빠르게 Canvas에 그린다.
Simple Graphics Inside a View
단순한 graphic(images, shapes, colors, pre-defined animation)을 그리는경우는 View 의 background에 그리거나 layout의 ImageView의 Content에 그린다.
Draw with a Canvas
특화된 drawing이나 graphic의 animation을 제어하는 application을 개발하려면, Canvas를 통해 drawing을 해야 한다.