how to aggregate information on UIImage?

Posted by user1582281 on Stack Overflow See other posts from Stack Overflow or by user1582281
Published on 2013-11-10T13:25:18Z Indexed on 2013/11/10 15:54 UTC
Read the original article Hit count: 107

Filed under:
|

I want to draw on each drawing cycle 1000 more lines on my UIIMage, right now I do it by :

-(void)drawRect
{
    for(int i=0;i<1000;i++)
    {

        UIGraphicsBeginImageContext(myImage.size);


        code to draw line on current context...

        draw previous info from myImage:
        [myImage drawInRect:myRect];

        //store info from context back to myImage
        myImage=UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
    }

    //append the image on the right side of current context:
    [myImage drawInRect:myRightRect];
}

problem is that I think that drawing entire image each time just for the few lines added is very expensive, anyone has any idea how to optimize it?

© Stack Overflow or respective owner

Related posts about ios

Related posts about quartz-2d