[ wxwindows-Bugs-1765922 ] printing images with alpha channel
SourceForge.net
noreply at sourceforge.net
Tue Aug 7 12:34:40 PDT 2007
Bugs item #1765922, was opened at 2007-08-02 08:21
Message generated for change (Comment added) made by ev0rtex
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1765922&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxMSW specific
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Chris Borgolte (chrisborgolte)
Assigned to: Nobody/Anonymous (nobody)
Summary: printing images with alpha channel
Initial Comment:
In print preview everything looks fine but the printout contains a filled rectangle where one would expect a red line.
Attached file is against printing sample.
----------------------------------------------------------------------
Comment By: V0rtex (ev0rtex)
Date: 2007-08-07 19:34
Message:
Logged In: YES
user_id=1526976
Originator: NO
This issue is something that is (or should be) known, but there is not a
simple solution to the problem. As far as I know this would be an inherent
issue with any platform due to how printing works. When printing you do
not have the advantage of a memory buffer that contains all of the rendered
data as with memory and screen device contexts. The system simply sends
basic instructions to the printer such as 'draw a line from point a to
point b' or 'draw this text at point c'. When rendering an image that
contains alpha to a device context, the pixels of the image have to be
individually composited with the already rendered content. Due to the fact
that the printer DC does not have a memory buffer with all of the rendered
content, the default (black-filled) buffer is used for blending and
blitting the pixels. This is why you get a nice black-filled block where
transparency should be.
I have implemented a far from perfect workaround in our software that
essentially renders the content twice - once with a memory DC up to the
point at which the alpha image needs to be rendered and then again with the
printer DC using the background content from the pre-rendered memory DC for
alpha blending. This works okay, though I have noticed that for some
reason this causes quite a bit of artifacting in the transparent areas of
images (probably gets scaled around a bit or something when blitting - no
idea).
At one point I attempted to just use a printer DC compatible memory DC
to render everything to and then just print out the entire memory DC - BAD
IDEA!! The content sure prints great and looks nice but the problem you
run into is the obvious fact that now rather than sending a few kB of data
to the printer you are rendering a very large raw bitmap to the printer
(orders of magnitude larger in size).
----------------------------------------------------------------------
Comment By: Bryan Petty (bpetty)
Date: 2007-08-07 19:05
Message:
Logged In: YES
user_id=1106696
Originator: NO
This is an issue I've run into before, though I can't find an older bug
report about it.
Though this is really a limitation of the platform. I'll get someone who
knows much more about this issue to comment on this. Ultimately though,
it's just not possible on MSW (unless wxGraphicsContext with Cairo on MSW
can do different), and this should be noted in the documentation.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1765922&group_id=9863
More information about the wx-dev
mailing list