iPhone: I'm trying to draw a blue line, but it turns out red all the time, why? -
Is there anything with colors? pay attention; If I draw the current reference directly, it becomes black; On the bitmap context it becomes red.
Example:
CGContextRef Reference; // = UIGraphicsGetCurrentContext (); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB (); Zero * bitmapdata = getWidth () * 4 * getHeight ()); MEMSAT (Bitmapdata, 0, MidWidth (* * 4 * getHeight ()); Reference = CGBitmapContextCreate (Bitmapdata, getWidth (), getHeight (), 8, getWidth () * 4, Color Sparse, KCGImage AlpPMultPladeFast); CGContextSetStrokeColorWithColor (Reference, [blue CGColor]); CGContextMoveToPoint (Reference, 0.0.0.0); CGContextAddLineToPoint (Reference, 480.0.300.0); CGContextStrokePath (reference); CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault; CGDataProviderRef Provider = CGDataProviderCreateWithData (NULL, Bitmapadata, getWidth () * 4 * getHeight (), NULL); CGColorRenderingIntent intent = kCGRenderingIntentDefault; CGImageRef image2 = CGImageCreate (getWidth), getHeight (), 8, 32, getWidth () * 4, color space, bitmapinfo, provider, zero, no, intent); CGContextDrawImage (UIGraphicsGetCurrentContext (), rect, image2);
Edit (days later); Ok, I restarted (= created a new project in XCode, copy / pasted code from this example) the whole project and then it is working, how is anyone considering this idea anyway?
Try:
[[UIColor bluecolor] set];
Before you stroke
Comments
Post a Comment