🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #562

Re: PostScript xor of two images wanted

#562
From: Berthold K.P. Horn
Date: Fri, 17 Apr 1992 11:32
38 lines
2218 bytes
In article <belonis.703485754@dirac> belonis@phys.washington.edu (Jim Belonis) writes:

   I would like to xor two images in PostScript.

   I have a black-and-white high-contrast version of a person's portrait
   available as a PostScript file using the image operator.
   I have an asc2ps conversion of a text file to PostScript.

   I would like to xor the two images on a LaserWriter II NTX
   in such a way that the text is black in the white areas 
   and black in the white areas of the portrait.
   This is intended to generate a wallet-sized ASCII chart so I have been
   using a small 6-point font.

   I can find nothing similar in the PostScript books or in Real World PostScript
   nor in the examples I have collected over the years from Usenet.

   I have tried various methods of pbmplus and ghostscript
   manipulations before sending
   the final image to the PostScript printer, but have troubles with
   illegible fonts resulting due to the distortions caused by shrinking.
   I would think this could be done cleaner and simpler by combining the images
   in the printer itself.

   I would appreciate it if someone would provide example code that
   combines images with an xor function.

Since PS uses the opaque imaging model, it cannot directly provide for
XOR-mode combination of something already images and a new sub-image. So:

Your best bet might be to use the outline of the silhouette as a clipping
region. First set it it up to clip everything inside, then show text
normally. Next set up the clipping region to clip everything outside, paint
a background black, setgray to 1.0, and write the text a second time.

Berthold K.P. Horn
Cambridge, Massachusetts, USA
Technical Details
Message-ID: <23402@life.ai.mit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!snorkelwacker.mit.edu!ai-lab!wheat-chex!bkph
References: <belonis.703485754@dirac>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!snorkelwacker.mit.edu!ai-lab!wheat-chex!bkph
From: bkph@wheat-chex.ai.mit.edu (Berthold K.P. Horn)
Newsgroups: comp.lang.postscript
Subject: Re: PostScript xor of two images wanted
Message-ID: <23402@life.ai.mit.edu>
Date: 17 Apr 92 11:32:03 GMT
Article-I.D.: life.23402
References: <belonis.703485754@dirac>
Sender: news@ai.mit.edu
Distribution: na
Lines: 38
In-reply-to: belonis@phys.washington.edu's message of 17 Apr 92 04:42:34 GMT