【发布时间】:2016-04-08 21:49:48
【问题描述】:
但是当我使用drawInRect API在上下文中绘制图片时,图片是这样的
矩形的大小就是图片的大小。图片是@1x和@2x。
区别很明显,图片模糊,图片右侧有一条灰线,我的imac是retina分辨率。
================================================ = 我找到原因了,
[self.headLeftImage drawInRect:NSMakeRect(100,
100,
self.headLeftImage.size.width,
self.headLeftImage.size.height)];
CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGContextSaveGState(context);
CGContextTranslateCTM(context, self.center.x , self.center.y);
[self.headLeftImage drawInRect:NSMakeRect(100,
100,
self.headLeftImage.size.width,
self.headLeftImage.size.height)];
CGContextRestoreGState(context);
【问题讨论】:
-
实际应用中图片的类型是什么?它是位图还是矢量格式?您为绘图调用提供了什么矩形?
-
我已经编辑了我的描述,谢谢。
-
@Ken 类型是png~
标签: macos nsimage drawinrect