thanks to allan for forwarding my message to this mailing list, unfortunately we still have problems with the plplot mem driver. We want plplot to compose a graphic in memory and then pass it to another vector graphic library (cairo). In our testing it seems that plplot does not write in the defined buffer, the problem doesn't seems to be cairo because when we force the values of the buffer cairo outputs fine. we are using plplot-5.7.2 with xwin and mem drivers only.
here is our test code. this example is an hybrid of some code found on sourceforge, and sent to us by Hazen. any help will be appreciated. gratings Raul. #include <plplot.h> #include <memory.h> #include <iostream> #include <cairo.h> using namespace std; int main(int argc, char **argv) { int width = 200; int height = 200; char *buffer; buffer = (char *)malloc(width * height * 3 * sizeof(char)); for(int ii=0;ii<(width*height*3);ii++) { buffer[ii] = 0; } plsdev("mem"); plsmem(width, height, buffer); plscolbg (255, 255, 255); plinit(); plenv(0, 10.0, 0, 10.0, 0, 0); pljoin(1.0, 2.0, 7.0, 8.0); plend(); cairo_surface_t *surface; unsigned char *cairo_buffer; cairo_buffer = (unsigned char *)malloc(width * height * 4 * sizeof(char)); for (int i = 0, j = 0; i < (width * height * 3); i+=3) { cairo_buffer[j++] = buffer[i+2]; //blue cairo_buffer[j++] = buffer[i + 1]; //green cairo_buffer[j++] = buffer[i]; //red cairo_buffer[j++] = 0; } surface = cairo_image_surface_create_for_data (cairo_buffer, CAIRO_FORMAT_RGB24, width, height, 0); cairo_surface_write_to_png(surface, "plplot1.png"); cairo_surface_destroy (surface); return 0; }
<<winmail.dat>>
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel