• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Drawing an NSImage into a GWorld
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Re: Drawing an NSImage into a GWorld (From: Dave Hersey <email@hidden>)
 >Re: Drawing an NSImage into a GWorld (From: Scott Thompson <email@hidden>)

  • Prev by Date: Re: how to evaluate an NSString content as a real obj-c instruction/expression
  • Next by Date: Re: How to make my own 'dock' like menu from App Icon?
  • Previous by thread: Re: Drawing an NSImage into a GWorld
  • Next by thread: Re: Drawing an NSImage into a GWorld
  • Index(es):
    • Date
    • Thread