Commit f5ec1ea6 authored by Øyvind Kolås's avatar Øyvind Kolås

Added pixbuf operation in category programming

parent 3d4a1466
2006-09-15 Øyvind Kolås <pippin@gimp.org>
Added pixbuf operation in category programming.
* operations/file-io/pixbuf.c: NEW operation that uses a GdkPixbuf
from a pointer, in category programming.
* operations/file-io/Makefile.am: added new file.
2006-09-15 Øyvind Kolås <pippin@gimp.org>
2006-09-14 Kevin Cozens <kcozens@cvs.gnome.org>
* operations/file-io/svg-load.c: Pass the rendered image to gegl
......
......@@ -35,6 +35,9 @@ svg-load.so: svg-load.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDADD) \
$(CAIRO_CFLAGS) $(CAIRO_LIBS) \
$(RSVG_CFLAGS) $(RSVG_LIBS)
pixbuf.so: pixbuf.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDADD) \
$(RSVG_CFLAGS) $(RSVG_LIBS)
#############################################################################
clean-local:
......
/* This file is an image processing operation for GEGL
*
* GEGL is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* GEGL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GEGL; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Copyright 2006 Øyvind Kolås <pippin@gimp.org>
*/
#if GEGL_CHANT_PROPERTIES
gegl_chant_pointer (pixbuf, "GdkPixbuf to use")
#else
#define GEGL_CHANT_SOURCE
#define GEGL_CHANT_NAME pixbuf
#define GEGL_CHANT_DESCRIPTION "Uses the GdkPixbuf located at the memory location in <em>pixbuf</em>."
#define GEGL_CHANT_SELF "pixbuf.c"
#define GEGL_CHANT_CATEGORIES "programming"
#include "gegl-chant.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixdata.h>
static gboolean
process (GeglOperation *operation)
{
GeglOperationSource *op_source = GEGL_OPERATION_SOURCE(operation);
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
if (self->pixbuf)
op_source->output = g_object_new (GEGL_TYPE_BUFFER,
"format", babl_format(gdk_pixbuf_get_has_alpha(self->pixbuf)?"R'G'B'A u8":"R'G'B' u8"),
"x", 0,
"y", 0,
"width", gdk_pixbuf_get_width (self->pixbuf),
"height", gdk_pixbuf_get_height (self->pixbuf),
NULL);
gegl_buffer_set_fmt (op_source->output, gdk_pixbuf_get_pixels (self->pixbuf),
babl_format(gdk_pixbuf_get_has_alpha(self->pixbuf)?"R'G'B'A u8":"R'G'B' u8"));
return TRUE;
}
static GeglRect
get_defined_region (GeglOperation *operation)
{
GeglRect result = {0,0,0,0};
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
if (!self->pixbuf)
{
return result;
}
result.x = 0;
result.y = 0;
result.w = gdk_pixbuf_get_width (self->pixbuf);
result.h = gdk_pixbuf_get_height (self->pixbuf);
return result;
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment