Folks,
I was asked to create a Coyote Graphics pixmap. In other words,
an invisible cgWindow that commands could be loaded into,
sent to a PostScript file, made into PDF, PNG, JPEG files, etc.
This was simple to do now that I have the guts of cgWindow
(cgCmdWindow) separated from cgWindow itself.
So, I have create a cgPixmap command that acts *exactly*
like cgWindow (same keywords, etc.) except that I wrote
this as a function rather than as a procedure. I just thought
it was handier to get the object reference back. The object
is named cgPixmapWindow, and it is just a very simple
subclass of cgCmdWindow.
You can add commands to the pixmap window, for example, like this:
data = cgDemoData(17)
pixmap = cgPixmap('cgPlot', data, COLOR='red')
pixmap = cgPixmap('cgPlot', data, PSYM=2, /Overplot, $
COLOR='dodger blue', /AddCmd)
pixmap = cgPixmap('cgPlot', cgDemoData(17), color='olive', $
Linestyle = 2, /Overplot, /AddCmd)
pixmap = cgPixmap(/ListCmd)
pixmap = cgPixmap('cgPlot', data, COLOR='purple', $
/ReplaceCMD, CMDINDEX=0)
To make the pixmap easier to use, I have added OUTPUT
and COPY methods, except that I have added these to
cgCmdWindow, because this object could use these methods,
too.
So, for example, if you wanted to copy the contents of
the pixmap window to a normal IDL graphics window, you
could do this:
window
pixmap -> Copy
If you want to make a PNG file of the contents of the
pixmap window, you can do this:
pixmap -> Output, 'myfile.png'
You configure the pixmap window the same way you
configure cgWindow, with cgWindowSetDefs or cgControl.
One of the nice features of *this* pixmap window is
that you can actually see it if you want to! (I don't
know if you have worked with pixmaps much before but this
is a NICE feature!)
pixmap -> SetProperty, Visible=1
You can even resize the pixmap while it is visible!
When you are ready to make it disappear again, do this:
pixmap -> SetProperty, Visible=0
When you are finished, destroy the pixmap and all its
memory in the usual way:
cgDelete, pixmap
Just writing about it I am already thinking of new things
I can do with this window, so it is likely to change in
the next week or so, as I get reports from people who use
it. But, I thought I would put it out there so people can
start using it.
You can find it among the usual Coyote Library programs:
http://www.idlcoyote.com/programs/zip_files/coyoteprograms.z ip
You will need an undated cgCmdWindow, and I've also updated
cgDisplay to work better with it, too.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|