Update: [cairo] how to interface with an NSWindow (please help!)
Travis Griggs
tgriggs at cincom.com
Thu Feb 22 11:40:47 PST 2007
On Feb 22, 2007, at 0:14, Travis Griggs wrote:
> I'm working on my VisualWorks Smalltalk interface to Cairo. In that
> environment, I have easy access to any NSWindow I open, and the
> ability to send objective-c messages. So what I do is basically:
>
> 1) fetch the class named NSGraphicsContext
> 2) id nsGC = [NSGraphicsContext graphicsContextWithWindow:
> myNSWindow];
> 3) cgCtx = [nsGC graphicPort];
> 4) cairo_nquartz_surface_create_for_cg_context (cgCtx, 200, 200, 1);
>
> But when I do drawing ops on that surface, nothing happens. :( Am I
> doing this right at all? Or is there a better/different way to do
> it? Do I need to send additional messages to the NSGraphicsContext
> or to the CGGraphicsContext (this is just a struct pointer,right?)?
>
> I'm using 1.2.6 (I think). I'm confused about the recent sent of
> messages regarding osx apis and stability thereof. Should I upgrade
> to the new snapshots for cairo?
So, I was wrong. It is doing something. Just not right away. All I
have to do is hide the window and reexpose it and then it's there!
Yay. I've tried ending my drawing sequence with a surface flush. But
that doesn't have any affect. If I use finish, it shows up right
away, but of course, none of it can be used anymore (have to recreate
the cairo objects).
--
Travis Griggs
Objologist
"Every institution finally perishes by an excess of its own first
principle." - Lord Acton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/cairo/attachments/20070222/083866d6/attachment.html
More information about the cairo
mailing list