【问题标题】:Alias + core graphics at retina display视网膜显示的别名 + 核心图形
【发布时间】: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


    【解决方案1】:

    让视网膜显示一个 SHARP CRISP 像素

    我要放弃

    CGContextMoveToPoint(context,10,0);
    CGContextAddLineToPoint(context, 266,256);
    

    相反,我需要使用循环沿线添加矩形(每个 1x1 大)

    它会在视网膜显示器和老一代 1x 显示器中产生 SHARP CRISP 像素

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-13
      • 1970-01-01
      • 2014-03-16
      相关资源
      最近更新 更多