Draw part of image in CGBitmapContext

I created CGBitmapContextfrom 256 x 256, and I have CGImageRefone that I want to use in this context. My goal is to crop the image (and end up creating fragments of the image), but if I use it CGContextDrawImage, Core Graphics scales the image to fit the context.

So, the question is how to make sure that CGBitmapContextonly part is embedded in (without scaling) CGImageRef?

+3
source share
1 answer

CGContextDrawImagetakes a parameter CGRect. It looks like you are going beyond your context. Instead, try to convey the borders of the image, move it accordingly to draw the desired part.

+4
source

Source: https://habr.com/ru/post/1768157/


All Articles