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

15. Graphics and Animations > 15.10. Displacing Shapes Drawn on Graphic Context...

15.10. Displacing Shapes Drawn on Graphic Contexts

Problem

You want to move everything that is drawn on a graphics context to a new location, without changing your drawing code—or you would simply like to displace your context’s contents with ease.

Solution

Use the CGAffineTransformMakeTranslation function to create an affine translation transformation.

Discussion

Recipe 15.7 mentioned transformations. These are exactly what the name suggests: changes to the way a graphic is displayed. Transformations in Core Graphics are objects that you apply to shapes before they get drawn. For instance, you can create a translation transformation. Translating what, you might be asking? A translation transformation is a mechanism by which you can displace a shape or a graphics context.


  

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
  • DownloadDownload
  • PrintPrint