Changes

Jump to: navigation, search

An iPhone Graphics Drawing Tutorial using Quartz 2D

No change in size, 20:10, 21 January 2011
no edit summary
</pre>
Using the color reference and the context we can now specifiy specify that the color is to be used when drawing the line:
<pre>
== Drawing a Rectangle ==
 
Rectangles are drawn in much the same way as any other path is drawn, with the exception that the path is defined by specifying the x and y co-ordinates of the top left hand corner of the rectangle together with the rectangle’s height and width. These dimensions are stored in a CGRect structure and passed through as an argument to the CGContextAddRect function:
== Drawing an Elipse Ellipse or Circle ==
Circles and elypses ellipses are drawn by defining the rectangular area into which the shape must fit and then calling the CGContextAddEllipseInRect() function:
<pre>
== Drawing an Arc ==
An arc may be drawn by specifiying specifying two tangent points and a radius using the CGContextAddArcToPoint() function:
<pre>
== Drawing an Image into a Graphics Context ==
An image may be drawn into a graphics context either by specifiying specifying the coordinates of the top left hand corner of the image (in which case the image will appear full size) or resized so that it fits into a specified rectangular area. Before we can display an image in our example application, however, that image must first be added to the project resources.
Begin by locating the desired image using the Finder and then drag and drop that image onto the ''Resources'' category of the ''Groups & Files'' panel of the Xcode main project window. Rename the image if necessary by slow double clicking on the file name so that it highlights and enters edit mode.

Navigation menu