Mirroring part of the screen to an external display (on OSX)
I would like to write a program that can reflect part of the main display in a new window. Ideally, this new window can be displayed on an external monitor. I have seen this information for flights that do this on a PC (multifunction display extractor).
Click here for a screenshot of the program (MFD Extractor)
This will be a live window, i.e. The constantly updated video display is not only static.
I have looked at magnifiers or vnc clients for ideas, but I think I need to write something from scratch. I tried to do some reading on osx programming, but where to start in terms of getting access to the display? I somehow need to extract graphics from a specific program. It is best to go to the final stage of the output (individual pixels sent to the display) or somewhere closer to the window control stage.
Any ideas or pointers would be much appreciated. I just need to start somewhere.
Hello,
a source to share
There are several ways to do this:
- Quartz Display Services will allow you to access the video memory for your screen.
- Quartz Window Services (aka CGWindow) will allow you to create an image of everything under the window. If you create a borderless , transparent , empty, high level window whose frame spans the entire screen, everything below it will be everything on that screen. (You can, of course, create a smaller window to copy a section of the screen.)
- There is also a way to do it with OpenGL, which I never fully understood. Several code examples, OpenGLScreenSnapshot and OpenGLCaptureToMovie , demonstrate this technique . However, it is more or less deprecated from CGWindow.
Each of them will receive an image, which you can then display or write to a file or something.
To show an image, use NSImageView or IKImageView . If you want to scale it up, IKImageView has a property zoomFactor
, but if you want to scale to the nearest neighbor (like Pixie, DigitalColor Meter, or xScope ) I think you need to write a custom view for that (but even that's not that hard).
a source to share