Uli's Web Site
[ Zathras.de - Uli's Web Site ]
Other Sites: Stories
Pix
Abi 2000
Stargate: Resurgence
Lost? Site Map!
 
 
     home | blog | moose | programming | articles >> blog

 Blog Topics
 
 Archive
 

15 Most Recent [RSS]

 Less work through Xcode and shell scripts
2011-12-16 @600
 
 iTunesCantComplain released
2011-10-28 @954
 
 Dennis Ritchie deceased
2011-10-13 @359
 
 Thank you, Steve.
2011-10-06 @374
 
 Cocoa Text System everywhere...
2011-03-27 @788
 
 Blog migration
2011-01-29 @520
 
 All you need to know about the Mac keyboard
2010-08-09 @488
 
 Review: Sherlock
2010-07-31 @978
 
 Playing with Objective C on Debian
2010-05-08 @456
 
 Fruit vs. Obst
2010-05-08 @439
 
 Mixed-language ambiguity
2010-04-15 @994
 
 Uli's 12:07 AM Law
2010-04-12 @881
 
 Uli's 1:24 AM Law
2010-04-12 @874
 
 Uli's 6:28 AM Law
2010-04-12 @869
 
 Uli's 3:57 PM Law
2010-04-12 @867
 

More...

Must be UI-drawing Week '08

Looks like it's user interface drawing week right now...

Sean Patrick O'Brien posts about Resolution Independence (via Sophia Teutschler). It's a nice example of doing some simple drawing operations that look quite impressive, though of course the simplicity is misleading. If he was doing a more Aqua-ish button with a reflection, it would be a lot more complicated to code.

Also, while Sean complains about apps having oodles of bitmaps in their bundles and how drawing in code was so much better, he completely glosses over the performance considerations involved in drawing in code. Quartz was designed for precision drawing with sub-pixel rendering and can output to many destinations, including printers. Such precision comes at the cost of speed. Also, there's the fact that the drawing code itself might take up a bunch of space, too. True, apps that have a separate image for each button and state face combinatorial explosion, but if you assemble your image from parts, you can keep that to a minimum.

Dominik Wagner found a good way to experience the performance characteristics of drawing in code first-hand: Take the example that Sean posted and make the button larger, then click it. When the button reaches a certain size, there's a noticeable delay that occurs while the highlight is drawn.

That said, it is a great example of implementing a custom view and of achieving a lot with little, and it nicely demonstrates the workflow one can adopt to turn a design into coded graphics, particularly for occasions where lots of resizable controls with gradients are involved, which are often difficult to slice up and draw as bitmaps.

Another new arrival on the scene is the commercial Icon Resource Tutorial Site. It costs almost 100 Euros for 15 tutorial movies and sample files and stuff, so I haven't actually looked at it, but Alastair and Matt seem to like it.

Of course, there are other resources. Apple's Developer Site has lots of sample code for drawing custom views and cells. Lots of people have solved various of interesting drawing issues on Steven Frank's CocoaDev Wiki, and there's always places like Scott Stevenson's CocoaDevCentral and CocoaBlogs that link to various tutorials, including views.

And of course there's Steve Scott's Mac Developer Network, which even has a custom view audio podcast with Mark Dalrymple.

Reader Comments: (RSS Feed)
Sean writes:
Thanks for the linkback! You're definitely right about both the simplicity of the tutorial and the performance drawbacks of using Quartz for everything. I wanted to keep the first tutorial simple (hence the easy button) but should have discussed the overhead of rendering everything yourself. I'm hoping to have a follow-up tutorial in the next week that will draw something more complex and will discuss the potential performance issues.
Or E-Mail Uli privately.

 
Created: 2008-04-05 @229 Last change: 2024-11-15 @670 | Home | Admin | Edit
© Copyright 2003-2024 by M. Uli Kusterer, all rights reserved.