r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Postscript] Emitting Postscript from REBOL

Graham
6-Apr-2006
[95x3]
and I printed out my postscript file with no problems.
jetdirect print servers use 9100 for data, and 80 for the embedded 
webserver.
That was pretty easy ... create the postscript  file, and send it 
directly to the printer, or print server.
Henrik
6-Apr-2006
[98]
precisely
Graham
6-Apr-2006
[99x3]
I wonder if we should use an existing dialect and modify it to product 
ps .. or create one from scratch.
Should we use pair! or not ?
moveto 72x72, or moveto 72 72 
postscript is RPN, so that looks like 72 72 moveto
Henrik
6-Apr-2006
[102]
what about starting from the DRAW dialect?
Graham
6-Apr-2006
[103]
I guess if the main aim is to take drawings to postscript, then that 
makes sense.
Henrik
6-Apr-2006
[104]
the fastest route definitely. a PS -> DRAW thing would be a nice 
thing to have but DRAW -> PS is the most important right now
Graham
6-Apr-2006
[105x2]
So, for example, if we used to plot dialect to draw a graph, we can 
then emit postscript and send directly to the printer.
used the Plot dialect ..
Henrik
6-Apr-2006
[107]
yes, I think it should work like the DRAW function, but instead of 
producing an image it produces a string! value to be used however 
you want it
Graham
6-Apr-2006
[108x3]
String! is good.
Or, perhap a block! for further processing?
Say you wanted to insert an eps file into your output.
Henrik
6-Apr-2006
[111]
not sure about the mechanism yet, but maybe yes
Graham
6-Apr-2006
[112]
An eps file is just a postscript file which is written in a special 
way ...
Henrik
6-Apr-2006
[113]
there is no paper information AFAIK
Graham
6-Apr-2006
[114x2]
In the name of science, I repeated the above test and it printed 
out again.
I also tried it with a pdf, as the printer supports direct pdf printing, 
but nothing happened.
Henrik
6-Apr-2006
[116]
interesting. tried different pdfs?
Graham
6-Apr-2006
[117]
Not yet.
Geomol
7-Apr-2006
[118x4]
DRAW -> PS is one possibility. Should we on a longer term also have 
a dialect or set of functions, than can produce PS?
that
DRAW is also a function used like:
img: make image! 100x100
DRAW img <some draw commands>

With PostScript, I'm thinking something like:
ps-output: ""
POSTSCRIPT ps-output <some PS commands>


ps-output could then also be a file! or port! and send the output 
directly to the destination.
<some PS commands> in the above is a block of commands with arguments.
Graham
7-Apr-2006
[122]
Is the aim to take a draw block and process it so that postscript 
is produced.
Geomol
7-Apr-2006
[123x2]
That's what I understood from Henrik's posts.
It's one way of doing it, and maybe not so bad. I don't know enough 
about PS to see, if DRAW is too limited. Maybe PS has a lot other 
stuff, you wanna do, that is difficult to do in DRAW.
Graham
7-Apr-2006
[125x2]
as far as I recall, it has quite a limited command set.
of course, you can define new functions within ps.
Geomol
7-Apr-2006
[127x2]
The DRAW approach is, that if you can produce your output in a DRAW 
block, then you can also print it using PS. My approach is to make 
a PS dialect, and keep DRAW out of is. With my approach, you can 
print from REBOL/Core too. I guess, we can have both approaches without 
problem.
And both will be usefull for different situations.
Graham
7-Apr-2006
[129]
but using a draw dialect is possible in core .. u just can't render 
it.
Geomol
7-Apr-2006
[130]
Oh, you're right. :-)
Graham
7-Apr-2006
[131x2]
but let's start with a postscript dialect and then see if we can 
retrofit draw to it.
that way we are not constrained by draw.
Geomol
7-Apr-2006
[133]
Then I just need a list of PS commands to get started on the dialect.
Graham
7-Apr-2006
[134x3]
since rebol3 is coming, and View may well change, it makes less sense 
to stick to the past.
this has a reference at the end : http://www.cs.indiana.edu/docproject/programming/postscript/postscript.html
Is this works, you can then render your paint images to postscript 
printers :)
Geomol
7-Apr-2006
[137]
Is it the "Index of Operators" in the link, you gave?
Graham
7-Apr-2006
[138]
yes.
Geomol
7-Apr-2006
[139]
add, arc, ...translate
Graham
7-Apr-2006
[140x5]
yes.
pen red
            line 30x30 50x20 70x70 40x50
newpath
	1 0 0 setrgbcolor
	30 30 moveto
	50 20 lineto
	70 70 lineto
	40 50 lineto
	stroke
pen blue
            box 20x20 80x80
newpath
	0 0 1 setrgbcolor
	20 20 moveto
	60 0 rlineto
	0 60 rlineto
	-60 0 rlineto
	closepath stroke