Using Carbon API in Cocoa Apps
I'm pretty new to the whole Cocoa thing. I want to use Quickdraw in my Cocoa application. How do I do this? From what I've read, Quickdraw is the only graphics API on Mac OS X with decent speeds.
Link in the Carbon framework and call the Carbon functions. Carbon is fully-available to Cocoa apps.
Wade
Wade
That's it? Just link it? Man, and here I was thinking that I had to do some other special modification in Project Builder or something. Thanks!
If you want to use Interface Builder and Quickdraw, just use the NSQuickdrawView (icon like the Finder) control.
Just overwrite drawRect and do all your drawing in there. There is a nice method (qdPort) so you can do:
HTH,
Jeff
Just overwrite drawRect and do all your drawing in there. There is a nice method (qdPort) so you can do:
Code:
- (void)drawRect: (NSRect)rect {
GrafPort *g = [self qdPort];
/* Use g just like normal */
}HTH,
Jeff
Ah, thank you thank you thank you! That's what I was looking for! I just didn't know how to word it.
Quote:Originally posted by geezusfreeek
From what I've read, Quickdraw is the only graphics API on Mac OS X with decent speeds.
Don't forget OpenGL :-) .
Oh ya. But I don't have any OpenGL experience anyway. I'll learn it eventually.
I just stumbled across some CoreGraphics stuff. How does this compare to QuickDraw and OpenGL, as far as speed goes? It looks easy. Is it related to Quartz in some way?
CoreGraphics is Quartz.
Okay. There's the sign of a beginner for you.
Isn't CoreGraphics a lower level API that Quartz is based on (Quartz calls CG functions)?
Chris Burkhardt
That's what I was thinking (and hoping).
I imagine that the Cocoa drawing routines may well call the CoreGraphics functions, in which case calling the CG stuff directly may be slightly faster.
Anyone care to benchmark?
Anyone care to benchmark?
CoreGraphics and Quartz are exactly alike. There are no "Quartz" functions, that's just the marketing name Steve came up with. Uh, not me, but I'm sure you're right -- you call the method, the AppKit calls the CGfunction equivalent.
The idea that QuickDraw is faster than Quartz seems absurd, but I guess its possible. I was under the impression that QuickDraw just called CoreGraphics equivalents. Now, stuff like bezier paths and all that fancy PDF stuff is going to be slow, sure, but the usual bit copy stuff should be faster in OS X. But I'm not much for 2D. You all may as well learn OpenGL because that's the future on OS X starting with Jaguar. EVERYTHING you see on screen ends up as OpenGL from now on. You may as well cut to the chase.
For those who like to troll around Apple's documentation pages online, there has recently appeared a programming topic entitled "Drawing Directly to the Screen" -- description forthcoming (of course!). Hopefully a new API in Jaguar?
The idea that QuickDraw is faster than Quartz seems absurd, but I guess its possible. I was under the impression that QuickDraw just called CoreGraphics equivalents. Now, stuff like bezier paths and all that fancy PDF stuff is going to be slow, sure, but the usual bit copy stuff should be faster in OS X. But I'm not much for 2D. You all may as well learn OpenGL because that's the future on OS X starting with Jaguar. EVERYTHING you see on screen ends up as OpenGL from now on. You may as well cut to the chase.
For those who like to troll around Apple's documentation pages online, there has recently appeared a programming topic entitled "Drawing Directly to the Screen" -- description forthcoming (of course!). Hopefully a new API in Jaguar?
You can already get direct access to the screen buffer memory using CGDirectDisplay...
I wonder whether any of the blitting routines on OS X < 10.2 are hardware accelerated at all... given that they must all composite from in-memory buffers to in-memory buffers, I'd guess the CPU is the fastest way.
QuickDraw doesn't call into Quartz in any way AFAIK... I'm pretty sure all the Quartz stuff does anti-aliasing and deals with fractional coordinates and things, none of which QuickDraw has to deal with. I suspect most of QuickDraw is still the same code that ran on your Mac 128K
I wonder whether any of the blitting routines on OS X < 10.2 are hardware accelerated at all... given that they must all composite from in-memory buffers to in-memory buffers, I'd guess the CPU is the fastest way.
QuickDraw doesn't call into Quartz in any way AFAIK... I'm pretty sure all the Quartz stuff does anti-aliasing and deals with fractional coordinates and things, none of which QuickDraw has to deal with. I suspect most of QuickDraw is still the same code that ran on your Mac 128K
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Cocoa or Carbon? | Leroy | 5 | 3,352 |
May 17, 2007 06:54 PM Last Post: SethWillits |
|
| Newbie question: Cocoa and Carbon - which for what and how to get started? | BliTz | 3 | 2,851 |
Jul 27, 2006 10:07 PM Last Post: OneSadCookie |
|
| Carbon C/ Cocoa API Questions | Stalin55 | 3 | 2,951 |
Jul 3, 2006 02:07 PM Last Post: OneSadCookie |
|
| Noob Cocoa and Carbon Questions | MonitorFlickers | 15 | 5,798 |
Feb 23, 2006 06:01 PM Last Post: Tesselate |
|
| Carbon or Cocoa for Games | Nick | 26 | 12,660 |
Mar 11, 2005 12:59 PM Last Post: Duane |
|

