Liberate your application
Now works on all architectures, and without hiccups!
Can’t get enough of window transitions? Love a little eye candy? Well, you’re in luck. The Core Graphics Framework and Xcode Project Template make adding the fantastic Core Graphics function to your app a breeze. In fact, it’s even more complete than the tutorial, and already has more features in it before you write a single line of code! It doesn’t stop there, however. This framework powerful enough to use the genie effect. That’s right. That awesome Mac OS X transform you can get when you minimize an application. Core Graphics contains a wealth of resources. You really have to check it out.
Point. Click. Zoom!
The CGS Framework is a an implementation of transitions, transforms and everything Core Graphics. It includes the definitions and implementations for the methods, so that using a transition or transform is as simple as calling a single method! For example, scaling a window is as simple as a “- scale: about:” call on the window, and rotating it just requires a single “- rotate: about:”. In the same way, Core Graphics is laid bare with this framework, for you to utilize at your pleasure!
Don't lift a finger
The framework does all the work for you, but even then, it gets simpler. Source for a sample app is included which means that you can create Core Graphics projects straight away by building on top of it. This saves you, the developer time in adding and linking the Framework, and reading and implementing the Core Graphics class in Interface Builder, as well as adding the framework to your project. A single double-click on the sample project and it’s all done for you. What more could you ask? Download a copy and check it out today. You’ll be surprised how powerful it is.
Gimme already!
Now a universal binary for your developing pleasure!
Once downloaded, open CoreGFX.app to view some of the possible effects. You can copy the source folder to hard drive if you need to build a Core Graphics enabled app. Enjoy the wonderfulness, and I hope you have fun!
Any queries, fire away.
Make sure you understand that some of the functions of Core Graphics used in this framework are undocumented, internal APIs that Apple haven’t released. (Calm down. It’s not illegal). Having said that, apps like Quicksilver would be quite bland without the use of the undocumented Core Graphics functions, so exercise your discretion.
This project relies heavily on work by Wade Tregaskis and his Rotating Windows.
© 2006 Ankur Kothari.
32 Comments so far
Leave a commentPages: « 1 [2] Show All
Logan, it’s great to hear that you’re finding this site useful. Do let me know when your application is done, I’d love to see it.
About the framework, are trying to link just the framework, or have you dragged the “Cocoa Core Graphics Application” folder to Macintosh HD/Library/Application Support/Apple/Developer Tools/Project Templates/Application/ ? Once that is done and you click File -> New Project you should see a “Cocoa Core Graphics Application” project which should be able to build and run without errors immediately.
EDIT: I’ve just tried building for Intel and it failed miserably. Give me a couple of hours to try and hunt this bug down.
determined by Ankur on October 28, 2006 5:55 pm | Permalink
Core Graphics is an undocumented, internal API that Apple haven’t released
This is misleading. Core Graphics is a public API (CGPath, CGImage, and so on) it’s just that you’re using the private parts of the framework.
You should probably make this clear in the demo and docs so new Mac programmers don’t get the wrong message.
As I said in the other thread, though, great work.
proclaimed by Scott Stevenson on October 28, 2006 6:28 pm | Permalink
Yeah, I did think I sounded a little negative there, but people were arguing the use of Core Graphics.
It’s changed now, hope it worked for you. I’m still trying to fix that Intel bug. I think I’ve almost got it. Just another reason to get a MacBook Pro, I guess.
recorded by Ankur on October 28, 2006 10:09 pm | Permalink
Ankur: It might, just might be because it’s not compiled as a universal binary
Getting info on the CGS binary in the framework reveals that it’s a “Document (PowerPC)”.
In the build settings for the framework, just set “Architectures” to “ppc i386″.
written by Joachim Bengtsson on October 28, 2006 10:28 pm | Permalink
Joachim, that’s I’ve been trying to do for the past three hours. It just doesn’t want to compile as universal. I’m posting the < href=”http://dev.lipidity.com/wp-content/uploads/2006/10/cgs-framework-source.zip” title=”Source code for the framework”>source for the framework up if anyone wants a crack at it.
announced by Ankur on October 28, 2006 11:00 pm | Permalink
Oh! I see. I apologize for the somewhat rude tone :/ I’ll have a look at the code…
published by Joachim Bengtsson on October 30, 2006 9:35 am | Permalink
No problem. “As iron sharpens iron, so one man sharpens another.”
Good luck finding a fix, or what the problem actually is. I guess that’s the trouble with undocumented stuff; it’s impressive, but takes work to iron out the bugs.
professed by Ankur on October 30, 2006 3:13 pm | Permalink
Haha! I’ve got it!
Watch for another post coming soon…
expressed by Ankur on October 30, 2006 9:55 pm | Permalink
Should now be 99.9% bug-free until another bug is found.
Feel free to use this code to dazzle your clients / users, and let me know how much fun you have with it.
written by Ankur on October 30, 2006 10:19 pm | Permalink
What was wrong? I looked at the code for a jiffy, but didn’t find anything.
expressed by Joachim Bengtsson on October 31, 2006 12:26 am | Permalink
Thanks for looking. The problem wasn’t in the code, it was in some project settings. I initially had an executable and framework target in the same project, then when I deleted the executable to build just the framework, something must have messed up.
The framework worked when I rebuilt another project from scratch.
recorded by Ankur on October 31, 2006 3:16 pm | Permalink
I’ve been playing around with this and it’s definitely pretty sweet. I haven’t figured out yet though how to apply the effects to individual views instead of windows. Is this possible? Thanks again!
spoken by Stephen Goodman on November 11, 2006 10:53 am | Permalink
Also, would you care to comment on what impact Core Animation will have on these frameworks? Will they be totally obsoleted, or what?
stated by Stephen Goodman on November 11, 2006 11:06 am | Permalink
Stephen, most Core Graphics effects are only allowed on windows, and I’m not aware of any hack that would allow you apply these on individual views as you’re required to pass the window number to implement the transition. For effects on individual views, it’s probably best to use Core Image Filters, and a sample app with both Core Image and Core Graphics effects is available here.
Now, regarding Core Animation, you have to realize that Core Graphics is written by Apple. It wont become obsolete with the release of Core Animation, because
In fact, Core Animation itself is not a medium for creating effects, but rather for integrating things like video, and OpenGL. That’s my understanding, anyway.
Either way, Core Graphics is not about to become obsolete
determined by Ankur on November 11, 2006 1:41 pm | Permalink
There is a quick fix if you want use those CoreGraphics animations on a view:
-you hide the view
-you make a borderless window and you change the content view to your view
-you apply your transition
-you delete the window
-you display your view
Should work?
composed by SeoxyS on November 11, 2006 6:10 pm | Permalink
Very good idea. I think that’ll actually work! Can’t believe I didn’t think of it
disclosed by Ankur on November 11, 2006 9:24 pm | Permalink
You could even implement this in the framework…
recorded by SeoxyS on November 11, 2006 10:10 pm | Permalink
I considered doing that yesterday, but decided against it because of the (assumed) performance overhead. But maybe by using the same window over and over (ala the field editor for text) this could be minimized. I’m definitely going to do this!
expressed by Stephen Goodman on November 12, 2006 4:31 am | Permalink
Definitely let me know if you get any results.
written by Ankur on November 12, 2006 12:35 pm | Permalink
It works on Intel, building by it self separately is a bit shaky, but i managed to backup the download and renovate the application and build it into my personal one. It was hard but managed to conceal them in a box in a drawer belonging to NSWindow.
stated by Bee on July 13, 2007 1:46 pm | Permalink
I was really looking for it for a long time! Thanks very much!
But as i see, there is a little bug with shadow, it disappears when transaction begins
Any ideas, how to fix that?
expressed by AngelO. on July 23, 2007 11:49 pm | Permalink
It might be possible to force the shadow to stay during the transition. I think I recall doing this sometime, but I’m not certain. If I find anything I’ll post it up here.
determined by Ankur on July 26, 2007 9:42 pm | Permalink
Awesome! Thanks a ton for putting this out there for us!
professed by Chris on August 8, 2007 6:06 am | Permalink
Any way to use the Genie effect on an NSView inside a window? Basically doing an NSView to NSView effects instead of NSWindow to NSWindow.
stated by Chris on August 8, 2007 6:08 am | Permalink
Thanks, Chris. I haven’t used undocumented Core Graphics functions on views at all, but Seoxys’ suggestion sounds reasonable.
reported by Ankur on August 8, 2007 1:41 pm | Permalink
Pages: « 1 [2] Show All
Leave a comment