Hey everyone,
I'm trying to whip up a sketch application for the iPad so that I can draw with my finger. I've got a problem that the performance is atrocious. I've pasted a snippet of the core of my code below. In reality it's a bit more complicated.
Does anyone know off the top of their heads why this CGContext stuff is slow? I'd appreciate any suggestions that could tell me how to make my sketch run faster. Thanks,
mj
UIGraphicsBeginImageContext(CGSizeMake(768,1004));
CGContextRef currentContext = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(currentContext, 2.0);
CGContextSetRGBFillColor(currentContext, 0, 0, 0, 1);
CGContextSetRGBStrokeColor(currentContext, 0, 0, 0, 1);
CGContextAddEllipseInRect(currentContext, CGRectMake(xFinal, yFinal, circleDiameter, circleDiameter));
CGContextFillEllipseInRect(currentContext, CGRectMake(xFinal,yFinal,
circleDiameter, circleDiameter));
UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
UIImageView *vresult = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, result.size.width, result.size.height)];
vresult.image = result;
[self addSubview:vresult];
UIGraphicsEndImageContext();