From: arif Date: Tue, 3 Mar 2009 18:01:41 +0000 (+0000) Subject: gdiplus is added to support bmp formats X-Git-Tag: LAST_LIBGRAPH~32^2~2333 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f51a6b86302a86d9d48a5ecc7cd30cca7d106d03;p=graphviz gdiplus is added to support bmp formats --- diff --git a/plugin/gdiplus/gvdevice_gdiplus.cpp b/plugin/gdiplus/gvdevice_gdiplus.cpp index 673575d2d..396d8bda8 100755 --- a/plugin/gdiplus/gvdevice_gdiplus.cpp +++ b/plugin/gdiplus/gvdevice_gdiplus.cpp @@ -18,11 +18,19 @@ #include "config.h" #endif -#include "gvplugin_device.h" +#include "gvplugin_device.h" +#include "gvplugin_render.h" +#include "graph.h" #include "gvplugin_gdiplus.h" -extern "C" size_t gvdevice_write(GVJ_t *job, const unsigned char *s, unsigned int len); +extern "C" size_t gvwrite(GVJ_t *job, const unsigned char *s, unsigned int len); + + + + + + using namespace Gdiplus; @@ -41,14 +49,15 @@ static void gdiplus_format(GVJ_t *job) job->height, /* height in pixels */ job->width * BYTES_PER_PIXEL, /* bytes per row: exactly width # of pixels */ PixelFormat32bppPARGB, /* pixel format: corresponds to CAIRO_FORMAT_ARGB32 */ - job->imagedata); /* pixel data from job */ + (BYTE*)job->imagedata); /* pixel data from job */ SaveBitmapToStream(bitmap, stream, job->device.id); /* blast the streamed buffer back to the gvdevice */ /* NOTE: this is somewhat inefficient since we should be streaming directly to gvdevice rather than buffering first */ /* ... however, GDI+ requires any such direct IStream to implement Seek Read, Write, Stat methods and gvdevice really only offers a write-once model */ stream->Release(); - gvdevice_write(job, (unsigned char*)GlobalLock(buffer), GlobalSize(buffer)); + gvwrite(job, (const unsigned char*)GlobalLock(buffer), GlobalSize(buffer)); + GlobalFree(buffer); }