Using Postscript for creating images (was: Re: POV-Ray license)

David Kuehling dvdkhlng at gmx.de
Sat Jan 22 05:16:04 EST 2011


Hi,

here is a simple example for how to use Postscript to generate images
algorithmically:

--8<--

/house {
    newpath
    200 0   moveto
    0   0   lineto
    200 200 lineto
    100 300 lineto
    0   200 lineto
    200 200 lineto
    200 0   lineto
    0   200 lineto
    0   0   lineto
    closepath stroke
} def

/red {   1.0 0.0 0.0 setrgbcolor } def
/green { 0.0 1.0 0.0 setrgbcolor } def
/grey  { 0.5 setgray } def

10 10 translate     red      house 
300 200 translate   green    house
-150 100 translate  
0.5 0.5 scale       grey     house
--8<--

Just save that into a .ps file, then you can just view it with any
Linux document viewer (evince, gv, whatever).  On the nanonote 'fbgs'
should be able to view that file, however 'fbgs' needs ghostscript and
thus fails.

Here is how the image should look like as an image (converted using the
imagemagick 'convert' command):

http://mosquito.dyndns.tv/david/nanonote/test.png

Note that 'evince' seems to need an empty line at the top of the file to
correctly identify it as a postscript file.

cheers,

David


>>>>> "David" == David Kuehling <dvdkhlng at gmx.de> writes:

>> On 01/13/2011 06:32 PM, David Kuehling wrote:
>>>>>>>> "Jane" == Jane Andreas <JaneAndreas at gmx.com> writes:
>>> 
>>>> I would be more interested at this point in finding a 2d graphics
>>>> program that could generate objects based on
>>>> equations/descriptions.
>>> 
>>> What about PostScript?  It is actually very usuable for this sort of
>>> thing, if you except the RPN syntax.
>>> 
>>> https://secure.wikimedia.org/wikipedia/en/wiki/PostScript
> [..]

>>>>> "Xiangfu" == Xiangfu Liu <xiangfu at sharism.cc> writes:

>> do you mean this package:

>> (ALL commands run under 2010-12-14) openwrt-xburst$ ./scripts/feeds
>> search GhostScript Search results in feed 'qipackages': ghostscript
>> interpreter for the PostScript language and for PDF

>> 1. it doesn't worked out of box.  root at BenNanoNote:~# gs gs: can't
>> load library 'libcupsimage.so.2'

>> 2. then I try install: root at BenNanoNote:/usr/lib# opkg install cups
>> Installing cups (1.4.4-1) to root...  Downloading
>> http://fidelio.qi-hardware.com/~xiangfu/compile-log/image-all_packages-01172011-2200/packages//cups_1.4.4-1_xburst.ipk.

>> 3. just input 'gs' (don't know how to use it), I got:
>> root at BenNanoNote:/usr/lib# gs Segmentation fault

> Hmm, need to make our own Ghostscript package.

> BTW we already have a (PDF?) document reader for the NN, don't we?
> Maybe that program also supports postscript files out of the box?

> David -- GnuPG public key:
> http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg Fingerprint: B17A DC95
> D293 657B 4205 D016 7DEF 5323 C174 7D40

> _______________________________________________ Qi Hardware Discussion
> List Mail to list (members only): discussion at lists.en.qi-hardware.com
> Subscribe or Unsubscribe:
> http://lists.en.qi-hardware.com/mailman/listinfo/discussion

-- 
GnuPG public key: http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg
Fingerprint: B17A DC95 D293 657B 4205  D016 7DEF 5323 C174 7D40
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.en.qi-hardware.com/pipermail/discussion/attachments/20110122/4f7f8d61/attachment.pgp>


More information about the discussion mailing list


interactive