Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

12.3. Summary

Drawing in Android begins with 2D lines, arcs, rectangles, circles, points, and bitmaps. This is done using the Canvas class and its myriad draw methods. To use different colors, sizes, and effects the Canvas works in conjunction with the Paint class. In this chapter, we walked through several examples of working with 2D drawing in order to draw lines and shapes, combine drawing with text and images, and even draw an example custom view with special effects. You can see how these techniques can help you include many new elements in your applications. You’re only limited by what you’re willing to draw.

Canvas drawing can accomplish a lot, but it’s just the tip of floating triangular polyhedron, so to speak. Beyond Canvas lie 2D and 3D drawing with OpenGL ES. OpenGL ES is a rich and powerful drawing library that can take advantage of the GPU if present. In addition, if you want to step up to 3D, OpenGL is your ticket. The OpenGL ES library allows you to draw and animate shapes, and more. Here we started simple and built a 2D triangle. Then we went 3D and created a spinning pyramid, and we added colors and textures. Combining what we’ve seen here with our earlier discussions of working with activities, widgets, views, services, and more, you can see how the possibilities are almost unlimited.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint