开发者

difference between CGContextDrawImage et UIImage drawInRect

开发者 https://www.devze.com 2022-12-19 22:48 出处:网络
I was wondering which method is the best when ther开发者_开发百科e is a need to scale images? Do you have benchmarks on this?

I was wondering which method is the best when ther开发者_开发百科e is a need to scale images? Do you have benchmarks on this?

Thanks in advance.

Regards,


Internally, -drawInRect: will rotate the image into the correct orientation according to the imageOrientation property, then flip the image upside down to convert UIKit coordinates into CoreGraphics coordinates.

Then it will call CGContextDrawImage.

In this sense, -drawInRect: is surely slower. But using CGContextDrawImage to target UIKit requires one to do the transformation hassles which may not worth for maintenance.

0

精彩评论

暂无评论...
验证码 换一张
取 消