On Sat, Jul 25, 2009 at 12:15 PM, Jay Reynolds Freeman<jay_reynolds_free...@mac.com> wrote: > I do not want to change the dockTile, and no public method of > NSDockTile appears to change the dock icon in any case. I am > indeed using -[NSApplication setApplicationIconImage:], my > problem is creating a new image that has the correct areas > transparent.
Again, there is no such thing as a "dock icon" in the sense you're using the term. A dock tile is a thing that sits in the dock and draws an image. By default, this image is the one returned from -[NSApplication applicationIconImage]. If you want to customize this, you can hand it a view that does some drawing, and the dock tile will cease its own drawing behavior. When your app quits, your custom view gets removed, and since the dock tile no longer has an NSApplication to communicate with, it uses the image stored on disk. Notice there is no "dock icon" object to be handed around. The only icons that exist are the one in your app wrapper and the one returned by -[NSApplication applicationIconImage]. 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. > I am sure I can do it; it's all just ones and zeros and I have > access to all the bits. But I am not a graphics specialist and I am > reluctant to become one. (And I have never used Photoshop or > anything remotely like it.) I am just looking for a > way to alter images dynamically, at run-time, that is as easy > as putting up an offscreen window/view hierarchy and drawing > into it. I would like to be able to use something like the > capabilities of NSView for superimposing different things > on my new image. I would like to work the problem at as > high a level as I can. There is no such thing as "modifying an image" in Quartz. You're handed a buffer, you do your drawing, and the buffer is gone. You can't go back and muck with the image you drew into the buffer. It's like painting a wall: you can't lay down a layer of paint, paint some artistic design over that, and then go back and remove your first coat. The bits have already been mixed, as it were. All drawing on OS X happens within a window. This term includes not only what the user consider's a "window", but also the menubar, each desktop icon, and each dock tile. The window has a bitmap called its backing store. When you tell Quartz "Draw a red rectangle of this size", Quartz is dutifully changing bits in the backing store. 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. As a final step, Quartz composites all the windows onscreen together into the framebuffer that your graphics card pulls from to draw the display. Views are an abstraction on top of this model. Each view has a -drawRect: method that it can use to draw into the current graphics context. The graphics context has to be associated with a window, and therefore a backing store. The view hierarchy presents a well-defined drawing order for the window's subviews, but it all boils down to the Painter's Algorithm, which is what I described above. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com