iPhone: I'm trying to draw a blue line, but it turns out red all the time, why?
<p>Something with colorspace ? Note; if I draw on the current context directly it turns black; on an bitmap context it turns red.</p>

<p>Example:</p>

<pre><code>CGContextRef context;// = UIGraphicsGetCurrentContext(); 
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 
void *bitmapData = malloc(getWidth()*4*getHeight());
memset(bitmapData, 0, getWidth()*4*getHeight()); 
context = CGBitmapContextCreate (bitmapData, getWidth(), getHeight(), 8, 
        getWidth()*4, colorSpace, kCGImageAlphaPremultipliedFirst); 

CGContextSetStrokeColorWithColor(context, [blue CGColor]);
CGContextMoveToPoint(context, 0.0,0.0 ); 
CGContextAddLineToPoint(context, 480.0,300.0); 
CGContextStrokePath(context);

CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, bitmapData, getWidth()*4*getHeight(), NULL);
CGColorRenderingIntent intent = kCGRenderingIntentDefault;
CGImageRef image2 = CGImageCreate(getWidth(), getHeight(), 8, 32, getWidth()*4, colorSpace, bitmapInfo,
           provider, NULL, NO, intent); 

CGContextDrawImage(UIGraphicsGetCurrentContext(),rect, image2);
</code></pre>

<p>Edit (day later);
Ok, I restarted ( = made a new project in XCode, copy/pasted the code from this example) the entire project and then it is working. Anyone any idea how that is possible at all? </p>
