title: Transparency in CGContext
body: <p>I'm trying to set a transparent background for a CGContext but keep getting :    </p>
  
  <pre><code>CGBitmapContextCreateImage: invalid context 0x0
  </code></pre>
  
  <p>Here's what I've got. If I switch kCGImageAlphaLast to kCGImageAlphaNoneSkipFirst it works but the alpha channel is completely ignored. I'm very new to this color &amp; context stuff - any ideas? </p>
  
  <pre><code>-(BOOL) initContext:(CGSize)size {
  int bitmapByteCount;
  int bitmapBytesPerRow;
  
  bitmapBytesPerRow = (size.width * 4);
  bitmapByteCount = (bitmapBytesPerRow * size.height);
  
  cacheBitmap = malloc( bitmapByteCount );
  if (cacheBitmap == NULL){
      return NO;
  }
  
  cacheContext = CGBitmapContextCreate (NULL, size.width, size.height, 8, bitmapBytesPerRow, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaLast);
  
  CGContextSetRGBFillColor(cacheContext, 1.0, 1.0, 1.0f, 0.5);
  CGContextFillRect(cacheContext, self.bounds);
  
  return YES;
  }
  </code></pre>