Uli's Web Site
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.
Created: 2008-04-05 @229 Last change: 2018-04-25 @160 | Home | Admin | Edit|
© Copyright 2003-2018 by M. Uli Kusterer, all rights reserved.