Click here for the new  weblog.

Daily (or better monthly) Snippet

With the new Retina Display MacBook Pro and all the Macs with such an awesome display coming in the future - working with pixel based graphics is outdated. Drawing colors and gradients isn’t much of a problem - but also boring and sometimes a view needs a pattern or some noise.

Adding a subtle noise can be done very easily with a CIFilter:

CIImage *noisePattern = nil;
CIFilter *randomGenerator = [CIFilter filterWithName:@"CIColorMonochrome"];
[randomGenerator setValue: [[CIFilter filterWithName:@"CIRandomGenerator"] valueForKey:@"outputImage"] forKey:@"inputImage"];
[randomGenerator setDefaults];
noisePattern = [randomGenerator valueForKey:@"outputImage"];
[noisePattern drawAtPoint:NSZeroPoint fromRect:self.bounds operation:NSCompositeSourceOver fraction:0.04];

  1. do-nothing reblogged this from moapp
  2. moapp posted this