You want to scale shapes on your graphics context up and down dynamically.
Create an affine scale transformation using the
Recipe 20.11 explained what a transformation is and how to apply it to shapes and graphics contexts. One of the transformations that you can apply is scaling. You can easily ask Core Graphics to scale a shape, such as a circle, to 100 times its original size.
To create an affine scale transformation, use the
CGAffineTransformMakeScale function, which
returns a transformation object of type
CGAffineTransform. If you want to apply a scale transformation directly to a
graphics context, use the
CGContextScaleCTM procedure to scale the
current transformation matrix (CTM). For more information about CTM, see
Scale transformation functions take two parameters: one to scale the x-axis and the other to scale the y-axis. Take another look at the rectangle in Figure 20-22. If we want to scale this rectangle to half its normal length and width, shown in Figure 20-22, we can simply scale the x- and the y- axis by 0.5 (half their original value), as shown here:
/* Scale the rectangle to half its size */
/* Add the rectangle to the path */