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

World: r3wp

[Postscript] Emitting Postscript from REBOL

Henrik
10-Apr-2007
[1352]
I haven't figured out how MATRIX works
Geomol
10-Apr-2007
[1353x5]
Yeah, it's a bit tricky. There's a link in the DRAW docs to: http://www.w3.org/TR/SVG/coords.html#EstablishingANewUserSpace
where you might get some explanation.
It's about vector algebra.
Short explanation: matrix [1 0 0 1 0 0]
is neutral and doesn't do anything.
matrix [1 0 0 1.5 0 0]
scale the y-direction by 1.5.
matrix [1 0 0 1 100 0]
translate in the x-direction by 100 pixels.
So the most basic stuff (scaling and moving) goes like this:
matrix [scale-x 0 0 scale-y move-x move-y]
Result depend on what you put in those 4 positions.
Henrik
10-Apr-2007
[1358]
I see, though I'm not sure what advantage this gives. Is it because 
it's fast?
Geomol
10-Apr-2007
[1359x5]
The last 2 zeros are used for the SKEW effects.
It's just a general way of combining different effects.
If you wanna do more than one transformation, they can be combined 
into one matrix command.
So yes, it might be faster, if you have lots of transformations going 
on.
I gotta go reading some stuff, examination tomorrow. Have fun with 
your postscript! :-) I'm looking forward to see some good results.
Henrik
10-Apr-2007
[1364]
good luck :-)
Geomol
10-Apr-2007
[1365]
thanks
Geomol
23-Feb-2008
[1366]
Does anyone have experience with PageSize in PostScript? Typical 
ps files have something like this in the setup part:

%%BeginFeature: *PageSize A4

    <</PageSize [595 842] /ImagingBBox null>> setpagedevice
%%EndFeature
Henrik
23-Feb-2008
[1367x2]
I messed around with it a bit to get it to print on A5 sheets, but 
ended up just drawing on the A5 area.
geomol, are you planning updates to postscript.r?
Geomol
23-Feb-2008
[1369x2]
Yes, if it's a good idea to put pagesize in there. I did a test and 
missed some lines in the top of my document, when producing ps output.
Are there anything special, you need in postscript.r?
Henrik
23-Feb-2008
[1371x3]
I was afraid of messing with it, since only a single error, such 
as leaving a standard postscript command out or putting another one 
in, caused some printers to stop working with it.
There is a bug with printing multiple pages on certain HP printers. 
After the first page, some char is missing, that causes it to wait 
until you press the Online button or page feed button. I really would 
like that to be fixed. The work-around is to print to a file and 
have it printed using Printfile under Windows.
And I also badly need bitmap support :-)
Geomol
23-Feb-2008
[1374]
Ok, I try to stick to the standard and keep things simple.
Henrik
23-Feb-2008
[1375]
well, I tried standard commands, but it seems that printers and postscript 
is like HTML and webbrowsers, unfortunately.
Geomol
23-Feb-2008
[1376]
damn
Henrik
23-Feb-2008
[1377]
it would be wise to look at demo postscript files from around the 
net and see what they do. try to print them on various printers.
Geomol
23-Feb-2008
[1378]
When you had problem, did you try changing the %%Pages and %%Page 
lines in the ps-doc?
Henrik
23-Feb-2008
[1379]
had very limited time to test and don't remember
Geomol
23-Feb-2008
[1380]
ok
Henrik
23-Feb-2008
[1381x2]
it was a panic situation .:-)
furthermore, when printing with LP under OSX, produces different 
margins and scales than LP under Linux. so that's fun.
Geomol
23-Feb-2008
[1383x2]
Added PageSize and images to the PostScript dialect. There seem to 
be a problem with jpg!?
Henrik, try this:

do http://home.tiscali.dk/john.niclasen/postscript/postscript.r

write %imagetest.ps postscript [page [translate 100 600 scale 72 
72 image logo.gif translate 100 500 scale 144 144 image logo.gif 
translate 100 300 scale 288 288 image logo.gif]]

Then view or print the file imagetest.ps
This gives a result, that I can't view on my Mac for some reason:


write %imagetest.ps postscript [page [translate 100 400 scale 72 
72 image http://www.rebol.com/view/palms.jpg]]

Any suggestions?
Henrik
23-Feb-2008
[1385x4]
preview.app is unfortunately also half demented :-(
ghostscript is better to reference against
and I can't test right now as I don't have the printer set up
I will test as soon as possible
Geomol
23-Feb-2008
[1389]
I have problem viewing the test with jpg here. It can't convert it 
to a viewing format (prob. PDF). Can you test the ghostscript viewer?
Henrik
23-Feb-2008
[1390]
will take 30 mins to set up. hang on.
Geomol
23-Feb-2008
[1391]
Documentation is here:
http://home.tiscali.dk/john.niclasen/postscript/postscript.html
Henrik
23-Feb-2008
[1392]
any image formats that you've tested that works?
Geomol
23-Feb-2008
[1393]
gif and bmp
Henrik
23-Feb-2008
[1394]
so it converts it to image! before feeding it to postscript dialect?
Geomol
23-Feb-2008
[1395]
Hm, maybe it has something to do with the size of the image. I saved 
logo.gif as %logo.bmp and it works. If I save that palms.jpg as %palms.bmp, 
it doesn't work.
Henrik
23-Feb-2008
[1396]
afk, 30 mins
Geomol
23-Feb-2008
[1397x2]
Yes, images are handled as REBOL image! types. If the dialect is 
given a file! or url!, it'll load the image. It can also take a word!, 
which is the image. It then convert the image/rgb to base-16 and 
put it in the ps-file.
So images in postscript files take up a lot of space! Most people 
knows this already. I tried to put a 100k png image in a postscript 
file, and it then was > 11MB.
Henrik
23-Feb-2008
[1399x2]
wow
what about 2-colored GIFs?
Graham
23-Feb-2008
[1401]
I"ve always converted images to eps before including them. Never 
used raw image data.