Chapter 12. 2D and 3D drawing

 

In this chapter

  • Manipulating images on the fly
  • Working with 2D shapes
  • Creating 3D graphics and motion

Practice what you know, and it will help to make clear what now you do not know.

Rembrandt Van Rijn

So far, we’ve worked with many concepts relating to Android development. We’ve created UIs using the widgets and views that come with the framework, and we’ve put together applications using activities, services, and more. To create applications, such as games, that make extensive use of graphics, we’ll need full control over the screen to be able to create our visuals. This is where Android’s 2D and 3D libraries come into play.

The Android 2D library, which is based on the open source Skia library, is suitable for applications producing simple 2D visuals and a variety of effects. To go beyond simple, we can use the OpenGL ES library. OpenGL ES allows us to create complex 2D and 3D graphics, making full use of an underlying hardware accelerator (if present). In this chapter, we’ll use both of these libraries.

12.1. Drawing with the 2D libraries

12.2. 3D and OpenGL ES

12.3. Summary