ftp.nice.ch/peanuts/GeneralData/Usenet/news/1989/CSN-89.tar.gz#/comp-sys-next/1989/May-Jun/A-little-PostScript-hacking-for-NeXT-screens

This is A-little-PostScript-hacking-for-NeXT-screens in view mode; [Up]


Date: Sun 19-May-1989 14:38:47 From: Unknown Subject: A little PostScript hacking for NeXT screens I've been enjoying Scene in both 0.8 and 0.9. As I write this, my screen background is a photograph of a beach with palm trees... if I could only get the DSP to do steel drums... I've done a bit of hacking in PostScript to diddle with the brightness and contrast of images (in the sense of PostScript's "image" operator), and thought that others might be interested in similar diddling. To use this, change x and y to the dimensions of your image, and bits to the number of bits of grey scale (probably either 1 or 8). Brightness ranges from -1 to 1, with lower numbers being darker, and 0 applying no transformation at all to the image. Contrast is similar. Small positive values (ranging from 0.1 to 0.3) for both have given me the best results, especially for images that began life as color photos. Insert your bitmap (a Whole Big Bunch of hex numbers) at the appropriate place. Only caveat that I'm aware of is that if your bitmap doesn't have as many elements as you said it did, you may expect garbage to follow. %!PS-Adobe-1.0 %%BoundingBox: 0.000 0.000 512.000 480.000 % % Author: % Scott Deerwester, University of Chicago % Copyright: % You may freely copy this code, provided that a copy % of this notice is included with all copies. % /x 512 def % Number of columns /y 480 def % Number of rows /bits 8 def % Number of bits of grey scale /brightness 0.3 def /contrast 0.2 def /picstr x string def gsave x y scale { % Uncomment the following line if your image looks like a negative % 1 exch sub brightness 0 ne { dup brightness 0 gt { 1 exch sub } if 9 mul 1 add log brightness mul 1 brightness sub mul add } if contrast 0 ne { dup 360 mul sin contrast mul sub } if } settransfer x y bits [x 0 0 y neg 0 y] {currentfile picstr readhexstring pop} image % Insert your bitmap here grestore >From: moore@PULSAR.FAC.CS.CMU.EDU (Dale Moore)
Date: Sun 19-May-1989 21:00:15 From: Unknown Subject: Re: A little PostScript hacking for NeXT screens Bounding Box and Floating point numbers. Scott Deerwester recently sent a message to comp.sys.next, and comp.lang.postscript. The message contained a PostScript program. A portion of the message is below >Insert your bitmap (a Whole Big Bunch of hex numbers) at the >appropriate place. [text deleted] > >%!PS-Adobe-1.0 >%%BoundingBox: 0.000 0.000 512.000 480.000 >% According to the document structuring conventions, a bounding box is an orderd set of four "integers". Now, the above numbers certainly look like floating point numbers. And we all know that floating point numbers aren't integers. I don't mean to pick on Scott Deerwester. Alot of the PostScript stuff that comes from Next suffers the same problems. But I've a couple of utilities that look at such things as "%%BoundingBox" and I wonder if I should reject these things for not being formatted properly. If I should accept these floating point numbers, should I round 'em off or truncate 'em? See, the spec doesn't really say. Maybe what we need is a Document Structuring Convention and Encapsulated PostScript validation utility! It sure would save me few heated arguments. (No... My software's not busted yours is!) Dale Moore

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Marcel Waldvogel and Netfuture.ch.