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)
|