New Quartz Tutorial at Cocoa Dev Central

Yes, friends, the time is finally upon us. A brand-new Cocoa graphics tutorial (Quartz) at Cocoa Dev Central. This is a beginner-level tutorial which doesn't assume prior graphics programming experience.

There are a few landmarks in this tutorial. First, it features a more evolved version of the new article format introduced in the C Tutorial. One improvement is the addition of combo code/image boxes:

Combo Code and Image


This may seem minor, but I think it's a huge win for visual learners. You see the code, and the image is right next door.

Secondly, I think this tutorial may be the first real crack many newbie Mac programmers get at graphics programming. Quartz is well documented, but the documentation is (as far as I can tell) written for people that who already have some idea of how to write drawing code. This tutorial is for the rest of us.

Last but certainly not least, it's the first new tutorial in the donation era of Cocoa Dev Central. I'm making a run at keeping this a sustainable practice. This tutorial took at least 120 hours from conception to completion, and that's being conservative.

Perhaps that sounds like a lot. The previous post about creating tutorials covered the gist of the process, but what it comes down to is it takes more time to write something short than something long.

The tutorials are subjected to constant experimentation and iteration before they're published. Most paragraphs end up half the length of their original version. The tricky part is deciding what has to stay and what can be discarded. The illustrations, screenshots and sample code take a lot of time as well.

In some ways, this tutorial is responsible for the site redesign. The things I wanted to do here just didn't fit into the old site. So it was time to start over.

So enjoy, and tell your friends.
Design Element
New Quartz Tutorial at Cocoa Dev Central
Posted Nov 3, 2006 — 10 comments below




 

Andrew Knott — Nov 03, 06 2289

Thanks very much for this Scott. Brilliant.

Hey I tried to do the donation thing but PayPal reckons their credit card processing is suffering Tech Difficulties... Will try again later though.

Scott Stevenson — Nov 03, 06 2290 Scotty the Leopard

Will try again later though

Thanks. I saw a note on their site tonight about scheduled maintenance.

ssp — Nov 03, 06 2291

Definitely looks nicer than what Apple offer. I would have appreciated tutorial in this style when I fought my way through Apple's documentation a few years back. And I guess that'll be more significant for topics that are more advanced than just those few structs.

Providing links to Apple's documentation of the structs and classes you use could also be helpful.

(What I found a bit unclear when skimming through the text is that at the end you actually go and draw things using stuff like [self bounds] without being explicit that you better be a NSView subclass when doing that - which may be non-obvious to beginners. In addition, just calling -set on a colour probably wants you to be in some similar situation. The Drawing Groups sample code can probably be simplified even more by just using a single NSColor object (rather than an array) an set that at the beginning of the loop without the +redColor first initialisation.)

Christian Machmeier — Nov 03, 06 2292

In a word: Beautiful!
Thank you!

Scott Stevenson — Nov 03, 06 2293 Scotty the Leopard

draw things using stuff like [self bounds] without being explicit

There are always judgement calls. I don't think I've ever published a tutorial that didn't result in somebody saying I left something out.

The tutorial would need to be twice as long to properly explain NSView, so I just decided to focus on the basic data structures, and cover more stuff in the next tutorial.

If something's too long, few people will get through it. Better to release something a bit shorter, even if there are gaps. The whole point is to reach people that were previously unreachable.

Also, keep in mind there's downloadable example at the end, which is at least a starting point for NSView. People can go in there and mess around if they want.

In addition, just calling -set on a colour probably wants you to be in some similar situation.

Not sure I follow. The -set method is explained in the tutorial.

The Drawing Groups sample code can probably be simplified even more by just using a single NSColor object

True but that would miss the point of the example, I think.

Thanks for the feedback.

Stephan Cleaves — Nov 06, 06 2307

I love the new format of Cocoa Dev and particularly this tutorial. Though this first article was stuff I already knew it inspired me to whip up a little demo that I have blogged about in Interactive Animated Rectangle.

Scott Stevenson — Nov 06, 06 2310 Scotty the Leopard

little demo that I have blogged about in Interactive Animated Rectangle.

Fancy stuff. I know I shouldn't be that entertained by dragging a spinning rectangle around, but I am.

Blain — Nov 07, 06 2329

Wait, donate? I thought I was signing up for Magenta membership!

Seriously, though, I do see the need for a book of the site, since you cover areas that would not be mentioned in larger more monolithic books, such as screen savers, html help, or newer things like Core Data. At the very least, a nav page that groups by date and by subject matter.

AnonymousFred — Oct 22, 07 4813

Why is it impossible to find a tutorial on how to write a jpg or bmp etc file from an nsview? surely this is basic bread and butter programming. I have finally got through the IB barrier, I can delegate, i can use a timer, i can draw paths with mice but i cant get to write a b****@@@@ view to file! I've been googling for 4 days now, i have "programming with quartz" in front ofg me as i write, i have "cocoa programming for os x" i have "vermont recipes", i have wall to wall bookmarks to the cocoa drawing guide and yet i still cant find a single example to get me on my way!!!!!!
And everyone is telling me how wonderfully simple it all is.

AAAARRRRRRGGGGGHHHHHH!!!!!!!!!!!!

It's not as if I havn't programmed most of my life!!
I write c, perl, pascal, prolog, cobaol, algol, fortran name ive programmed it. why can't i jkjlskadjlsajdljsdlsadflkahjsjdkalj

Scott Stevenson — Oct 22, 07 4815 Scotty the Leopard

@AnonymousFred: I posted a solution here.




 

Comments Temporarily Disabled

I had to temporarily disable comments due to spam. I'll re-enable them soon.





Copyright © Scott Stevenson 2004-2015