[seed] cairo: Implement surface.write_to_png



commit 513df488c82a9af46d4c3e57bf00ff035250e830
Author: Robert Carr <racarr svn gnome org>
Date:   Thu May 14 14:20:05 2009 -0400

    cairo: Implement surface.write_to_png
---
 modules/cairo/seed-cairo-surface.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/modules/cairo/seed-cairo-surface.c b/modules/cairo/seed-cairo-surface.c
index 2b7699b..598ff65 100644
--- a/modules/cairo/seed-cairo-surface.c
+++ b/modules/cairo/seed-cairo-surface.c
@@ -324,6 +324,33 @@ seed_cairo_surface_has_show_text_glyphs(SeedContext ctx,
 				  cairo_surface_has_show_text_glyphs (seed_object_to_cairo_surface(ctx, this_object, exception)), exception);
 }
 
+static SeedValue
+seed_cairo_surface_write_to_png (SeedContext ctx,
+				 SeedObject function,
+				 SeedObject this_object,
+				 gsize argument_count,
+				 const SeedValue arguments[],
+				 SeedException *exception)
+{
+  cairo_status_t ret;
+  cairo_surface_t *surf;
+  gchar *filename;
+  CHECK_THIS();
+  
+  if (argument_count != 1)
+    {
+      EXPECTED_EXCEPTION("write_to_png", "1 argument");
+    }
+  
+  surf = seed_object_get_private (this_object);
+  filename = seed_value_to_string (ctx, arguments[0], exception);
+  
+  ret = cairo_surface_write_to_png (surf, filename);
+  g_free (filename);
+  
+  return seed_value_from_long (ctx, ret, exception);
+}
+
 
 seed_static_function surface_funcs[] = {
   {"create_similar", seed_cairo_surface_create_similar, 0},
@@ -335,6 +362,7 @@ seed_static_function surface_funcs[] = {
   {"copy_page", seed_cairo_surface_copy_page, 0},
   {"show_page", seed_cairo_surface_show_page, 0},
   {"has_show_text_glyphs", seed_cairo_surface_has_show_text_glyphs, 0},
+  {"write_to_png", seed_cairo_surface_write_to_png, 0},
   {0,0,0}
 };
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]