CGContextDrawImage drawing only once

Christiaan Hofman cmhofman at gmail.com
Tue Jun 10 03:08:08 PDT 2008


On 10 Jun 2008, at 4:12 AM, mdpb at gmx.net wrote:

> Hi
>
> New to the list but I think this is a relative easy question for any  
> coregraphics developer (which is I guess not me).
>
> I am displaying a series of bitmaps in a window (every so many  
> seconds), almost like an animation.
>
> I am using CGContextDrawImage to draw the CGImage (created by  
> CGBitmapContextCreateImage) to the context of my NSView.
> I got the CGContextRef of my NSView from the drawRect of my NSView.
>
> Here are the symptoms I run into:
> -I can draw one image like this to my NSView
> -I can draw another image but it won't get displayed/updated on my  
> NSView
> -if I put my terminal at this point on top of my NSView then the  
> correct picture shows up (my terminal is set to transparent so I see  
> the NSView getting updated)
> -if I use a counter to display the pictures then I also get the  
> correct picture displayed (there is no bug in reading the images,  
> its the displaying part)
>
> What am I doing wrong, is there some kind of flag not set? Thanks
>
> Matt

What are you doing? It seems to me that you're drawing to the view's  
context directly outside the drawRect: method, is that correct? In  
that case, it's not a GC question but a Cocoa drawing question, and  
you should read <http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Introduction/chapter_1_section_1.html 
 >.

Christiaan



More information about the MacOSX-dev mailing list