gimp/app/gegl/gimp-gegl.c

81 lines
2.2 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimp-gegl.c
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gegl.h>
#include "gimp-gegl-types.h"
#include "base/tile.h"
#include "config/gimpbaseconfig.h"
#include "operations/gimp-operations.h"
#include "core/gimp.h"
#include "gimp-babl.h"
#include "gimp-gegl.h"
static void gimp_gegl_notify_tile_cache_size (GimpBaseConfig *config);
void
gimp_gegl_init (Gimp *gimp)
{
GimpBaseConfig *config;
g_return_if_fail (GIMP_IS_GIMP (gimp));
config = GIMP_BASE_CONFIG (gimp->config);
g_object_set (gegl_config (),
"tile-width", TILE_WIDTH,
"tile-height", TILE_HEIGHT,
"cache-size", (gint) MIN (config->tile_cache_size, G_MAXINT),
NULL);
/* turn down the precision of babl - permitting use of lookup tables for
* gamma conversions, this precision is anyways high enough for both 8bit
* and 16bit operation
*/
g_object_set (gegl_config (),
"babl-tolerance", 0.00015,
NULL);
g_signal_connect (config, "notify::tile-cache-size",
G_CALLBACK (gimp_gegl_notify_tile_cache_size),
NULL);
gimp_babl_init ();
gimp_operations_init (gimp);
}
static void
gimp_gegl_notify_tile_cache_size (GimpBaseConfig *config)
{
g_object_set (gegl_config (),
"cache-size", (gint) MIN (config->tile_cache_size, G_MAXINT),
NULL);
}