PDA

View Full Version : Advice please - image, opacity quest




harveypooka
Feb 9, 2006, 11:41 AM
Hello,
I'm no programmer - I have a book on Cocoa that I still haven't read, but will soon! I want to make some kind of program (or extension?) that'll allow me to display an image on a monitor with varying levels of opacity (user defined) that will just lay over the top of anything/everything. So, I'm doing a word document and want view an image of my cat or a landscape in the background, but not in the background - just overlayed on the screen that can only be modified via it's icon in the dock/system panel. Any ideas where to start?! Thanks!



HiRez
Feb 9, 2006, 03:56 PM
I want to make some kind of program (or extension?) that'll allow me to display an image on a monitor with varying levels of opacity (user defined) that will just lay over the top of anything/everything. So, I'm doing a word document and want view an image of my cat or a landscape in the background, but not in the background - just overlayed on the screen that can only be modified via it's icon in the dock/system panel.You can just make a borderless NSWindow with NSBorderlessWindowMask, set your image view to be the contents of the window, set the window as top level with perhaps [myWindow setLevel: NSPopUpMenuWindowLevel] (I don't think it'll let you set a semi-opaque, non-fullscreen window to NSScreenSaverWindowLevel, which is the highest, but I'm not sure about that), then just adjust the window opacity with [myWindow setAlphaValue:<whatever {0.0 .. 1.0}>]. Setting up the basics including loading an image is probably no more than a dozen or so lines of code. Can't help you with the Dock/System Panel stuff but it's probably not that complicated.

harveypooka
Feb 9, 2006, 03:58 PM
Excellent. Once I figure out what that means I'll give it a go! :p

HiRez
Feb 9, 2006, 06:21 PM
OK so I was bored and made a mockup of your app, which is attached to this message (app + source code in a .zip file, ~83k). It's a few more lines of code than I thought, but not too much really. Anything like what you are looking for? As I said, I don't really know much about Dock control or System Prefs panels.

40506

harveypooka
Feb 9, 2006, 06:42 PM
Dude, that's ace! What did you make this in and how tough was it to do? My last experience of looking at programs was er...ResEdit. And that's just pulling stuff apart. Ooo, I'm skilled me! That's exactly what I had in mind! Do you mind if I modify it slightly?

HiRez
Feb 9, 2006, 09:03 PM
Dude, that's ace! What did you make this in and how tough was it to do? My last experience of looking at programs was er...ResEdit. And that's just pulling stuff apart. Ooo, I'm skilled me! That's exactly what I had in mind! Do you mind if I modify it slightly?No, I don't mind if you modify it, the source code is there for you to dismantle and modify and do whatever you want with...glad if it'll help you! It's all Objective-C/Cocoa in an Xcode project, just install the developer tools from the Tiger disk first, then download the latest Xcode update from Apple (2.2.1), then open the project (FTW.xcodeproj). It wasn't that hard to do, probably took me an hour and a half or so.

EDIT: Oh, and it turns out you can set the window level to NSScreenSaverWindowLevel, but if you do that you won't even see things like alt-tabbed overlays, so I backed it off one level for safety. I really think Apple discourages putting things at that level that aren't screen savers or full-screen exclusive apps.

live4ever
Feb 10, 2006, 12:28 AM
I've been using an app like this called Photostickies.
http://www.devonthink.com/products/shareware/shareware.php