[comp.lang.postscript] How to super-impose images ?

glenn@heaven.woodside.ca.us (Glenn Reid) (07/25/90)

In article <31377@eerie.acsu.Buffalo.EDU> cchang@acsu.buffalo.edu writes:
>But instead of getting the desired result, our second image 
>completely overwrites the first one.  Does anyone know how 
>to do an OR operation on two images ?  

There is no "OR" operation in PostScript, but you can probably get
the result you want by using the "imagemask" operator instead of
the "image" operator.  This operator only writes the bits that
correspond to the mask you specify, which sounds like what you want.
However, it doesn't support gray-scale images, only black and white.
But that doesn't sound like a problem in your case.

/Glenn

-- 
 Glenn Reid				PostScript/NeXT consultant
 glenn@heaven.woodside.ca.us		Independent Software Developer
 ..{adobe,next}!heaven!glenn		415-851-1785

woody@chinacat.Unicom.COM (Woody Baker @ Eagle Signal) (07/25/90)

In article <31377@eerie.acsu.Buffalo.EDU>, cchang@acsu.buffalo.edu writes:
> Please help !   We'd like to super-impose two image files.
> The codes are as following.  The image files are sparse with 
> a lot of white space.  The purpose for super-imposing is to 
> study the shifting of balck patterns in these two images.
> 
> But instead of getting the desired result, our second image 
> completely overwrites the first one.  Does anyone know how 
> to do an OR operation on two images ?  
> 
> Please post or send e-mail.  Thank you. 
> 
> p.s. May be some other netlanders will be interested in other logical
>      operations, such as AND, XOR.  So please post if you have a 
>      general solution.


Adobe uses an opaque imaging model.  That is each layer obscures the
layer underneath it.  There is no way to do AND, XOR, or OR operations.
I think that was a mistake.  I can see the point, however, when you
think about a FILM printer that does not use a memory map, but rather
uses the exposed film to store the image.  It would be impossible to
do an AND or XOR, but not an OR.  Now, the majority of the Postscript
machines are bitmapped lasers.  I think it should be allowed.  It is
one of the items on my list of things to write cexec's for...one of
these days, when I get the process down a bit better.....

Cheers
Woody

cosell@bbn.com (Bernie Cosell) (07/25/90)

woody@chinacat.Unicom.COM (Woody Baker @ Eagle Signal) writes:


}Adobe uses an opaque imaging model.  That is each layer obscures the
}layer underneath it.  There is no way to do AND, XOR, or OR operations.
}I think that was a mistake.  I can see the point, however, when you
}think about a FILM printer that does not use a memory map, but rather
}uses the exposed film to store the image.

Whatever the reason might be, this isn't it: since you can overlay previously
blackened pixels with white pixels, imaging directly to film cannot work.

}I think it should be allowed. ...

I agree.  MOre to the point, I think that the contents of the imaging area
should be generally available to be operated on.  There's no reason I can see
why things like finding the current bounding box or cutting and pasting the
image area shouldn't just work...

  /Bernie\