Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

harveypooka

macrumors 65816
Original poster
Feb 24, 2004
1,291
0
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

macrumors 603
Jan 6, 2004
6,265
2,629
Western US
harveypooka said:
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.
 

HiRez

macrumors 603
Jan 6, 2004
6,265
2,629
Western US
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.

View attachment FTW 1.01a ƒ.zip
 

harveypooka

macrumors 65816
Original poster
Feb 24, 2004
1,291
0
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

macrumors 603
Jan 6, 2004
6,265
2,629
Western US
harveypooka said:
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.