]> granicus.if.org Git - graphviz/commitdiff
gvdevice plugin to output cairo bitmaps; one or two missing refcount releases
authorglenlow <devnull@localhost>
Wed, 21 May 2008 13:31:18 +0000 (13:31 +0000)
committerglenlow <devnull@localhost>
Wed, 21 May 2008 13:31:18 +0000 (13:31 +0000)
plugin/quartz/gvplugin_quartz.c
plugin/quartz/gvplugin_quartz.h

index 43ba875c606ca15f27c8c847415a2156ad98eefa..ed33668e356b19b6acfa6164cfb272b63a0ed42a 100644 (file)
@@ -21,6 +21,7 @@ extern gvplugin_installed_t gvrender_quartz_types;
 // extern gvplugin_installed_t gvtextlayout_quartz_types;
 extern gvplugin_installed_t gvloadimage_quartz_types;
 extern gvplugin_installed_t gvdevice_quartz_types;
+extern gvplugin_installed_t gvdevice_quartz_types_for_cairo;
 
 /* Uniform Type Identifiers corresponding to each format_type */
 CFStringRef format_uti [] = {
@@ -39,11 +40,26 @@ CFStringRef format_uti [] = {
        CFSTR("com.truevision.tga-image")
 };
 
+/* data consumer backed by the gvdevice */
+
+extern size_t gvdevice_write(GVJ_t *job, const unsigned char *s, unsigned int len);
+
+static size_t device_data_consumer_put_bytes (void *info, const void *buffer, size_t count)
+{
+       return gvdevice_write((GVJ_t *)info, (const unsigned char*)buffer, count);
+}
+
+CGDataConsumerCallbacks device_data_consumer_callbacks = {
+       device_data_consumer_put_bytes,
+       NULL
+};
+
 static gvplugin_api_t apis[] = {
     {API_render, &gvrender_quartz_types},
   //  {API_textlayout, &gvtextlayout_quartz_types},
        {API_loadimage, &gvloadimage_quartz_types},
     {API_device, &gvdevice_quartz_types},
+    {API_device, &gvdevice_quartz_types_for_cairo},
     {(api_t)0, 0},
 };
 
index 7920486ea9410dd3fefab4367eb6605faea451f9..59f518aacca5661c0184a6317614d089df633ea4 100644 (file)
@@ -35,6 +35,11 @@ typedef enum {
        FORMAT_TGA
 } format_type;
 
+static const int BYTE_ALIGN = 15;                      /* align to 16 bytes */
+static const int BITS_PER_COMPONENT = 8;       /* bits per color component */
+static const int BYTES_PER_PIXEL = 4;          /* bytes per pixel */
+
 extern CFStringRef format_uti [];
+extern CGDataConsumerCallbacks device_data_consumer_callbacks;
 
-#endif
\ No newline at end of file
+#endif