【发布时间】:2012-01-04 10:44:48
【问题描述】:
我想使用核心图形的别名绘制能力 具有放大功能 所以像素在 1600% 或更高时会非常清晰 在 ipad 1 中一切正常(没有视网膜显示)
当我在 iphone4S / 4 上运行相同的代码时,我看不到别名绘图处于打开状态
按照这篇文章CoreGraphics for retina display 的说明进行操作,但图像仍然不是“别名”
这是我的问题的屏幕截图 - http://farm8.staticflickr.com/7161/6634020573_19d8b3549f_o.jpg
这是我如何在下面进行屏幕截图 - (子类化 UIView 并将绘图代码放在 drawRect 中:)
- (void)drawRect:(CGRect)rect
{
//[self setNeedsDisplay];
// Drawing code
CGContextRef context = UIGraphicsGetCurrentContext();
//
CGContextSetLineWidth(context, 1.0);
CGColorSpaceRef cs=CGColorSpaceCreateDeviceRGB();
float cc[]={1.0,0.0,0.0,1.0};
CGContextSetStrokeColorWithColor(context,CGColorCreate(cs, cc));
CGContextSetShouldAntialias(context, FALSE);
CGContextSetAllowsAntialiasing(context, FALSE);
//
CGContextMoveToPoint(context,10,0);
CGContextAddLineToPoint(context, 266,256);
CGContextStrokePath(context);
CGContextSetShouldAntialias(context, TRUE);
CGContextSetAllowsAntialiasing(context, TRUE);
//
CGContextMoveToPoint(context,-10,0);
CGContextAddLineToPoint(context, 246,256);
CGContextStrokePath(context);
}
双击放大
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *t=[touches anyObject];
if([t tapCount]==2) {
paper *p=[paperStack objectAtIndex:0];
CGAffineTransform transform = p.transform;
p.transform = CGAffineTransformScale(transform, 16.0f, 16.0f);
}
}
任何帮助/提示将不胜感激, 提前谢谢你!
最好, 基达工作室
【问题讨论】:
标签: core-graphics zooming alias pixel retina-display