On 2010-03-14 11:32-0700 Alan W. Irwin wrote:

> On 2010-03-14 10:50-0500 Hezekiah M. Carty wrote:
>> Revision 10866 should fix this.  If the background color has an alpha
>> value < 1.0 then a white surface is drawn before the transparent
>> background color.  This produces good looking results for all of the
>> Cairo devices on my system (Ubuntu 9.10, Cairo 1.8.8).
>
> This fix obscures the underlying layers as advertised so stops the leaking
> through of the first page onto the second.  However, I don't like this way
> of dealing with the issue (which from your comments, qtwidget uses as well).
>
> We want transparent backgrounds to be transparent because we would like to
> implement the absolutely cool effect of seeing the plot superimposed on the
> desktop underneath the GUI.

I researched the goal of having semi-transparent backgrounds under
complete PLplot control some more using -dev pngcairo (since that file device
implementation is simpler than xcairo).

./x01c -dev pngcairo -bg ffffff_0.0 -o test.png -drvopt set_background=1

should produce a white but completely transparent PLplot background if
the the pango/cairo stack of libraries has been initialized properly.
However, it produces a black completely opaque background instead.
(Removing the -drvopt option or setting set_background=0 gives
identical results which seems to be contradictory with the code which
appears to do different things about setting the background depending
on set_background).

I can use ImageMagick to replace all black colours with complete
transparency like this:

convert -transparent black test.png test_transparent.png

Then "display -immutable test_transparent.png"

really does show the desktop underneath the plot which indeed is a
really cool-looking effect.

(Without that -immutable option, display replaces a transparent background
with a checkerboard background which apparently is something of an industry
standard to signal you really do have a transparent background.) eog also
renders a checkerboard background for test_transparent.png, but in that case
there doesn't seem to be any equivalent of the -immutable option to allow
you to see the unmodified image with an actual transparent background.

It appears from this additional research that all we need to realize the
goal of a transparent background completely under PLplot control for cairo
file devices like pngcairo is a way to initialize the pango/cairo libraries
so they do not impose a black background of their own.  And similarly for
xcairo once the issue of reinitializing the surface for each page is
addressed.  An additional question is why set_background=1 or 0 seems
to produce an identical plot.

I also did similar tests for -dev pngqt with identical results (a black
background is imposed underneath the plot which can be made transparent by
convert) so something similar has to be done in the qt file devices case and
also in the qtwidget case to get rid of the extra backgrounds that are being
imposed below the PLplot background.

Finally, I did some tests using -dev svg, -dev svgcairo, and -dev/svgqt.  In
the case of SVG results the files are in human-readable XML form so it is
easy to confirm these three devices (with no external library, with the
pango/cairo libraries, and the Qt libraries) are all doing the right thing
without imposing any additional layers.  (eog confirmed these good results
by giving a checkboard background signaling there was actually a transparent
background.  ImageMagick "display" or "display -immutable" could not confirm
these good results but apparently that is a bug in how "display" ignores
transparent *.svg results on my platform).

Hopefully these good svg transparent background results for the cases of
-dev svgcairo and -dev svgqt will inspire the cairo and qt experts here to
solve the remaining transparent background issues for the non-svg cairo and
qt devices.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to