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

Home » Public Forums » archive » post script printing
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: post script printing [message #4509 is a reply to message #4354] Wed, 14 June 1995 00:00 Go to previous messageGo to previous message
chase is currently offline  chase
Messages: 62
Registered: May 1993
Member
>>>> > "Keith" == Keith Horton <keith@guinness.pgd.hawaii.edu> writes:

Keith> I've never gotten the /PREVIEW switch to work in IDL 3.6.x
Keith> Does anyone know if it works in 4.0? Right now, I pull in
Keith> the IDL-generated EPS file to ghostscript to attach the preview.
Keith> Works well, but its a real pain having to go through multiple
Keith> steps to create the final graphic.

On the Macintosh a preview of an EPS file is a QuickDraw
representation stored as a PICT resource number 256 in the EPS file.
This is machine specific to the Macintosh. Postscript also provides
for a device-independent screen preview called encapsulated Postscript
interchange format (EPSI). (see the Postscript Language Reference
Manual).

Apparently, IDL uses the EPSI format when the PREVIEW keyword is used.
I do not know of any Mac applications that support the EPSI format.
In an idl.ps file generated with the PREVIEW keyword look for a line
like:

%%BeginPreview: 128 128 1 41

The parameters are: width height depth lines

In this example the preview is a 128x128 binary bitmap with 0 meaning
white and 1 meaning black. The previews that IDL generates are VERY
low resolution. They are also upside down from the Postscript
defintion for the preview.

Here is a routine that reads the EPSI preview from a postscript file
which can then be displayed in IDL using tvscl.

Chris Chase

---- begin file ----
function epsi_image, fn
;; Extract preview from an EPSI file fn and return an array containing
;; the preview.

on_ioerror, error
openr, un, fn, /get_lun
l = ''
map = bytarr(256)
map(byte('0123456789ABCDEF'))=bindgen(16)
readf, un, l
key = "%%BeginPreview:"

while strpos(l, key) ne 0 do readf, un, l

;; Get image parameters: width, height, depth, lines
;; depth can be 1,2,4,8
p = intarr(4)
reads, strmid(l, strlen(key), 256), p
;; Pixels are left to right, bottom to top.
;; IDL stores the image upside down from the Postscript defintion of
;; the Preview.

him = 0b
for i=0, p(3)-1 do begin
readf, un, l
him = [him, map(byte(strupcase(strmid(l, 1, 256))))]
endfor
free_lun, un
him = reform(him(1:*), 2, (n_elements(him)-1)/2)
him = him(0, *)*16B+him(1, *)
mask = byte(2^p(2)-1)
;; Image pixels per byte
bp = 8/p(2)
;; For each packed byte the left most pixel corresponds to the most
;; significant bits of the packed byte.
im = bytarr(bp, n_elements(him))
for i=0, bp-1 do begin
im(bp-i-1, *) = ishft(him and mask, -i*p(2))
mask = ishft(mask, p(2))
endfor
im = reform(im(0:p(0)*p(1)-1), p(0), p(1))
return, im
error:
print, 'Unable to find preview'
free_lun, un
return, 0
end

----- End file -----
--
===============================
Bldg 24-E188
The Applied Physics Laboratory
The Johns Hopkins University
Laurel, MD 20723-6099
(301)953-6000 x8529
chris.chase@jhuapl.edu
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Editing Ascii File
Next Topic: Input buffer limits

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

Current Time: Fri Oct 10 20:41:46 PDT 2025

Total time taken to generate the page: 2.55664 seconds