Core Graphics Flashcards
What is a graphics context (CGContextRef)?
An opaque data type that Quartz uses to draw images to screen, bitmap, PDF file, etc.
How ubiquitous is CGContextRef?
All objects in Quartz are drawn to, or contained by, a graphics context.
Think of a graphics context (CGContextRef) as a …..?
Drawing destination.
What is CGLayerRef?
An offscreen drawing destination associated with another graphics context.
What prefix is used for functions in the Core Graphics API?
CG for Core Graphics.
What is used for offscreen drawing?
CGLayerRef
What is the graphics state?
The graphics state contains parameters that would otherwise be taken as arguments to drawing routines.
Can graphics states be saved?
Yes. There is actually a stack of them.
My code specifies locations and sizes in which coordinate system
User-space
How is user space mapped to device space?
With a content transformation matrix, or CTM.
The content transformation matrix is what kind of matrix?
An Affine transform.
How is UIKit’s coordinate system different from Quartz’s?
In Quartz, the y-axis goes up, whereas in UIKit it grows down.
How is memory management done in Core Graphics?
With reference counting.
When do I own a reference to an object?
If I got it from a function with name beginning with Copy or Create.
How do I draw to the screen in an iOS application
With [UIView drawRect:]
In [UIView drawRect:] how do I get a graphics context?
By calling UIGraphicsGetCurrentContext()
In [UIView drawRect:] how are coordinate systems handled?
The UView modified the coordinate transformation matrix so as to flip the y-axis.
What is anti-aliasing?
Artificially correcting jagged edges in text glyphs and bitmaps.
Can anti-aliasing be turned on and off?
Yes, with CGContextSetShouldAntialias().