I have an UIImage and a CGPoint which tells me in what direction I should move it to create another image. The backgrou
You can use CGImageCreateWithImageInRect(). You can get a CGImage
from a UIImage
with the property of the same name.
Basically what you end up doing is apply masks to the existing image to extract the portions you need. Like so -
myImageArea = CGRectMake(xOrigin, yOrigin, myWidth, myHeight);//newImage
mySubimage = CGImageCreateWithImageInRect(oldImage, myImageArea);
myRect = CGRectMake(0, 0, myWidth*2, myHeight*2);
CGContextDrawImage(context, myRect, mySubimage);
This post gives a good idea of how to use this property.