You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xmlgraphics.apache.org by Thomas Maier <Th...@uni-kassel.de> on 2006/05/27 18:30:53 UTC

EPSDocumentGraphics2D: bitmap graphics has black background

Hi all,

just another one with EPSDocumentGraphics2D.  Generating text and lines
works fine.  However, when I render non-rectangular bitmap graphics with
transparent areas into my document, the bitmap shows fine but with black
areas where it should be white (paper).  Is this because PS does not
support transparency?  But why is it black, then?  White would at least
not strike the eye as much :).  What can I do about that?

Thanks in advance, Thomas.


---------------------------------------------------------------------
Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


Re: EPSDocumentGraphics2D: bitmap graphics has black background

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
EPSDocumentGraphics2D descends from PSGraphics2D which implements the
basic PostScript generation for the Graphics2D interface. PSGraphics2D
delegates to PSImageUtils to actually render bitmap images to PostScript.
PSImageUtils will need to be extended to handle RenderedImage instances with
an alpha channel. I assume ImageType 3 (explicit mask) or 4 (color key
mask) has to be used but I haven't investigated closer. Anyway, it seems
like PostScript does not support images with an alpha channel (soft mask),
only stencil masks (1-bit). But I could be wrong. But if you convert a
PDF with an image that has a soft mask to PostScript, Acrobat
precombines the image with the background. So either a soft mask is
converted to a stencil mask (and this losing quality) or the image needs
to be precombined with the effective background which basically means to
paint an off-screen copy of the whole document. Ouch.

PS spec:
http://partners.adobe.com/public/developer/ps/index_specs.html

On 30.05.2006 14:03:03 Thomas Maier wrote:
> A patch for PostScript? ;)  Well, I guess I'll check the render pipe a
> bit earlier :).  Might you give me a few pointers to methods I should
> look at, please?  (In my last mail I described how I am using
> EPSDocumentGraphics2D.)
> 
> Thanks in advance, Thomas.
> 
> Am Montag, den 29.05.2006, 15:31 +0200 schrieb Jeremias Maerki:
> > Yes, I assume this has to do with missing support for transparency. The
> > color for the background color is arbitrary. It could be green.
> > PSGraphics2D has no influence on this. You need to check if you can get
> > the producer of the bitmap to use a white background. Or implement
> > transparency support and send a patch. :-)
> > 
> > On 27.05.2006 18:30:53 Thomas Maier wrote:
> > > Hi all,
> > > 
> > > just another one with EPSDocumentGraphics2D.  Generating text and lines
> > > works fine.  However, when I render non-rectangular bitmap graphics with
> > > transparent areas into my document, the bitmap shows fine but with black
> > > areas where it should be white (paper).  Is this because PS does not
> > > support transparency?  But why is it black, then?  White would at least
> > > not strike the eye as much :).  What can I do about that?


Jeremias Maerki


---------------------------------------------------------------------
Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


Re: EPSDocumentGraphics2D: bitmap graphics has black background

Posted by Thomas Maier <Th...@uni-kassel.de>.
A patch for PostScript? ;)  Well, I guess I'll check the render pipe a
bit earlier :).  Might you give me a few pointers to methods I should
look at, please?  (In my last mail I described how I am using
EPSDocumentGraphics2D.)

Thanks in advance, Thomas.

Am Montag, den 29.05.2006, 15:31 +0200 schrieb Jeremias Maerki:
> Yes, I assume this has to do with missing support for transparency. The
> color for the background color is arbitrary. It could be green.
> PSGraphics2D has no influence on this. You need to check if you can get
> the producer of the bitmap to use a white background. Or implement
> transparency support and send a patch. :-)
> 
> On 27.05.2006 18:30:53 Thomas Maier wrote:
> > Hi all,
> > 
> > just another one with EPSDocumentGraphics2D.  Generating text and lines
> > works fine.  However, when I render non-rectangular bitmap graphics with
> > transparent areas into my document, the bitmap shows fine but with black
> > areas where it should be white (paper).  Is this because PS does not
> > support transparency?  But why is it black, then?  White would at least
> > not strike the eye as much :).  What can I do about that?
> 
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
> To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: general-help@xmlgraphics.apache.org



---------------------------------------------------------------------
Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


Re: EPSDocumentGraphics2D: bitmap graphics has black background

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Yes, I assume this has to do with missing support for transparency. The
color for the background color is arbitrary. It could be green.
PSGraphics2D has no influence on this. You need to check if you can get
the producer of the bitmap to use a white background. Or implement
transparency support and send a patch. :-)

On 27.05.2006 18:30:53 Thomas Maier wrote:
> Hi all,
> 
> just another one with EPSDocumentGraphics2D.  Generating text and lines
> works fine.  However, when I render non-rectangular bitmap graphics with
> transparent areas into my document, the bitmap shows fine but with black
> areas where it should be white (paper).  Is this because PS does not
> support transparency?  But why is it black, then?  White would at least
> not strike the eye as much :).  What can I do about that?



Jeremias Maerki


---------------------------------------------------------------------
Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org