Hi Hazen: On 2010-09-22 10:48-0400 Hazen Babcock wrote:
> Schwab,Wilhelm K wrote: >> Alan, Hazen, >> >> I certainly can figure out how to build the library, but it would *really* >> be nice to have it in the plplot9-driver-cairo package. Never hurts to ask >> :) >> >> However, it turns out not to be magic fix, as the memory layout is ARGB vs. >> RGBA: >> >> /* Malloc memory the way cairo likes it. Aligned on the stride computed >> by cairo_format_stride_for_width >> * and in the RGB24 format (from >> http://cairographics.org/manual/cairo-Image-Surfaces.html): >> * Each pixel is a 32-bit quantity, with the upper 8 bits unused. >> * Red, Green, and Blue are stored in the remaining 24 bits in that >> order */ >> >> I need to read up on Pharo, what it calls Rome, and Cairo. If Pharo has or >> grows a Cairo interface, then the above become a non-problem. > > If are willing to use bleeding edge PLplot (v11198), we now have a > function called plsmema() that you can use to pass RGBA formatted memory > to PLplot. You will also have to use the memcairo driver as it is the > only one that can take advantage of memory formatted in this way. Don't > worry though, because when you get the array back from Cairo it will > still be in RGBA format, it doesn't get converted to ARGB. > > examples/python/test_memcairo.py shows how you might use plsmema() and > plsmem() from Python to create plots in memory, then save them as .png > files. I fixed an issue (actually declare plsmema in plplot.h) in revision 11201. Without that fix, some default declaration is used without PLDLLIMPEXP so the build fails for me for my default gcc options (-fvisibility=hidden) and would also fail on Windows for the same reason. Thanks, for creating test_memcairo.py following Simon's lead with test_mem.py. For others here, if you compare results from the two examples you can see why we recommend -dev memcairo over -dev mem. The TrueType fonts, antialiasing, and high-quality filling are huge improvements for -dev memcairo over -dev mem for plsmem RGB results. And, of course, -dev memcairo currently has exclusive access to RGBA as well. As of revision 11202 I have imposed a dark gray background for the example for RGB and dark gray semi-transparent background for the RGBA case. I prefer setting some explicit colour and opacity to test that the memcairo device plots on top of the specific RGB or RGBA background image you supply rather than and all-zero image with black or transparent black background. For the semi-transparent results, the ImageMagick display app displays a checkerboard rather than a semi-transparent background colour. But you can confirm the RGBA colours of the background area by clicking the middle mouse button. That gives the expected results so all seems to be well with this example. Back in the mists of time, I figured out a way (I think with display options) to show a semi-transparent background for real, i.e., without the checkboard and with the desktop (whatever it is) showing through the plotted image. That was a really cool effect, but I cannot remember what I did exactly. Has anybody figured out how to do that? 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 __________________________ ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel