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
Share this Page URL
Help

Chapter 2. Drawing > 2.12. Advanced Path Manipulation

2.12. Advanced Path Manipulation

To keep track of what they draw, many applications, such as drawing applications, computer-aided design systems, and games, maintain a list of display objects. Often, such applications let users edit their display objects; for example, CAD applications let users select, move, and resize elements of the design.

Users typically select display objects with either mouse clicks or finger touches. To facilitate selection, among other things, the Canvas API provides a pointInPath() method that returns true if a specified point lies within the current path. In this section, we make use of that method through an extension of the polygon application discussed in Section 2.11.1, “Polygon Objects,” on p. 147 that lets users drag polygons.


  

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