Re: I need a milder application badge (solution)
Re: I need a milder application badge (solution)
- Subject: Re: I need a milder application badge (solution)
- From: Jay Reynolds Freeman <email@hidden>
- Date: Sat, 25 Jul 2009 16:04:39 -0700
On Jul 25, 2009, at 3:14 PM, Kyle Sluder provided a variety
of extremely helpful and pertinent comments:
> I'm also pretty sure you don't want to use -setApplicationIconImage:.
> That will cause all occasions of your app icon, including places that
> use +[NSImage imageNamed:] with an @"NSApplicationIcon" parameter, to
> display your customized icon. This is not the behavior your users
> will expect.
Kyle, I read you loud and clear, or at least I think I do, but the
behavior
you describe for the app icon image in the dock is not what I am
seeing. I
am running my application now, with my bitmap-hacking code in place,
and it has passed the point where the modified NSImage has been
passed to -setApplicationIconImage: . The icon in the dock has indeed
changed to the modified version, but when I look at other places where
I expect the unmodified icon to show up, I still see the unmodified
icon. That includes all views of folders where the application is
stored (those views having been opened or refreshed since
starting the application), the window produced by my application's
"About" menu item, and the Apple "Recent Items" menu, for example.
The only appearance I am trying to alter is the appearance of the
application icon that sits in the dock when the program is running,
and that seems to be all that -setApplicationIconImage: is changing.
(My own code doesn't happen to call [NSImage
imageNamed:@"NSApplicationIcon"].
Perhaps there are library or framework routines that are calling it on
my behalf, whose outputs I should review?)
Furthermore, I only want this change to persist while the program is
active. The change I am making is like the red circle with a number in
it that sits on the "Mail" icon and shows how many new EMails you have.
I would use the published interface to that feature, except that a
bright
red color is a bit too strident for my purposes.
> There is no such thing as "modifying an image" in Quartz.
Maybe so, but you can certainly grab the bits you have drawn, using
-[NSBitmapImageRep initWithFocusedViewRect:], and then add that instance
of NSBitmapImageRep to a new instance of NSImage, using
-[NSImage addRepresentation:], and then use the new instance of NSImage
for whatever purpose you like. That is what I am doing, albeit with
rather more hackery of the bitmap than I would wish.
> All drawing on OS X happens within a window ... If you
> tell Quartz "Draw a red rectangle of this size at 50% alpha", Quartz
> has to mix 50% of the existing color in that affected area with 50%
of
> your desired red color.
Precisely! And what I am wishing for is a way to specify a window whose
"existing color" is "transparent", so that the bitmap created will in
essence have (red, green, blue, alpha) = (0, 0, 0, 0), in locations
not otherwise explicitly drawn. If such a window appeared on the
visible
part of the screen, there would clearly be problems -- there is no way
to
draw "transparent" with nothing behind it. But for setting up offscreen
windows for the capture of bitmaps that include transparent areas, such
a feature would be very useful, and I would like it to be at the
window-and-view-hierarchy level of abstraction, because that is easier
to
use, particularly for ignorant beginners like me, than the compositing
level that underlies it.
If there really is no way to do this in the existing software, I will
put in an enhancement request and we will see what happens.
---------------------
email@hidden
http://web.mac.com/jay_reynolds_freeman (personal web site)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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