Update: [cairo] how to interface with an NSWindow (please help!)
vladimir at pobox.com
Thu Mar 1 11:57:52 PST 2007
Travis Griggs wrote:
> On Mar 1, 2007, at 6:08, Stephen Sinclair wrote:
> I have now. :) Thank you.
> So a flushGraphics on the NSGC realizes the changes. Shouldn't Cairo
> being doing this though? At *least* as part of it's own flush()
> function. Though I'd like to not have to litter my drawing sequences
> with well intentioned flushes, since I was shooting for xplatform here,
> and I don't have to do that for Win/Xlib.
> For now, this gives me something I can use to do prototyping.
Sorry, I just now saw this thread. Cairo has no knowledge of NSGC, etc;
it only knows about the CGContext. If you use the CGContext that's
given to you in a drawRect message, then Quartz will automatically flush
the rendering afterwards. If you create the NSGraphicsContext yourself,
you have to do this manually after you're done rendering.
If you create the context for the window in this way though I don't know
whether the drawing is actually preserved in the window's backbuffer,
but I assume that it is, so this should be ok. You're generally not
supposed to do the kind of incremental/synchronous drawing that you're
doing though; the only way to get the behaviour you want is to call that
flush function as necessary.
More information about the cairo