Re: Drawing an NSImage into a GWorld
Re: Drawing an NSImage into a GWorld
- Subject: Re: Drawing an NSImage into a GWorld
- From: j o a r <email@hidden>
- Date: Thu, 14 Jul 2005 16:04:54 +0200
This only works on Mac OS X 10.4, right? Is there any way you can do
high performance drawing using Cocoa objects in a way that's
supported on earlier versions of Mac OS X?
j o a r
On 14 jul 2005, at 15.43, Scott Thompson wrote:
I wonder if you could do something like this instead (typed into
mail):
CGContextRef gworldCGContext;
QDBeginCGContext(yourGWorld, &gworldCGContext);
NSGraphicsContext *gworldNSContext = [NSGraphicsContext
graphicsContextWithGraphicsPort: (void *)gworldCGContext flipped:
false];
NSGraphicsContext *savedContext = [NSGraphicsContext currentContext];
[NSGraphicsContext setCurrentContext: gworldNSContext];
[myImage compositeToPoint: ... ]; // whichever routine you use to
draw the image itself
[NSGraphicsContext setCurrentContext: savedContext];
[gworldNSContext release];
gworldNSContext = NULL;
QDEndCGContext(yourGWorld, &gworldCGContext);
gworldCGContext = NULL;
I'm not sure about getting and setting the current
NSGraphicsContext for the thread. I don't think I've ever seen
that done anywhere else. It might work... it might cause your
computer to go up in a fireball though :-)
At any rate, this method would allow you to ignore the particulars
of how the NSImage is represented and would give the OS the
greatest opportunities to optimize drawing the image. The setup,
however, might outweigh the advantages (if the technique even works)
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden