Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIGraphicsBeginImageContext must be Retina-aware?

I've read some posts which recommend the use of:

UIGraphicsBeginImageContextWithOptions((image.size), NO, 0.0f) 

instead of:

UIGraphicsBeginImageContext(image.size).

Because the first one uses Retina-scale when drawing, otherwise you get blocky images.

I'm a little confused about when to use or not the retina-scale option.

If i have a photograph which is 1000x1000 px, and i call UIGraphicsBeginImageContext passing those dimensions, am i not specifying exactly how many points i want to draw? Is that ok?

Or should i call UIGraphicsBeginImageContextWithOptions passing half the dimensions (500x500px)? Does it make any difference?

like image 679
jvic Avatar asked Jul 22 '12 19:07

jvic


1 Answers

You can create the image context like this:

 UIGraphicsBeginImageContextWithOptions(size, false, UIScreen.main.scale)
like image 187
the Reverend Avatar answered Nov 10 '22 00:11

the Reverend