title: Any way to disable CALayer's rasterizationScale interpolation / anti-aliasing in objective-c / iPhone / iOS SDK?
body: <p>I want to get rid of any interpolation/antialiasing/etc when setting <code>myLayer.rasterizationScale = 0.01</code> and <code>myLayer.shouldRasterize = YES;</code></p>
  
  <p>Example: <img src="https://i.stack.imgur.com/yHXns.png" alt="enter image description here"></p>
  
  <p>Here's the code I'm trying:
  <code><pre>
  - (void)drawRect:(CGRect)rect {
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CALayer *sourceLayer = self.delegate.sourceImageView.layer;
    sourceLayer.rasterizationScale = 0.01;
    sourceLayer.shouldRasterize = YES;
    [sourceLayer renderInContext:ctx];
    CGContextSetShouldAntialias(ctx, NO);
    CGContextSetAllowsAntialiasing(ctx, NO);
    CGContextSetInterpolationQuality(ctx, kCGInterpolationNone);
  }
  </pre></code></p>
  
  <p>The expected result is that the image would display as a chunky/pixelated bitmap.</p>
  
  <p>Any ideas? Thanks!</p>
  
  <p>Edit: added full drawRect code, also tried moving the Antialias functions immediately following the UIGraphicsGetCurrentContext line.</p>
  
  <p>Edit: Try #2 (fail!)</p>
  
  <pre><code>- (void)drawRect:(CGRect)rect
  {
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextSetShouldAntialias(ctx, NO);
    CGContextSetAllowsAntialiasing(ctx, NO);
    CGContextSetInterpolationQuality(ctx, kCGInterpolationNone);
    CALayer *layer = [CALayer layer];
    layer.contents = (id)[UIImage imageNamed:@"test.jpg"].CGImage;
    layer.frame = CGRectMake(0, 0, 320, 411);
    layer.rasterizationScale = 0.0001;
    layer.shouldRasterize = YES;
    layer.geometryFlipped = NO;
    layer.edgeAntialiasingMask = 0;
    layer.minificationFilter = kCAFilterNearest;
    [layer renderInContext:ctx];
  }
  </code></pre>