home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 20
/
AACD20.BIN
/
AACD
/
Graphics
/
PerfectPaint
/
rexx
/
general
/
LoadPS.rx
< prev
next >
Wrap
Text File
|
2001-01-11
|
3KB
|
179 lines
/* Load PS Picture
using GhostScript
From Aminet:
You need these:
gfx/show GS510-data.lha 326K 73 GS5.10 Data-init-config files
gfx/show GS510-stdfonts.lha 1.5M 73 GS5.10 fonts-std files
text/dtp GS510FontMap.lha 5K 62 GS5.10's missing fontmap file
One of the following, depending on your processor:
gfx/show GS510_020.lha 537K 73 GS5.10-4-020-030-EC040-Amigas
gfx/show GS510_020fpu.lha 518K 73 GS5.10-4-020fpu-030fpu-Amigas
gfx/show GS510_040fpu.lha 520K 73 GS5.10-4-040fpu-Amigas
Optional - but probably worth getting:
text/dtp GS510-Install.lha 15K 32 GS5.10-Installation-Routine (V1.02)
gfx/show GS510-fontsoth.lha 798K 73 GS5.10 fonts-other files
*/
options results
parse ARG Port b
ADDRESS value Port
pp_showscreen
pp_GetDepth
n=result
if n~=24 then DO
pp_Warn 'Only*for*24bits*version.'
EXIT
END
ADDRESS COMMAND
if ~EXISTS('ghostscript:gs') THEN DO
ADDRESS value Port
pp_closeasay
pp_Warn 'Please|Install*Ghostscript*first.'
EXIT
END
file=''
path='Ghostscript:gs'
width=320
height=256
if EXISTS('PerfectPaint:Prefs/Rexx_Prefs/LoadPS') THEN DO
IF OPEN('lfile','PerfectPaint:Prefs/Rexx_Prefs/LoadPS', "R") then DO
file = READLN('lfile')
path = READLN('lfile')
width = READLN('lfile')
height = READLN('lfile')
CALL CLOSE('lfile')
file2=""
do i=1 to LENGTH(file)
a=SUBSTR(file,i,1)
if a=" " then DO
a="*"
END
file2=file2||a
END
file=file2
END
END
IF width=0|height=0|path='' then DO
path='Ghostscript:gs'
width=320
height=256
END
ADDRESS value Port
pp_DialogInit 250 123 "*Load*Postscript" 5
pp_String 0 50 8 150 16 "Path" 1 100 path
pp_String 1 50 30 150 16 "Name" 1 100 file
n=LASTPOS('/',file)
if n=0 then DO
n=LASTPOS(':',file)
file=SUBSTR(file,1,n)
END
else DO
file=SUBSTR(file,1,n)
END
pp_Getfile 2 205 31 1 "Load*PS" 0 file
pp_integer 3 50 52 70 16 "Width" 1 width
pp_integer 4 50 70 70 16 "Height" 1 height
pp_Dialog
rc=result
if rc=0 then
do
EXIT
end
pp_GetDialog 1
file=result
pp_GetDialog 0
path=result
pp_GetDialog 3
width=result
pp_GetDialog 4
height=result
if file="" then
do
EXIT
end
CALL SavePrefs('LoadPS',file,path,width,height)
ADDRESS value Port
pp_asay 'Loading*PS*file|Please*wait*...'
storescript='ram:Ghostscript.script'
Xdpi=(72*width)/612
Ydpi=(72*height)/792
if Xdpi>Ydpi then DO
Xdpi=trunc(Ydpi,0)
Ydpi=Xdpi
END
ELSE DO
Ydpi=trunc(Xdpi,0)
Xdpi=Ydpi
END
IF OPEN('pfile',storescript,'W') THEN DO
CALL WRITELN('pfile','stack 150000')
Line=path||' >con:120/20/400/200/GhostScript/SCREEN'||Port
Line=Line||' -r'||Xdpi||' -g'||width||'x'||height||' -dNOPAUSE -dBATCH -sDEVICE=ppmraw -sOutputFile=ram:temp.ppm '
Line=Line||'"'||file||'"'||' -c'
CALL WRITELN('pfile',Line)
CALL CLOSE('pfile')
END
ADDRESS COMMAND 'execute ram:Ghostscript.script'
ADDRESS value Port
pp_closeasay
pp_load 'ram:temp.ppm'
ADDRESS COMMAND
'delete >nil: ram:temp.ppm'
'delete >nil: ram:Ghostscript.script'
EXIT
SavePrefs: PROCEDURE
Prefname='PerfectPaint:Prefs/Rexx_Prefs/'||ARG(1)
if EXISTS(Prefname) THEN DO
ADDRESS COMMAND
'delete >nil: '||Prefname
END
IF OPEN('pfile',PrefName,'W') THEN DO
do i=2 to ARG()
CALL WRITELN('pfile',ARG(i))
end
CALL CLOSE('pfile')
RETURN