home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.postscript
- Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!umn.edu!femto!cahoon
- From: cahoon@femto.cs.umn.edu (Forrest Clinton Cahoon)
- Subject: problem manipulating binary data in postscript
- Message-ID: <1992Dec28.171257.27785@news2.cis.umn.edu>
- Sender: news@news2.cis.umn.edu (Usenet News Administration)
- Nntp-Posting-Host: femto.cs.umn.edu
- Organization: University of Minnesota, Minneapolis, CSci dept.
- Date: Mon, 28 Dec 1992 17:12:57 GMT
- Lines: 22
-
- I'm trying to write some postscript which will color a hexagonal grid,
- reading the color data from the end of my ps file. I'm reading one
- byte for each hexagon, then doing some bit-twiddling to get values to call
- setrgbcolor with before filling the hexagon.
-
- I've got a version using "read" which works, but since "read" treats my
- newline characters as valid binary data, it's not entirely
- satisfactory.
-
- What I want to use is "readhexstring", but since what this reads in is
- treated as a string rather than an integer, I'm having trouble. I
- need to convert my one-byte string into an integer having the same
- binary representation. I don't want "cvi", because this parses a
- string which represents an integer to us humans, and puts that value
- on the stack -- cvi would read (1) and put the integer value 1 on the
- stack, but what I need would take (1) and put the integer value 49 --
- the ASCII value of the character 1 -- on the stack.
-
- --
- | Forrest Cahoon | cahoon@cs.umn.edu |------------------------------|
- | 850 21st Ave SE |-------------------| Only unbalanced people |
- | Mpls MN 55414-2514 | | can tip the scales... |
-