I have created a CGBitmapContext of 256 x 256 and I have a CGImageRef that I want to draw into this context. My goal is to crop the image (and ultimately create tiles of an image), but if I use CGContextDrawImage, Core Graphics scales the image to fit the context.
So the question is, how do I make sure that only a portion of the CGImageRef is drawn into the CGBitmapContext (no scaling)?
CGContextDrawImage takes a CGRect parameter. It sounds like you are passing the bounds of your context. Instead, try passing the bounds of the image, offset appropriately to draw the desired part of it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With