Re: Resolution-independent toolbar icons
Re: Resolution-independent toolbar icons
- Subject: Re: Resolution-independent toolbar icons
- From: Phill Kelley <email@hidden>
- Date: Sun, 17 Jun 2007 10:30:06 +1000
At 10:35 -0500 16/6/07, Ricky Sharp wrote:
>(1) use vector-based artwork. I do this myself for 99%+ of my
>artwork. I also use Illustrator.
This may be where my fundamental misunderstanding lies. When I start with
Illustrator and save-as PDFs, I think I am using vector-based artwork. Am I
missing the point somehow?
>(2) use multi-resolution TIFFs. I believe the Tiger and later has a
>tiffutil command-line tool that lets you merge TIFF images together.
>Here, create at least two resolutions: One 72dpi and one 288dpi.
>Cocoa will choose the right dpi flavor to render depending upon the
>current scale factor. I use this approach for large cursors (images
>fed to NSCursor).
I could do that but I thought that the idea of using PDFs for everything
was kinda cool. If you had told me that PDFs were unlikely to ever work
properly and that multires TIFFs were the only approved way of implementing
res-independence, I would've accepted that and moved on. But your (1) seems
to suggest this isn't the case.
>However,
>when you say transparent backrounds, are you adding a rectangle in
>your PDF and setting its transparency? You don't need to do that, if
>that's the case.
This is the setup. The artboard is a custom 128x128 pixels. The artwork
contains two layers. The icon is on the lower layer and a 128x128 rectangle
with no stroke and no fill sits on the upper layer aligned with the
artboard.
I select-all and make a clipping mask. Because the no-stroke/no-fill
rectangle is uppermost, it becomes the mask. The result is everything
grouped onto the upper layer. I delete the now empty lower layer, then
save-as a PDF.
I did try just deleting the clipping rectangle layer and saving the plain
artwork but that didn't make any difference, suggesting that the artboard
is what is setting the dimensions, rather than this being a by-product of
the clipping rectangle (I need the clipping rectangle for some icons to
ensure that no shadows escape their intended bounds).
When I said earlier that I have checked that the icon has a transparent
background, I mean that if I turn on View>Transparency Grid in Illustrator,
I can see that there is nothing in the object stack that would cause the
icon to lose transparency. I also dragged the PDFs into a dummy InDesign
document with a colored background to confirm that Illustrator wasn't
misleading me. Then, of course, we have the redraw effect on the toolbar
which suggests that the icons have transparent backgrounds and that their
initial appearance is just an artifact of how NSToolbar is going about its
business.
>This may though be a limitation of using PDFs with toolbars?
I think I agree.
>For example, when I render my PDF images, I always use:
>
>drawInRect:fromRect:operation:fraction:
That sounds like a lot of hard work so I'll keep that in reserve.
I was kinda hoping that someone on the list might say something like, "you
need to run the PDFs through <utility>" or "you need to send message <x> to
each NSImage as you load it" or "add <magic key> to the app's plist".
In the absence of a reply along those lines (ie, telling me that I haven't
drilled into the doco far enough), I think I'm probably going to conclude
that this is a bug and file a report.
At 08:41 -0700 16/6/07, jeff ganyard wrote:
>Since anything causing the icon to redraw would resolve the issue have
>you tried either forcing the toolbar to redraw when the window first
>opens or subclassing toolbar to force a redraw when it loads?
No, I haven't tried that Jeff. But I will.
Thanks Ricky. Thanks Jeff.
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