Introduction to Cocoa Drawing Guide
High-quality graphics are an important part of a well-designed application. In fact, high-quality graphics is one of the things that sets OS X apart from many other operating systems. While some operating systems rely on flat colors and rectangular objects, OS X uses color, transparency, and its advanced compositing system to give programs a more fluid and inviting appearance.
At a Glance
This document is intended for developers who are new to drawing custom content using Cocoa. More advanced Cocoa developers may also want to read this book for tips on how to perform specific tasks.
Before you begin reading this document, you should be familiar with the basic concepts of how to create a Cocoa application. This includes how to create new projects in Xcode, how to create a simple nib file, and how to manipulate Cocoa objects. You do not need any understanding of graphics programming in general, although such knowledge definitely helps.
This document assumes that you are familiar with the basic concepts for creating a Cocoa application. This book also assumes that you have a basic understanding of the Objective-C programming language.
This document has the following chapters:
Overview of Cocoa Drawing introduces drawing-related concepts and the Cocoa support for drawing.
Graphics Contexts describes the drawing environment and provides examples of how you configure the environment to suit your needs.
Coordinate Systems and Transforms describes the coordinate systems used for drawing and provides examples of how you manipulate your content using transforms.
Color and Transparency provides basic information about color and shows you how to use the color-related Cocoa objects.
Paths describes the basic drawing tools found in Cocoa and provides detailed information about how to create and manipulate everything from simple shapes to Bezier paths.
Images describes the image classes found in Cocoa and provides examples of how to create and manipulate images in your application.
Text provides an overview of text and its relationship to the Cocoa drawing environment.
Advanced Drawing Techniques demonstrates some advanced drawing-related techniques, including full-screen drawing, animation, gradients, and performance tuning.
Incorporating Other Drawing Technologies provides information and examples on how to integrate advanced technologies, such as Quartz, OpenGL, and QuickTime, into your Cocoa application.
Drawing is only one step in the process of creating a fully functional Cocoa view. Understanding view hierarchies and how events interact with views are two other critical steps. For information about these other subjects, consult the following documents:
View Programming Guide—for information about creating and managing views
Cocoa Event Handling Guide—for information about event handling
To ensure the drawing in your app looks great on a Retina display, consult this document:
Because Cocoa drawing is based on Quartz, many Quartz behaviors (though not all) are also relevant to Cocoa. This document describes the different behaviors provided by Cocoa, but for additional information about Quartz behavior, consult the following documents:
Quartz 2D Programming Guide—for conceptual information related to Quartz.