code: public void setImageMask(Image mask) throws DocumentException {
  		if (this.mask)
  			throw new DocumentException(
  					"An image mask cannot contain another image mask.");
  		if (!mask.mask)
  			throw new DocumentException(
  					"The image mask is not a mask. Did you do makeMask()?");
  		imageMask = mask;
  		smask = (mask.bpc > 1 && mask.bpc <= 8);
  	}
docs: Sets the explicit masking.
  
  @param mask
  the mask to be applied
  @throws DocumentException
  on error