From: Schwab,Wilhelm K <bs...@an...> - 2010-09-22 16:08:03
|
Hazen, plsmema() sounds like a/the answer. For the moment (time pressure is mounting), I am going to hack a most-recent-graph temp file, hold my nose<g> and get some work done with a crude interactive plotting capability that will hopefully get me through the next couple of weeks. Thanks! Bill ________________________________________ From: Hazen Babcock [hba...@ma...] Sent: Wednesday, September 22, 2010 10:48 AM To: Schwab,Wilhelm K Cc: plp...@li... Subject: Re: [Plplot-devel] plsmem(), RGB+alpha vs. RGB? 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. -Hazen |