Resolution-independent toolbar icons
Resolution-independent toolbar icons
- Subject: Resolution-independent toolbar icons
- From: Phill Kelley <email@hidden>
- Date: Sun, 17 Jun 2007 00:18:13 +1000
I've been experimenting with resolution independence on toolbar icons.
All my icon artwork starts life in Adobe Illustrator and, up until now, has
moved through Photoshop and tiffutil on its way to my application. The
icons were originally drawn within a 128x128 pixel bounding box but I would
scale each to 25% in Illustrator so that I would get 32x32 icons when the
artwork was pasted into Photoshop.
I assumed that "resolution independence" would mean that I could forget
about the 25% scaling step. I just saved each to a PDF, changed the toolbar
item building method to point to the PDFs instead of the tiffs, and rebuilt
the app.
When I launched the app, each toolbar item icon had a white background. I
double-checked that the PDFs had transparent backgrounds - they did. I also
blew away the NSToolbar Configuration stuff in the app's preferences file
in case that was interfering but it made no difference.
This is a document-based app. The next thing I noticed was that the white
backgrounds were only present on the first document opened (whether a
default untitled document or double-clicking a document to cause the app to
launch). For the second and subsequent documents, the toolbar icons get
transparent backgrounds.
I also noticed that anything that caused an icon to redraw would fix the
problem for that icon. Something like customizing the toolbar of the first
document (adding or removing an icon, or changing between small and large
icon sizes), would immediately redraw all the toolbar icons with
transparent backgrounds.
Then I wondered whether the nominal 128x128 starting size was the cause of
my problems so I created 32x32 PDFs. That did cause a change - all toolbar
icons always get white backgrounds.
I am setting the image via:
NSImage *image = [NSImage imageNamed:@"example.pdf"];
[image setBackgroundColor:[NSColor clearColor]]; // should be default
anyway
[toolbarItem setImage:image];
This is all under 10.4.9 but to forestall the obvious questions as to
whether I have tried it with a "later" version of the OS, let's just say
that I have no reason to believe that there are any differences.
Has anyone else been traveling down a similar path to
resolution-independent toolbar icons? Any suggestions?
Regards, PK
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden