Some cleanup...
2007-12-29 Michael Natterer <mitch@gimp.org> Some cleanup... * app/Makefile.am: change linking order. * app/main.c: move gegl initialization from here... * app/app.c: ...to here. * app/gegl/gimpops.c: removed. * app/gegl/gimp-gegl.[ch] * app/gegl/gegl-types.h: added. * app/gegl/Makefile.am: changed accordingly. * app/gegl/gimpoptilesink.[ch] * app/gegl/gimpoptilesource.[ch]: made more gimpish. svn path=/trunk/; revision=24459
This commit is contained in:

committed by
Michael Natterer

parent
b06afdec24
commit
479a649898
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
|||||||
|
2007-12-29 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
Some cleanup...
|
||||||
|
|
||||||
|
* app/Makefile.am: change linking order.
|
||||||
|
|
||||||
|
* app/main.c: move gegl initialization from here...
|
||||||
|
|
||||||
|
* app/app.c: ...to here.
|
||||||
|
|
||||||
|
* app/gegl/gimpops.c: removed.
|
||||||
|
|
||||||
|
* app/gegl/gimp-gegl.[ch]
|
||||||
|
* app/gegl/gegl-types.h: added.
|
||||||
|
|
||||||
|
* app/gegl/Makefile.am: changed accordingly.
|
||||||
|
|
||||||
|
* app/gegl/gimpoptilesink.[ch]
|
||||||
|
* app/gegl/gimpoptilesource.[ch]: made more gimpish.
|
||||||
|
|
||||||
2007-12-29 Øyvind Kolås <pippin@gimp.org>
|
2007-12-29 Øyvind Kolås <pippin@gimp.org>
|
||||||
|
|
||||||
Added adapter GEGL operations for reading and writing to TileManagers.
|
Added adapter GEGL operations for reading and writing to TileManagers.
|
||||||
|
@ -13,9 +13,9 @@ SUBDIRS = \
|
|||||||
paint-funcs \
|
paint-funcs \
|
||||||
composite \
|
composite \
|
||||||
base \
|
base \
|
||||||
|
gegl \
|
||||||
config \
|
config \
|
||||||
core \
|
core \
|
||||||
gegl \
|
|
||||||
paint \
|
paint \
|
||||||
text \
|
text \
|
||||||
vectors \
|
vectors \
|
||||||
@ -99,7 +99,6 @@ gimp_2_5_LDADD = \
|
|||||||
gui/libappgui.a \
|
gui/libappgui.a \
|
||||||
actions/libappactions.a \
|
actions/libappactions.a \
|
||||||
dialogs/libappdialogs.a \
|
dialogs/libappdialogs.a \
|
||||||
gegl/libappgegl.a \
|
|
||||||
menus/libappmenus.a \
|
menus/libappmenus.a \
|
||||||
display/libappdisplay.a \
|
display/libappdisplay.a \
|
||||||
tools/libapptools.a \
|
tools/libapptools.a \
|
||||||
@ -114,6 +113,7 @@ gimp_2_5_LDADD = \
|
|||||||
paint/libapppaint.a \
|
paint/libapppaint.a \
|
||||||
text/libapptext.a \
|
text/libapptext.a \
|
||||||
config/libappconfig.a \
|
config/libappconfig.a \
|
||||||
|
gegl/libappgegl.a \
|
||||||
paint-funcs/libapppaint-funcs.a \
|
paint-funcs/libapppaint-funcs.a \
|
||||||
composite/libappcomposite.a \
|
composite/libappcomposite.a \
|
||||||
base/libappbase.a \
|
base/libappbase.a \
|
||||||
@ -149,7 +149,6 @@ gimp_console_2_5_LDADD = \
|
|||||||
widgets/widgets-enums.o \
|
widgets/widgets-enums.o \
|
||||||
display/display-enums.o \
|
display/display-enums.o \
|
||||||
display/gimpdisplayoptions.o \
|
display/gimpdisplayoptions.o \
|
||||||
gegl/libappgegl.a \
|
|
||||||
pdb/libappinternal-procs.a \
|
pdb/libappinternal-procs.a \
|
||||||
xcf/libappxcf.a \
|
xcf/libappxcf.a \
|
||||||
file/libappfile.a \
|
file/libappfile.a \
|
||||||
@ -160,6 +159,7 @@ gimp_console_2_5_LDADD = \
|
|||||||
paint/libapppaint.a \
|
paint/libapppaint.a \
|
||||||
text/libapptext.a \
|
text/libapptext.a \
|
||||||
config/libappconfig.a \
|
config/libappconfig.a \
|
||||||
|
gegl/libappgegl.a \
|
||||||
paint-funcs/libapppaint-funcs.a \
|
paint-funcs/libapppaint-funcs.a \
|
||||||
composite/libappcomposite.a \
|
composite/libappcomposite.a \
|
||||||
base/libappbase.a \
|
base/libappbase.a \
|
||||||
|
10
app/app.c
10
app/app.c
@ -44,6 +44,8 @@
|
|||||||
#include "base/base.h"
|
#include "base/base.h"
|
||||||
#include "base/tile-swap.h"
|
#include "base/tile-swap.h"
|
||||||
|
|
||||||
|
#include "gegl/gimp-gegl.h"
|
||||||
|
|
||||||
#include "core/gimp.h"
|
#include "core/gimp.h"
|
||||||
#include "core/gimp-user-install.h"
|
#include "core/gimp-user-install.h"
|
||||||
|
|
||||||
@ -186,6 +188,8 @@ app_run (const gchar *full_prog_name,
|
|||||||
/* initialize lowlevel stuff */
|
/* initialize lowlevel stuff */
|
||||||
swap_is_ok = base_init (config, be_verbose, use_cpu_accel);
|
swap_is_ok = base_init (config, be_verbose, use_cpu_accel);
|
||||||
|
|
||||||
|
gimp_gegl_init ();
|
||||||
|
|
||||||
#ifndef GIMP_CONSOLE_COMPILATION
|
#ifndef GIMP_CONSOLE_COMPILATION
|
||||||
if (! no_interface)
|
if (! no_interface)
|
||||||
update_status_func = gui_init (gimp, no_splash);
|
update_status_func = gui_init (gimp, no_splash);
|
||||||
@ -253,8 +257,8 @@ app_run (const gchar *full_prog_name,
|
|||||||
g_object_unref (gimp);
|
g_object_unref (gimp);
|
||||||
|
|
||||||
errors_exit ();
|
errors_exit ();
|
||||||
base_exit ();
|
|
||||||
gegl_exit ();
|
gegl_exit ();
|
||||||
|
base_exit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -290,9 +294,11 @@ app_exit_after_callback (Gimp *gimp,
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
gegl_exit ();
|
||||||
|
|
||||||
/* make sure that the swap files are removed before we quit */
|
/* make sure that the swap files are removed before we quit */
|
||||||
tile_swap_exit ();
|
tile_swap_exit ();
|
||||||
gegl_exit ();
|
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,9 +3,12 @@
|
|||||||
noinst_LIBRARIES = libappgegl.a
|
noinst_LIBRARIES = libappgegl.a
|
||||||
|
|
||||||
libappgegl_a_SOURCES = \
|
libappgegl_a_SOURCES = \
|
||||||
|
gimp-gegl.c \
|
||||||
|
gimp-gegl.h \
|
||||||
gimpoptilesink.c \
|
gimpoptilesink.c \
|
||||||
|
gimpoptilesink.h \
|
||||||
gimpoptilesource.c \
|
gimpoptilesource.c \
|
||||||
gimpops.c
|
gimpoptilesource.h
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
-I. \
|
-I. \
|
||||||
|
32
app/gegl/gegl-types.h
Normal file
32
app/gegl/gegl-types.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/* GIMP - The GNU Image Manipulation Program
|
||||||
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
|
*
|
||||||
|
* gegl-types.h
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __OUR_GEGL_TYPES_H__
|
||||||
|
#define __OUR_GEGL_TYPES_H__
|
||||||
|
|
||||||
|
|
||||||
|
#include "base/base-types.h"
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _GimpOperationTileSink GimpOperationTileSink;
|
||||||
|
typedef struct _GimpOperationTileSource GimpOperationTileSource;
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __OUR_GEGL_TYPES_H__ */
|
@ -1,7 +1,7 @@
|
|||||||
/* GIMP - The GNU Image Manipulation Program
|
/* GIMP - The GNU Image Manipulation Program
|
||||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
*
|
*
|
||||||
* gimpops.c
|
* gimp-gegl.c
|
||||||
* Copyright (C) 2007 Øyvind Kolås <pippin@gimp.org>
|
* Copyright (C) 2007 Øyvind Kolås <pippin@gimp.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -19,17 +19,22 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <gegl.h>
|
#include <gegl.h>
|
||||||
#include <gegl/buffer/gegl-buffer.h>
|
#include <gegl/buffer/gegl-buffer.h>
|
||||||
|
|
||||||
#include "gegl/gegl-types.h"
|
#include "gegl/gegl-types.h"
|
||||||
|
|
||||||
|
#include "gegl-types.h"
|
||||||
|
|
||||||
|
#include "gimp-gegl.h"
|
||||||
#include "gimpoptilesink.h"
|
#include "gimpoptilesink.h"
|
||||||
#include "gimpoptilesource.h"
|
#include "gimpoptilesource.h"
|
||||||
|
|
||||||
|
|
||||||
void gimp_gegl_ops_init (void);
|
void
|
||||||
|
gimp_gegl_init (void)
|
||||||
void gimp_gegl_ops_init (void)
|
|
||||||
{
|
{
|
||||||
g_type_class_ref (GIMP_TYPE_OPERATION_TILE_SINK);
|
g_type_class_ref (GIMP_TYPE_OPERATION_TILE_SINK);
|
||||||
g_type_class_ref (GIMP_TYPE_OPERATION_TILE_SOURCE);
|
g_type_class_ref (GIMP_TYPE_OPERATION_TILE_SOURCE);
|
29
app/gegl/gimp-gegl.h
Normal file
29
app/gegl/gimp-gegl.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/* GIMP - The GNU Image Manipulation Program
|
||||||
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
|
*
|
||||||
|
* gimp-gegl.h
|
||||||
|
* Copyright (C) 2007 Øyvind Kolås <pippin@gimp.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GIMP_GEGL_H__
|
||||||
|
#define __GIMP_GEGL_H__
|
||||||
|
|
||||||
|
|
||||||
|
void gimp_gegl_init (void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __GIMP_GEGL_H__ */
|
@ -19,24 +19,38 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <gegl.h>
|
#include <gegl.h>
|
||||||
#include <gegl/buffer/gegl-buffer.h>
|
#include <gegl/buffer/gegl-buffer.h>
|
||||||
|
|
||||||
#include "gegl/gegl-types.h"
|
#include "gegl/gegl-types.h"
|
||||||
|
|
||||||
|
#include "gegl-types.h"
|
||||||
|
|
||||||
|
#include "base/base-types.h"
|
||||||
|
#include "base/tile-manager.h"
|
||||||
|
#include "base/pixel-region.h"
|
||||||
|
|
||||||
#include "gimpoptilesink.h"
|
#include "gimpoptilesink.h"
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include "app/base/base-types.h"
|
enum
|
||||||
#include "app/base/tile-manager.h"
|
{
|
||||||
#include "app/base/pixel-region.h"
|
PROP_0,
|
||||||
|
PROP_TILE_MANAGER
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static void get_property (GObject *gobject,
|
static void get_property (GObject *gobject,
|
||||||
guint prop_id,
|
guint property_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
|
|
||||||
static void set_property (GObject *gobject,
|
static void set_property (GObject *gobject,
|
||||||
guint prop_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
|
|
||||||
@ -56,17 +70,6 @@ static Babl *bpp_to_format (guint bpp)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
PROP_0,
|
|
||||||
PROP_TILE_MANAGER
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_operation_tile_sink_init (GimpOperationTileSink *self)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpOperationTileSink, gimp_operation_tile_sink, GEGL_TYPE_OPERATION_SINK)
|
G_DEFINE_TYPE (GimpOperationTileSink, gimp_operation_tile_sink, GEGL_TYPE_OPERATION_SINK)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -74,55 +77,66 @@ gimp_operation_tile_sink_class_init (GimpOperationTileSinkClass * klass)
|
|||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||||
GeglOperationSinkClass *operation_sink_class = GEGL_OPERATION_SINK_CLASS (klass);
|
GeglOperationSinkClass *sink_class = GEGL_OPERATION_SINK_CLASS (klass);
|
||||||
|
|
||||||
object_class->set_property = set_property;
|
object_class->set_property = set_property;
|
||||||
object_class->get_property = get_property;
|
object_class->get_property = get_property;
|
||||||
|
|
||||||
operation_sink_class->process = process;
|
sink_class->process = process;
|
||||||
|
|
||||||
gegl_operation_class_set_name (operation_class, "gimp-tilemanager-sink");;
|
gegl_operation_class_set_name (operation_class, "gimp-tilemanager-sink");;
|
||||||
|
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_TILE_MANAGER,
|
PROP_TILE_MANAGER,
|
||||||
g_param_spec_pointer ("tile_manager",
|
g_param_spec_pointer ("tile-manager",
|
||||||
"tile_manager",
|
"Tile Manager",
|
||||||
"The tile manager to use as a destination",
|
"The tile manager to use as a destination",
|
||||||
(GParamFlags) ( (G_PARAM_READABLE | G_PARAM_WRITABLE) | G_PARAM_CONSTRUCT)));
|
G_PARAM_READWRITE |
|
||||||
|
G_PARAM_CONSTRUCT));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_operation_tile_sink_init (GimpOperationTileSink *self)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_property (GObject *object,
|
get_property (GObject *object,
|
||||||
guint prop_id,
|
guint property_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GimpOperationTileSink *self = GIMP_OPERATION_TILE_SINK (object);
|
GimpOperationTileSink *self = GIMP_OPERATION_TILE_SINK (object);
|
||||||
switch (prop_id)
|
|
||||||
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_TILE_MANAGER:
|
case PROP_TILE_MANAGER:
|
||||||
g_value_set_pointer (value, self->tile_manager);
|
g_value_set_pointer (value, self->tile_manager);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_property (GObject *object,
|
set_property (GObject *object,
|
||||||
guint prop_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GimpOperationTileSink *self = GIMP_OPERATION_TILE_SINK (object);
|
GimpOperationTileSink *self = GIMP_OPERATION_TILE_SINK (object);
|
||||||
switch (prop_id)
|
|
||||||
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_TILE_MANAGER:
|
case PROP_TILE_MANAGER:
|
||||||
self->tile_manager = g_value_get_pointer (value);
|
self->tile_manager = g_value_get_pointer (value);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,19 +144,16 @@ static gboolean
|
|||||||
process (GeglOperation *operation,
|
process (GeglOperation *operation,
|
||||||
gpointer context_id)
|
gpointer context_id)
|
||||||
{
|
{
|
||||||
GimpOperationTileSink *self;
|
GimpOperationTileSink *self = GIMP_OPERATION_TILE_SINK (operation);
|
||||||
GeglBuffer *input;
|
GeglBuffer *input;
|
||||||
GeglRectangle *extent;
|
GeglRectangle *extent;
|
||||||
|
|
||||||
self = GIMP_OPERATION_TILE_SINK (operation);
|
|
||||||
|
|
||||||
if (self->tile_manager)
|
if (self->tile_manager)
|
||||||
{
|
{
|
||||||
gpointer pr;
|
gpointer pr;
|
||||||
PixelRegion destPR;
|
PixelRegion destPR;
|
||||||
Babl *format;
|
Babl *format;
|
||||||
|
|
||||||
|
|
||||||
/* is this somethings that should be done already for all sinks? */
|
/* is this somethings that should be done already for all sinks? */
|
||||||
input = GEGL_BUFFER (gegl_operation_get_data (operation, context_id,
|
input = GEGL_BUFFER (gegl_operation_get_data (operation, context_id,
|
||||||
"input"));
|
"input"));
|
||||||
@ -150,13 +161,17 @@ process (GeglOperation *operation,
|
|||||||
extent = gegl_operation_result_rect (operation, context_id);
|
extent = gegl_operation_result_rect (operation, context_id);
|
||||||
|
|
||||||
pixel_region_init (&destPR, self->tile_manager,
|
pixel_region_init (&destPR, self->tile_manager,
|
||||||
extent->x, extent->y, extent->width, extent->height, TRUE);
|
extent->x, extent->y,
|
||||||
|
extent->width, extent->height,
|
||||||
|
TRUE);
|
||||||
|
|
||||||
format = bpp_to_format (tile_manager_bpp (self->tile_manager));
|
format = bpp_to_format (tile_manager_bpp (self->tile_manager));
|
||||||
|
|
||||||
for (pr = pixel_regions_register (1, &destPR); pr; pr = pixel_regions_process (pr))
|
for (pr = pixel_regions_register (1, &destPR);
|
||||||
|
pr;
|
||||||
|
pr = pixel_regions_process (pr))
|
||||||
{
|
{
|
||||||
GeglRectangle rect = {destPR.x, destPR.y, destPR.w, destPR.h};
|
GeglRectangle rect = { destPR.x, destPR.y, destPR.w, destPR.h };
|
||||||
|
|
||||||
gegl_buffer_get (input,
|
gegl_buffer_get (input,
|
||||||
1.0, &rect, format,
|
1.0, &rect, format,
|
||||||
@ -168,5 +183,6 @@ process (GeglOperation *operation,
|
|||||||
{
|
{
|
||||||
g_warning ("no tilemanager?");
|
g_warning ("no tilemanager?");
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* GIMP - The GNU Image Manipulation Program
|
/* GIMP - The GNU Image Manipulation Program
|
||||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
*
|
*
|
||||||
* gimpops.c
|
* gimpoperationtilesink.h
|
||||||
* Copyright (C) 2007 Øyvind Kolås <pippin@gimp.org>
|
* Copyright (C) 2007 Øyvind Kolås <pippin@gimp.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -19,39 +19,35 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GIMP_OPERATION_TILE_SINK_H
|
#ifndef __GIMP_OPERATION_TILE_SINK_H__
|
||||||
#define _GIMP_OPERATION_TILE_SINK_H
|
#define __GIMP_OPERATION_TILE_SINK_H__
|
||||||
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include "gegl/gegl-types.h"
|
|
||||||
#include "gegl/gegl-operation-sink.h"
|
#include "gegl/gegl-operation-sink.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#define GIMP_TYPE_OPERATION_TILE_SINK (gimp_operation_tile_sink_get_type ())
|
#define GIMP_TYPE_OPERATION_TILE_SINK (gimp_operation_tile_sink_get_type ())
|
||||||
#define GIMP_OPERATION_TILE_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_TILE_SINK, GimpOperationTileSink))
|
#define GIMP_OPERATION_TILE_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_TILE_SINK, GimpOperationTileSink))
|
||||||
#define GIMP_OPERATION_TILE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_TILE_SINK, GimpOperationTileSinkClass))
|
#define GIMP_OPERATION_TILE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_TILE_SINK, GimpOperationTileSinkClass))
|
||||||
#define GIMP_OPERATION_TILE_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_TILE_SINK, GimpOperationTileSinkClass))
|
#define GIMP_OPERATION_TILE_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_TILE_SINK, GimpOperationTileSinkClass))
|
||||||
|
|
||||||
typedef struct _GimpOperationTileSink GimpOperationTileSink;
|
|
||||||
struct _GimpOperationTileSink
|
|
||||||
{
|
|
||||||
GeglOperationSinkClass operation_sink;
|
|
||||||
gpointer tile_manager;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _GimpOperationTileSinkClass GimpOperationTileSinkClass;
|
typedef struct _GimpOperationTileSinkClass GimpOperationTileSinkClass;
|
||||||
|
|
||||||
|
struct _GimpOperationTileSink
|
||||||
|
{
|
||||||
|
GeglOperationSink parent_instance;
|
||||||
|
|
||||||
|
TileManager *tile_manager;
|
||||||
|
};
|
||||||
|
|
||||||
struct _GimpOperationTileSinkClass
|
struct _GimpOperationTileSinkClass
|
||||||
{
|
{
|
||||||
GeglOperationSinkClass operation_sink_class;
|
GeglOperationSinkClass operation_sink_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_operation_tile_sink_get_type (void) G_GNUC_CONST;
|
GType gimp_operation_tile_sink_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif
|
#endif /* __GIMP_OPERATION_TILE_SINK_H__ */
|
||||||
|
@ -19,22 +19,37 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <gegl.h>
|
#include <gegl.h>
|
||||||
#include <gegl/buffer/gegl-buffer.h>
|
#include <gegl/buffer/gegl-buffer.h>
|
||||||
|
|
||||||
#include "gegl/gegl-types.h"
|
#include "gegl/gegl-types.h"
|
||||||
|
|
||||||
|
#include "gegl-types.h"
|
||||||
|
|
||||||
|
#include "base/base-types.h"
|
||||||
|
#include "base/tile-manager.h"
|
||||||
|
#include "base/pixel-region.h"
|
||||||
|
|
||||||
#include "gimpoptilesource.h"
|
#include "gimpoptilesource.h"
|
||||||
#include <string.h>
|
|
||||||
#include "app/base/base-types.h"
|
|
||||||
#include "app/base/tile-manager.h"
|
enum
|
||||||
#include "app/base/pixel-region.h"
|
{
|
||||||
|
PROP_0,
|
||||||
|
PROP_TILE_MANAGER
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static void get_property (GObject *gobject,
|
static void get_property (GObject *gobject,
|
||||||
guint prop_id,
|
guint property_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
|
|
||||||
static void set_property (GObject *gobject,
|
static void set_property (GObject *gobject,
|
||||||
guint prop_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
|
|
||||||
@ -43,87 +58,93 @@ static gboolean process (GeglOperation *operation,
|
|||||||
|
|
||||||
static GeglRectangle get_defined_region (GeglOperation *operation);
|
static GeglRectangle get_defined_region (GeglOperation *operation);
|
||||||
|
|
||||||
enum
|
|
||||||
|
G_DEFINE_TYPE (GimpOperationTileSource, gimp_operation_tile_source,
|
||||||
|
GEGL_TYPE_OPERATION_SOURCE)
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_operation_tile_source_class_init (GimpOperationTileSourceClass * klass)
|
||||||
{
|
{
|
||||||
PROP_0,
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
PROP_TILE_MANAGER
|
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||||
};
|
GeglOperationSourceClass *source_class = GEGL_OPERATION_SOURCE_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->set_property = set_property;
|
||||||
|
object_class->get_property = get_property;
|
||||||
|
|
||||||
|
operation_class->get_defined_region = get_defined_region;
|
||||||
|
|
||||||
|
source_class->process = process;
|
||||||
|
|
||||||
|
gegl_operation_class_set_name (operation_class, "gimp-tilemanager-source");;
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_TILE_MANAGER,
|
||||||
|
g_param_spec_pointer ("tile-manager",
|
||||||
|
"Tile Manager",
|
||||||
|
"The tile manager to use as a destination",
|
||||||
|
G_PARAM_READWRITE |
|
||||||
|
G_PARAM_CONSTRUCT));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_operation_tile_source_init (GimpOperationTileSource *self)
|
gimp_operation_tile_source_init (GimpOperationTileSource *self)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpOperationTileSource, gimp_operation_tile_source, GEGL_TYPE_OPERATION_SOURCE)
|
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_operation_tile_source_class_init (GimpOperationTileSourceClass * klass)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
||||||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
|
||||||
GeglOperationSourceClass *operation_source_class = GEGL_OPERATION_SOURCE_CLASS (klass);
|
|
||||||
|
|
||||||
object_class->set_property = set_property;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
|
|
||||||
operation_source_class->process = process;
|
|
||||||
operation_class->get_defined_region = get_defined_region;
|
|
||||||
|
|
||||||
gegl_operation_class_set_name (operation_class, "gimp-tilemanager-source");;
|
|
||||||
|
|
||||||
g_object_class_install_property (object_class,
|
|
||||||
PROP_TILE_MANAGER,
|
|
||||||
g_param_spec_pointer ("tile_manager",
|
|
||||||
"tile_manager",
|
|
||||||
"The tile manager to use as a destination",
|
|
||||||
(GParamFlags) ( (G_PARAM_READABLE | G_PARAM_WRITABLE) | G_PARAM_CONSTRUCT)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_property (GObject *object,
|
get_property (GObject *object,
|
||||||
guint prop_id,
|
guint property_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GimpOperationTileSource *self = GIMP_OPERATION_TILE_SOURCE (object);
|
GimpOperationTileSource *self = GIMP_OPERATION_TILE_SOURCE (object);
|
||||||
switch (prop_id)
|
|
||||||
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_TILE_MANAGER:
|
case PROP_TILE_MANAGER:
|
||||||
g_value_set_pointer (value, self->tile_manager);
|
g_value_set_pointer (value, self->tile_manager);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_property (GObject *object,
|
set_property (GObject *object,
|
||||||
guint prop_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GimpOperationTileSource *self = GIMP_OPERATION_TILE_SOURCE (object);
|
GimpOperationTileSource *self = GIMP_OPERATION_TILE_SOURCE (object);
|
||||||
switch (prop_id)
|
|
||||||
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_TILE_MANAGER:
|
case PROP_TILE_MANAGER:
|
||||||
self->tile_manager = g_value_get_pointer (value);
|
self->tile_manager = g_value_get_pointer (value);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Babl *bpp_to_format (guint bpp)
|
static Babl *
|
||||||
|
bpp_to_format (guint bpp)
|
||||||
{
|
{
|
||||||
switch (bpp)
|
switch (bpp)
|
||||||
{
|
{
|
||||||
case 1: return babl_format ("Y' u8");
|
case 1: return babl_format ("Y' u8");
|
||||||
case 2: return babl_format ("Y'A u8");
|
case 2: return babl_format ("Y'A u8");
|
||||||
case 3: return babl_format ("R'G'B' u8");
|
case 3: return babl_format ("R'G'B' u8");
|
||||||
case 4: return babl_format ("R'G'B'A u8");
|
case 4: return babl_format ("R'G'B'A u8");
|
||||||
}
|
}
|
||||||
|
|
||||||
g_warning ("bpp !(>0 && <=4)");
|
g_warning ("bpp !(>0 && <=4)");
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,51 +153,56 @@ process (GeglOperation *operation,
|
|||||||
gpointer context_id)
|
gpointer context_id)
|
||||||
{
|
{
|
||||||
GimpOperationTileSource *self = GIMP_OPERATION_TILE_SOURCE (operation);
|
GimpOperationTileSource *self = GIMP_OPERATION_TILE_SOURCE (operation);
|
||||||
|
GeglBuffer *output;
|
||||||
GeglBuffer *output;
|
Babl *format;
|
||||||
Babl *format;
|
|
||||||
|
|
||||||
if (self->tile_manager)
|
if (self->tile_manager)
|
||||||
{
|
{
|
||||||
PixelRegion srcPR;
|
PixelRegion srcPR;
|
||||||
gpointer pr;
|
gpointer pr;
|
||||||
GeglRectangle extent = {0,0,
|
GeglRectangle extent = { 0, 0,
|
||||||
tile_manager_width (self->tile_manager),
|
tile_manager_width (self->tile_manager),
|
||||||
tile_manager_height (self->tile_manager)};
|
tile_manager_height (self->tile_manager) };
|
||||||
|
|
||||||
format = bpp_to_format (tile_manager_bpp (self->tile_manager));
|
format = bpp_to_format (tile_manager_bpp (self->tile_manager));
|
||||||
|
|
||||||
|
|
||||||
output = gegl_buffer_new (&extent, format);
|
output = gegl_buffer_new (&extent, format);
|
||||||
|
|
||||||
pixel_region_init (&srcPR, self->tile_manager,
|
pixel_region_init (&srcPR, self->tile_manager,
|
||||||
extent.x, extent.y, extent.width, extent.height, FALSE);
|
extent.x, extent.y,
|
||||||
|
extent.width, extent.height,
|
||||||
|
FALSE);
|
||||||
|
|
||||||
for (pr = pixel_regions_register (1, &srcPR); pr; pr = pixel_regions_process (pr))
|
for (pr = pixel_regions_register (1, &srcPR);
|
||||||
|
pr;
|
||||||
|
pr = pixel_regions_process (pr))
|
||||||
{
|
{
|
||||||
GeglRectangle rect = {srcPR.x, srcPR.y, srcPR.w, srcPR.h};
|
GeglRectangle rect = { srcPR.x, srcPR.y, srcPR.w, srcPR.h };
|
||||||
|
|
||||||
gegl_buffer_set (output, &rect, format, srcPR.data);
|
gegl_buffer_set (output, &rect, format, srcPR.data);
|
||||||
}
|
}
|
||||||
gegl_operation_set_data (operation, context_id, "output", G_OBJECT (output));
|
|
||||||
|
gegl_operation_set_data (operation, context_id,
|
||||||
|
"output", G_OBJECT (output));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GeglRectangle
|
static GeglRectangle
|
||||||
get_defined_region (GeglOperation *operation)
|
get_defined_region (GeglOperation *operation)
|
||||||
{
|
{
|
||||||
GeglRectangle result = {0,0,0,0};
|
GimpOperationTileSource *self = GIMP_OPERATION_TILE_SOURCE (operation);
|
||||||
GimpOperationTileSource *self = GIMP_OPERATION_TILE_SOURCE (operation);
|
GeglRectangle result = { 0, };
|
||||||
|
|
||||||
if (!self->tile_manager)
|
if (self->tile_manager)
|
||||||
{
|
{
|
||||||
return result;
|
result.x = 0;
|
||||||
|
result.y = 0;
|
||||||
|
result.width = tile_manager_width (self->tile_manager);
|
||||||
|
result.height = tile_manager_height (self->tile_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.x = 0;
|
|
||||||
result.y = 0;
|
|
||||||
result.width = tile_manager_width (self->tile_manager);
|
|
||||||
result.height = tile_manager_height (self->tile_manager);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* GIMP - The GNU Image Manipulation Program
|
/* GIMP - The GNU Image Manipulation Program
|
||||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
*
|
*
|
||||||
* gimpops.c
|
* gimpoperationtilesource.h
|
||||||
* Copyright (C) 2007 Øyvind Kolås <pippin@gimp.org>
|
* Copyright (C) 2007 Øyvind Kolås <pippin@gimp.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -19,39 +19,35 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GIMP_OPERATION_TILE_SOURCE_H
|
#ifndef __GIMP_OPERATION_TILE_SOURCE_H__
|
||||||
#define _GIMP_OPERATION_TILE_SOURCE_H
|
#define __GIMP_OPERATION_TILE_SOURCE_H__
|
||||||
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include "gegl/gegl-types.h"
|
|
||||||
#include "gegl/gegl-operation-source.h"
|
#include "gegl/gegl-operation-source.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#define GIMP_TYPE_OPERATION_TILE_SOURCE (gimp_operation_tile_source_get_type ())
|
#define GIMP_TYPE_OPERATION_TILE_SOURCE (gimp_operation_tile_source_get_type ())
|
||||||
#define GIMP_OPERATION_TILE_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_TILE_SOURCE, GimpOperationTileSource))
|
#define GIMP_OPERATION_TILE_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_TILE_SOURCE, GimpOperationTileSource))
|
||||||
#define GIMP_OPERATION_TILE_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_TILE_SOURCE, GimpOperationTileSourceClass))
|
#define GIMP_OPERATION_TILE_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_TILE_SOURCE, GimpOperationTileSourceClass))
|
||||||
#define GIMP_OPERATION_TILE_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_TILE_SOURCE, GimpOperationTileSourceClass))
|
#define GIMP_OPERATION_TILE_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_TILE_SOURCE, GimpOperationTileSourceClass))
|
||||||
|
|
||||||
typedef struct _GimpOperationTileSource GimpOperationTileSource;
|
|
||||||
struct _GimpOperationTileSource
|
|
||||||
{
|
|
||||||
GeglOperationSourceClass operation_source;
|
|
||||||
gpointer tile_manager;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _GimpOperationTileSourceClass GimpOperationTileSourceClass;
|
typedef struct _GimpOperationTileSourceClass GimpOperationTileSourceClass;
|
||||||
struct _GimpOperationTileSourceClass
|
|
||||||
|
struct _GimpOperationTileSource
|
||||||
{
|
{
|
||||||
GeglOperationSourceClass operation_source_class;
|
GeglOperationSource parent_instance;
|
||||||
|
|
||||||
|
TileManager *tile_manager;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gimp_operation_tile_source_get_type (void) G_GNUC_CONST;
|
struct _GimpOperationTileSourceClass
|
||||||
|
{
|
||||||
|
GeglOperationSourceClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif
|
GType gimp_operation_tile_source_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __GIMP_OPERATION_TILE_SOURCE_H__ */
|
||||||
|
@ -279,8 +279,6 @@ static const GOptionEntry main_entries[] =
|
|||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
void gimp_gegl_ops_init (void);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc,
|
main (int argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
@ -386,8 +384,6 @@ main (int argc,
|
|||||||
|
|
||||||
gimp_init_signal_handlers ();
|
gimp_init_signal_handlers ();
|
||||||
|
|
||||||
gimp_gegl_ops_init ();
|
|
||||||
|
|
||||||
app_run (argv[0],
|
app_run (argv[0],
|
||||||
filenames,
|
filenames,
|
||||||
system_gimprc,
|
system_gimprc,
|
||||||
|
Reference in New Issue
Block a user