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...

Historical tidbits about NSImage

Andrew Stone has been programming Cocoa for much longer than most of us out there. As such, he knows historical tidbits that help explain some of the oddities in Cocoa. One such is the plethora of drawing methods in Cocoa's NSImage, which Andrew Stone demystifies for us:

Before Mac OS X 10.0, NSImage would draw ignoring the current transformation matrix. Now this is fine if you have a simple list of graphics - but if you have nested layers of scaled, rotated, skewed groups, it's a royal pain in the patooti to micromanage image drawing based on depth of a hierarchy!

For compatibility with older applications, the existing NSImage drawing methods such as compositeToPoint: alway draw with only the origin of the image transformed. The image itself is drawn ignoring scale and rotation transforms with the origin at the lower left. While it has been possible to draw with the current transform by getting one of the image's representation and calling it's draw method, two new methods have been added to NSImage that do this for you.
He's of course talking about drawAtPoint: and drawInRect:. Until now, I wasn't really aware of this difference. BTW, there's also lots of interesting info on these two calls and others in his article. Go there and read it, it'll make you a better programmer :-)

Reader Comments: (RSS Feed)
Christoph Pfisterer writes:
Actually, if requiring Tiger is okay for the app, I'd recommend using CIImage instead of NSImage for displaying raster images (as in photos, not icons). It uses a higher quality scaling algorithm, and seems to be faster at the same time. And no fussing around with NSImageRep and strangely set image sizes. :-)
Or E-Mail Uli privately.
 
Created: 2006-06-23 @162 Last change: 2024-11-15 @656 | Home | Admin | Edit
© Copyright 2003-2024 by M. Uli Kusterer, all rights reserved.