I'm really new to working with CGContexts, and I'm just trying to figure things out by following simple drawing and sketching instructions (http://blog.effectiveui.com/?p=8105)
I hit a brick wall when it came to changing the background color of my CGContext.
I run the context as follows:
- (BOOL) initContext:(CGSize)size { int bitmapBytesPerRow; bitmapBytesPerRow = (size.width * 4); cacheContext = CGBitmapContextCreate (nil, size.width, size.height, 8, bitmapBytesPerRow, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipLast); CGContextSetRGBFillColor(cacheContext, 1, 1, 1, 1); return YES; }
and changing the color and width of the beat:
UIColor *color = [UIColor whiteColor]; CGContextSetStrokeColorWithColor(cacheContext, [color CGColor]); CGContextSetLineCap(cacheContext, kCGLineCapRound); CGContextSetLineWidth(cacheContext, 4);
but when I try to change the background color from black (either in init, or in the parts of the drawing / installation setup) using CGContextSetRGBFillColor(cacheContext, 1, 1, 1, 1); , the effect will not be.
Can someone point me in the right direction, either the best / right place to put this call, or the right call? Thanks so much for your time!