Object Graphics --> EPS Output how? [message #26732] |
Tue, 25 September 2001 06:46  |
Jason P. Meyers
Messages: 24 Registered: September 2000
|
Junior Member |
|
|
Hello,
This list has helped me greatly in the past and I hope that you all
will rise to the challenge yet once again. I have been working long and
hard on my thesis research and recently had to find a way to plot what I
would call a "3-D Polar Plot". Specifically, I am trying to plot
Bi-directional Reflectance Distribution Function (BRDF) data which is a
function of theta and phi. After several unsuccessful attempts with
various commercial packages, I concluded I could get exactly what I
wanted using IDL Object Graphics. And I was correct, well almost!
I now have a little IDL program that creates the type of plots I want
using object graphics. My only problem is getting acceptable output
from IDL. I am writing my thesis using LaTeX and therefore, my figures
need to be in EPS format. This is no problem when I use direct graphics
(DG) because IDL provides a PostScript device for outputting DG. I was
a bit surprised to see (at least according to the help file) no such
feature for object graphics.
I am using IDL 5.3.1 on a Windows NT 4.0 platform. Does anyone know
of a way to output object graphics to an EPS file in this situation?
The help file indicates that the Unix version does this via the system
clipboard but under Windows, it uses a device independent bit map. I
would much rather have a vector EPS file similar to the ones produced
using the DG postscript device.
Any and all advice would be greatly appreciated. Thanks in advance!
--
Jason Meyers
Ph.D. Student, Center for Imaging Science
Rochester Institute of Technology
jpm7934@rit.edu
|
|
|
|
|
|
Re: Object Graphics --> EPS Output how? [message #26783 is a reply to message #26732] |
Wed, 26 September 2001 19:39   |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
From: "David Fanning" <david@dfanning.com>
> Mark Hadfield (m.hadfield@niwa.cri.nz) writes:
>
>> Output destination & format is controlled through keywords to
>> the IDLgrClipboard::Draw method. To send EPS output to a file
>> the basic sequence of operations is
>>
>> myview = [Create & populate your IDLgrView here]
>> myclipbrd = obj_new('IDLgrClipBoard']
>> myclipbrd->Draw, /VECTOR, /POSTSCRIPT, FILENAME=...
>> obj_destroy, myclipbrd
>
> I just point out what is probably obvious: this
> produces PostScript output, not *encapsulated*
> PostScript output as was requested in the original
> post.
Well you'd think so, wouldn't you?
On my system (IDL 5.4, Windows 2000), the above commands generate a text
file which begins something like this...
%!PS-Adobe-2.0 EPSF-1.2
%%Title: Clipboard Image
%%Creator: IDL
%%BoundingBox: 0 0 344 344
gsave
...followed by a lot of Postscript commands ending with...
end
grestore
showpage
From my (admittedly limited) knowledge of Postscript this is a valid EPS
file. It has the required comment at the beginning and it has a Bounding Box
specification. If you give the file the extension ".eps" then it seems to
*behave* like an EPS file. It can be imported into MS Word (resulting in the
infamous plain box) and into LaTeX documents. When I open it with GSview
with the "EPS Warn" option turned on, there are no warnings (implying, I
think that GSview has found none of the operators forbidden to EPS files).
I have been treating these files as EPS for quite some time and never run
into any problems.
BTW, here are a couple of links with info about EPS
http://www-cdf.fnal.gov/offline/PostScript/AdobePS.html#EPS
http://www-cdf.fnal.gov/offline/PostScript/EPSF.ps
Section 5.3 of the latter has some handy info about the "showpage" command.
The presence of this command at the end of the file above means that it
produces output when sent straight to a printer. An application that
encapsulates an EPS file is expected to deactivate the showpage command
temporarily so that more than one of them can be displayed on a page.
---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research
--
Posted from clam.niwa.cri.nz [202.36.29.1]
via Mailgate.ORG Server - http://www.Mailgate.ORG
|
|
|
Re: Object Graphics --> EPS Output how? [message #26785 is a reply to message #26732] |
Wed, 26 September 2001 16:55   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Mark Hadfield (m.hadfield@niwa.cri.nz) writes:
> Output destination & format is controlled through keywords to the
> IDLgrClipboard::Draw method. To send EPS output to a file the basic sequence
> of operations is
>
> myview = [Create & populate your IDLgrView here]
> myclipbrd = obj_new('IDLgrClipBoard']
> myclipbrd->Draw, /VECTOR, /POSTSCRIPT, FILENAME=[your file name here]
> obj_destroy, myclipbrd
>
> The name "IDLgrClipboard" is a little confusing. It was originally intended
> only for output to the system clipboard, but then the IDL developers
> thought, "Hey, we could use this to write files too."
I just point out what is probably obvious: this
produces PostScript output, not *encapsulated*
PostScript output as was requested in the original
post.
To get encapsulated PostScript output, you have
to convert PostScript files somewhere other than in
IDL.
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
|
Re: Object Graphics --> EPS Output how? [message #26813 is a reply to message #26732] |
Wed, 26 September 2001 02:22   |
Martin Downing
Messages: 136 Registered: September 1998
|
Senior Member |
|
|
Hi Mark,
Ok I just gave it a go: RTFM, created EPS output to the clipboard - but what
do you do with it then?! Is there a method to write the clip board to file
directly?
I tried pasting the unformatted text to file and then reading that into
ghostview - but it was not at all impressed with my efforts! :(
Martin
"Mark Hadfield" <m.hadfield@niwa.cri.nz> wrote in message
news:003b01c1460e$1dae4050$d938a8c0@Hadfield...
> From: "Jason P. Meyers" <jpm7934@cis.rit.edu>
>> I am using IDL 5.3.1 on a Windows NT 4.0 platform. Does anyone know
>> of a way to output object graphics to an EPS file in this situation?
>> The help file indicates that the Unix version does this via the system
>> clipboard but under Windows, it uses a device independent bit map. I
>> would much rather have a vector EPS file similar to the ones produced
>> using the DG postscript device.
>
> You are probably being confused by the following paragraph in the
> documentation for the IDLgrClipboard device...
>
> "An IDLgrClipboard object will send Object Graphics output to the
operating
> system native clipboard in bitmap format. The format of bitmaps sent to
the
> clipboard is operating system dependent: output is stored as a PICT image
on
> the Macintosh, as a device-independent bitmap under Windows, and as an
> Encapsulated PostScript (EPS) image under UNIX and VMS."
>
> The fact is that, as of version 5.3, the IDLgrClipboard supports bitmap
*or*
> vector output, to the clipboard *or* a file. The formats supported are EPS
> (all platforms), WMF (Windows) and PICT (Macintosh).
>
> Look at the documentation for IDLgrClipboard::Draw, in particular the
VECTOR
> keyword.
>
> ---
> Mark Hadfield
> m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
> National Institute for Water and Atmospheric Research
>
>
>
> --
> Posted from clam.niwa.cri.nz [202.36.29.1]
> via Mailgate.ORG Server - http://www.Mailgate.ORG
|
|
|
|
Re: Object Graphics --> EPS Output how? [message #26842 is a reply to message #26732] |
Sun, 30 September 2001 15:00  |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
From: "Martin Downing" <martin.downing@ntlworld.com>
> I thought you had preset the Graphics_Tree property of the clipboard
> instance, eg using:
>
> myClipboard = obj_new('IDLgrClipBoard', GRAPHICS_TREE = myView)
> or:
> myClipboard->SetProperty, GRAPHICS_TREE = myView
That's charitable of you. Yes, that must have been what I meant...it wasn't
a mistake at all. Phew and here was I thinking that I had blemished my
record of 100% accurate posts to the newsgroup!
> However I have a feeling I'm about to find out why that is not a good
idea!
> (i.e. am I right in thinking that if you destroy the clipboard object
after
> attaching the view object then
> you lose that graphic object?)
Indeed. Whether that it a good thing or a bad thing depends on how you
structure your object applications. My usual practice is to build
object-graphics applications out of IDLgrWindow objects and attach each view
(or other graphics tree) to a window, using the window's GRAPHICS_TREE
property. This means, as you say, that in the normal course of events the
view will be destroyed when the window is closed. This is the most
convenient behaviour as it means I don't have to keep a separate reference
to the view and clean it up manually. When I want to direct output to a file
I create a temporary destination object (IDLgrBuffer, IDLgrClipboard,
IDLgrPrinter) as necessary and draw to it without setting its GRAPHICS_TREE.
But I'm sure there are other valid ways of doing things.
BTW if you want to see what my "usual practice" is for object graphics
applications you are welcome to take a look at my IDL library at
http://katipo.niwa.cri.nz/~hadfield/gust/software/idl/
---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research
--
Posted from clam.niwa.cri.nz [202.36.29.1]
via Mailgate.ORG Server - http://www.Mailgate.ORG
|
|
|
Re: Object Graphics --> EPS Output how? [message #26851 is a reply to message #26732] |
Fri, 28 September 2001 00:13  |
Martin Downing
Messages: 136 Registered: September 1998
|
Senior Member |
|
|
"Mark Hadfield" <m.hadfield@niwa.cri.nz> wrote in message
news:001401c1479c$fcf305e0$d938a8c0@Hadfield...
> From: "Mark Hadfield" <m.hadfield@niwa.cri.nz>
>> myview = [Create & populate your IDLgrView here]
>> myclipbrd = obj_new('IDLgrClipBoard']
>> myclipbrd->Draw, /VECTOR, /POSTSCRIPT, FILENAME=[your file name
here]
>> obj_destroy, myclipbrd
>
> I see that nobody spotted the deliberate mistake. That should be
>
> myclipbrd->Draw, myview, /VECTOR, /POSTSCRIPT, FILENAME=[your file
name
> here]
>
I thought you had preset the Graphics_Tree property of the clipboard
instance, eg using:
myClipboard = obj_new('IDLgrClipBoard', GRAPHICS_TREE = myView)
or:
myClipboard->SetProperty, GRAPHICS_TREE = myView
However I have a feeling I'm about to find out why that is not a good idea!
(i.e. am I right in thinking that if you destroy the clipboard object after
attaching the view object then
you lose that graphic object?)
Martin
|
|
|
Re: Object Graphics --> EPS Output how? [message #26854 is a reply to message #26732] |
Thu, 27 September 2001 19:28  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Mark Hadfield (m.hadfield@niwa.cri.nz) writes:
> I see that nobody spotted the deliberate mistake. That should be
>
> myclipbrd->Draw, myview, /VECTOR, /POSTSCRIPT, FILENAME=[your file name
> here]
Actually, I noticed it when I was implementing a
"Save As PostScript File" button for my FSC_Surface
program. But I had already reached my daily quota
of newsgroup posts fooling around with all that
sexual innuendo, so I couldn't post. :-(
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
|