comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL postscript graphics
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL postscript graphics [message #45748] Fri, 07 October 2005 15:42 Go to next message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
hi everyone,

i am trying to print a 3D image in postscript format. I used to get the
image and print the image into ps just the way i would print it as jpeg.
but i found the quality is not good at all. Dr. Fanning suggested to use
IDLgrClipboard and i am using the following code (most of the code were
continued on from previous programmer):

name=getinput('Enter File Name')
file=dialog_pickfile(title='please select a directory',/directory)
IF file EQ '' THEN RETURN

; Reconstruct the color table:
TVLCT, r,g,b, /GET

filename = file + name + '.ps'

!P.FONT=0

; Set the plotting device to PostScript:
SET_PLOT, 'ps'

DEVICE, /TIMES, FONT_INDEX=3
DEVICE, /SYMBOL, FONT_INDEX=7

DEVICE, file=filename, BITS_PER_PIXEL=8, /COLOR

LOADCT, 0

clipboard = Obj_New("IDLgrClipboard", Dimensions=[4,3], Units=1, $
Resolution=[2.54/300., 2.54/300.])
clipboard->Draw, sState.oView, Filename=filename, /PostScript, /Vector
Obj_Destroy, clipboard

; Close the file:
DEVICE, /CLOSE
set_plot,'win'

however i found in the resulting ps file, the image is a white plane.
there is no color at all. i tried to play with the colortable and found no
solution. does anyone know why? I appreciate your time and patience.
Re: IDL postscript graphics [message #45877 is a reply to message #45748] Mon, 10 October 2005 08:32 Go to previous message
Karl Schultz is currently offline  Karl Schultz
Messages: 341
Registered: October 1999
Senior Member
On Mon, 10 Oct 2005 01:35:02 -0400, IDLmastertobe wrote:

> Thanks for your reply mark, i changed the code to yours. It it a lot
> cleaner, but it is still a white plane without any color like before. i
> am not sure if it is because something wrong with sState.oView, but i have
> not found any obvious errors yet. Is there anything that is potentially
> blocking the image from porting out?

I hope that I'm not missing something or am being too obvious, but is
there actually anything in sState.oView? Unless there is a lot of code
behind the scenes someplace that is creating an IDLgrView along with the
rest of the scene objects and putting the IDLgrView object reference in
sState.oView, then IDL is just going to draw an empty scene!!!!
Re: IDL postscript graphics [message #45882 is a reply to message #45748] Mon, 10 October 2005 06:16 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
IDLmastertobe writes:

> Thanks for your reply mark, i changed the code to yours. It it a lot
> cleaner, but it is still a white plane without any color like before. i
> am not sure if it is because something wrong with sState.oView, but i have
> not found any obvious errors yet. Is there anything that is potentially
> blocking the image from porting out?

Given that we now have everything over into object graphics,
I think the problem isn't that the image is not being displayed,
but that it is being displayed too well. Most of the time, in
object graphics, one's first attempt at displaying an image
results in a black window. This is not an empty window, it is
a single image pixel, blown up very, very large. The problem
is that the user forgot to scale the image object into the
coordinate system of the view object. (If you haven't learned
this yet, the object graphics system is VERY low level. You
have to do *everything* yourself.)

When Mark said that the code "could work", he knew as well
as I did that the chances were very, very small, given what
we know about your specific problem. But, at the very least
you are going to have to match the DIMENSIONS and UNITS of
your view object in the clipboard object if you are going to see
output that looks anything like what you see in your
display window.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: IDL postscript graphics [message #45886 is a reply to message #45748] Sun, 09 October 2005 22:35 Go to previous message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
Thanks for your reply mark, i changed the code to yours. It it a lot
cleaner, but it is still a white plane without any color like before. i
am not sure if it is because something wrong with sState.oView, but i have
not found any obvious errors yet. Is there anything that is potentially
blocking the image from porting out?
Re: IDL postscript graphics [message #45888 is a reply to message #45748] Sun, 09 October 2005 19:16 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
IDLmastertobe wrote:
> hi everyone,
>
> i am trying to print a 3D image in postscript format. I used to get the
> image and print the image into ps just the way i would print it as jpeg.
> but i found the quality is not good at all. Dr. Fanning suggested to use
> IDLgrClipboard and i am using the following code (most of the code were
> continued on from previous programmer):
>
> name=getinput('Enter File Name')
> file=dialog_pickfile(title='please select a directory',/directory)
> IF file EQ '' THEN RETURN
>
> ; Reconstruct the color table:
> TVLCT, r,g,b, /GET
>
> filename = file + name + '.ps'
>
> !P.FONT=0
>
> ; Set the plotting device to PostScript:
> SET_PLOT, 'ps'
>
> DEVICE, /TIMES, FONT_INDEX=3
> DEVICE, /SYMBOL, FONT_INDEX=7
>
> DEVICE, file=filename, BITS_PER_PIXEL=8, /COLOR
>
> LOADCT, 0
>
> clipboard = Obj_New("IDLgrClipboard", Dimensions=[4,3], Units=1, $
> Resolution=[2.54/300., 2.54/300.])
> clipboard->Draw, sState.oView, Filename=filename, /PostScript, /Vector
> Obj_Destroy, clipboard
>
> ; Close the file:
> DEVICE, /CLOSE
> set_plot,'win'
>
> however i found in the resulting ps file, the image is a white plane.
> there is no color at all. i tried to play with the colortable and found no
> solution. does anyone know why? I appreciate your time and patience.

The problem is that you are using two completely different graphics
systems (Direct Graphics and Object Graphics) to write to the same file.
Not a goood idea.

A second, minor, issue is that your code for selecting the file name is
a little klunky. The IDL function DIALOG_PICKFILE lets the user select
the file name and directory in one operation

Try replacing the above with

filename = dialog_pickfile(/WRITE, FILTER='*.eps')
if strlen(filename) gt 0 then begin
clipboard = Obj_New("IDLgrClipboard", Dimensions=[4,3], Units=1, $
Resolution=[2.54/300., 2.54/300.])
clipboard->Draw, sState.oView, Filename=filename, $
/PostScript, /Vector
Obj_Destroy, clipboard
endif

I don't guarantee this will work, because I can't vouch for the code
written by the "previous programmer", but at least it *could* work,
which is an improvement :-)


--
Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Stackplot without axis?
Next Topic: Fourier Transform when intervals are not uniform

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:13:16 PDT 2025

Total time taken to generate the page: 0.00720 seconds