1 /* guile-gnome
2  * Copyright (C) 2004 Free Software Foundation, Inc.
3  *
4  * gdk-pixbuf-support.c: Support routines for the gdk-pixbuf wrapper
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, contact:
18  *
19  * Free Software Foundation           Voice:  +1-617-542-5942
20  * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652
21  * Boston, MA  02111-1307,  USA       gnu@gnu.org
22  */
23 
24 #include <libguile.h>
25 #include "guile-gnome-gobject.h"
26 
27 #include "gdk-pixbuf-support.h"
28 
29 static gboolean
port_write_cb(const gchar * buf,gsize count,GError ** error,gpointer data)30 port_write_cb (const gchar *buf, gsize count, GError **error,
31                gpointer data)
32 {
33     SCM port = GPOINTER_TO_SCM (data);
34     scm_c_write (port, buf, count);
35     return TRUE;
36 }
37 
38 gboolean
gdk_pixbuf_save_to_port(GdkPixbuf * pixbuf,SCM port,const char * type,SCM options_alist,GError ** error)39 gdk_pixbuf_save_to_port (GdkPixbuf *pixbuf, SCM port, const char *type,
40                          SCM options_alist, GError **error)
41 #define FUNC_NAME "gdk-pixbuf-save-to-port"
42 {
43     gboolean res;
44 
45     SCM_VALIDATE_PORT (1, port);
46     /* ignoring options for now */
47 
48     res = gdk_pixbuf_save_to_callback (pixbuf, port_write_cb,
49                                        SCM_TO_GPOINTER (port),
50                                        type, error, NULL);
51     scm_remember_upto_here_1 (port);
52     return res;
53 }
54 #undef FUNC_NAME
55