I am working on an image processing application that applies a radial gradient to an image downloaded from a photo library.
On the screen, I have a slider for dynamically increasing / decreasing the radius of the radial gradient. I found that the performance on the simulator is very good, but on the iPhone 3G or 3GS it is much slower to redraw when moving the slider.
I am currently using CGContextDrawRadialGradient for drawing. The steps that I follow for each redraw:
- Create a graphics context:
UIGraphicsBeginImageContext(size) ; - Create Gradient Object:
CGGradientCreateWithColorComponents - Draw an image (photo downloaded from the photo library) into the screen scale:
drawInRect - Set the blend mode of the blend:
CGContextSetBlendMode - Draw a gradient:
CGContextDrawRadialGradient - Create a UIimage using UIGraphicsGetImageFromCurrentImageContext ();
UIGraphicsEndImageContext();- Draw the final image on the screen:
drawInRect .
Is there a faster way to draw? Perhaps using OpenGL?
Any suggestions / code examples would be appreciated.
Thanks.
ios iphone ios4 opengl-es
MrDB
source share