| Main |

PDFs and NSToolbar

One of the nicest new features in OS X 10.5 (Leopard) is resolution independence. Not only does this pave the way for a zoom feature that doesn’t pixellate as you zoom in, providing a better user experience for partially sighted users, but it also means that as display panel resolutions climb, the Mac OS X UI will stay a usable size and will just start to look much nicer.

So, Apple are trying to encourage developers to make their apps resolution independent. The problem with that, of course, is that it means everything must scale nicely (even to non-integer scale factors), and bitmaps just don’t do that easily. As a result, they’re suggesting that we draw several sizes of bitmap and stick them together into a multi-resolution TIFF.

That’s one way to go, certainly, but it does multiply the effort somewhat; drawing icons is hard enough without having to draw them several times at different scales and detail levels.

Anyway, some of us would rather use vector graphics where possible. (There have been some remarks about this already from the “you should use bitmaps” camp, which was later clarified after some criticism; it isn’t my intention to go into the pros and cons here).

So, away you go, changing your icons for vector graphics (probably PDF, on Mac OS X). For me, this was all working wonderfully, until I hit a stubborn problem. One of my toolbar icons, which looks like this

Go

was being rendered with a white square behind it whenever it was disabled or highlighted; i.e. like this

Go (Disabled) with a nasty white square behind it

This, of course, looks really bad, and I couldn’t work out why it only affected some icons and not others. Anyway, if you’re struggling with the same problem, a workaround is to call -setAlpha: on your NSPDFImageRep, giving the argument YES. The result in my case is that the problem went away:

Go (Disabled)

For people inside Apple, I’ve filed a bug report: rdar://4996913.

Trackbacks

TrackBack URL for this entry:
http://alastairs-place.net/movabletype/mt-tb.cgi/128.

Comments

there's something strange in the way that you've set up MT. only your current post includes the date. the others just show the time :(

hth,
marc

The templates I’m using are heavily customized. It seems that I’d forgotten to add the day to the footer for the individual archive template (the other pages display the date just fine).

Post a comment

If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thank-you for your patience.

(Your e-mail address will not be displayed or included in any pages served on this site; nor will you get any spam as a result.)

A live preview of your comment will be displayed below. It should refresh automatically when you stop typing, but if not then the “Preview” button above will update it.

Live Comment Preview