mirror of https://github.com/GNOME/gimp.git
Bill Skaggs <weskaggs@primate.ucdavis.edu>
Merged 24663:24709 from trunk. svn path=/branches/weskaggs/; revision=24712
This commit is contained in:
parent
0cfd7036dd
commit
5750e8296b
|
@ -1,3 +1,7 @@
|
|||
2008-01-21 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||
|
||||
Merged 24663:24709 from trunk.
|
||||
|
||||
2008-01-25 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||
|
||||
* app/core/gimpdatafactory.[ch]
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
_("GNU Image Manipulation Program")
|
||||
|
||||
#define GIMP_COPYRIGHT \
|
||||
_("Copyright © 1995-2007\n" \
|
||||
_("Copyright © 1995-2008\n" \
|
||||
"Spencer Kimball, Peter Mattis and the GIMP Development Team")
|
||||
|
||||
#define GIMP_LICENSE \
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "actions-types.h"
|
||||
|
|
|
@ -431,11 +431,12 @@ boundary_add_seg (Boundary *boundary,
|
|||
boundary->segs = g_renew (BoundSeg, boundary->segs, boundary->max_segs);
|
||||
}
|
||||
|
||||
boundary->segs[boundary->num_segs].x1 = x1;
|
||||
boundary->segs[boundary->num_segs].y1 = y1;
|
||||
boundary->segs[boundary->num_segs].x2 = x2;
|
||||
boundary->segs[boundary->num_segs].y2 = y2;
|
||||
boundary->segs[boundary->num_segs].x1 = x1;
|
||||
boundary->segs[boundary->num_segs].y1 = y1;
|
||||
boundary->segs[boundary->num_segs].x2 = x2;
|
||||
boundary->segs[boundary->num_segs].y2 = y2;
|
||||
boundary->segs[boundary->num_segs].open = open;
|
||||
|
||||
boundary->num_segs ++;
|
||||
}
|
||||
|
||||
|
@ -457,10 +458,11 @@ find_empty_segs (PixelRegion *maskPR,
|
|||
gint start = 0;
|
||||
gint end = 0;
|
||||
gint endx = 0;
|
||||
gint dstep = 0;
|
||||
gint val, last;
|
||||
gint x, tilex;
|
||||
gint bpp = 0;
|
||||
gint tilex = -1;
|
||||
gint last = -1;
|
||||
gint l_num_empty;
|
||||
gint x;
|
||||
|
||||
*num_empty = 0;
|
||||
|
||||
|
@ -491,17 +493,15 @@ find_empty_segs (PixelRegion *maskPR,
|
|||
x2 = -1;
|
||||
}
|
||||
|
||||
tilex = -1;
|
||||
empty_segs[(*num_empty)++] = 0;
|
||||
last = -1;
|
||||
|
||||
l_num_empty = *num_empty;
|
||||
|
||||
bpp = maskPR->bytes;
|
||||
|
||||
if (! maskPR->tiles)
|
||||
{
|
||||
data = maskPR->data + scanline * maskPR->rowstride;
|
||||
dstep = maskPR->bytes;
|
||||
|
||||
endx = end;
|
||||
}
|
||||
|
||||
|
@ -518,13 +518,12 @@ find_empty_segs (PixelRegion *maskPR,
|
|||
tile = tile_manager_get_tile (maskPR->tiles,
|
||||
x, scanline, TRUE, FALSE);
|
||||
data = ((const guchar *) tile_data_pointer (tile, x, scanline) +
|
||||
tile_bpp (tile) - 1);
|
||||
bpp - 1);
|
||||
|
||||
tilex = x / TILE_WIDTH;
|
||||
dstep = tile_bpp (tile);
|
||||
}
|
||||
|
||||
endx = x + (TILE_WIDTH - (x%TILE_WIDTH));
|
||||
endx = x + (TILE_WIDTH - (x % TILE_WIDTH));
|
||||
endx = MIN (end, endx);
|
||||
}
|
||||
|
||||
|
@ -532,15 +531,21 @@ find_empty_segs (PixelRegion *maskPR,
|
|||
{
|
||||
for (; x < endx; x++)
|
||||
{
|
||||
if (*data > threshold)
|
||||
if (x >= x1 && x < x2)
|
||||
val = -1;
|
||||
else
|
||||
val = 1;
|
||||
else
|
||||
val = -1;
|
||||
gint val;
|
||||
|
||||
data += dstep;
|
||||
if (*data > threshold)
|
||||
{
|
||||
if (x >= x1 && x < x2)
|
||||
val = -1;
|
||||
else
|
||||
val = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
val = -1;
|
||||
}
|
||||
|
||||
data += bpp;
|
||||
|
||||
if (last != val)
|
||||
empty_segs[l_num_empty++] = x;
|
||||
|
@ -552,12 +557,14 @@ find_empty_segs (PixelRegion *maskPR,
|
|||
{
|
||||
for (; x < endx; x++)
|
||||
{
|
||||
gint val;
|
||||
|
||||
if (*data > threshold)
|
||||
val = 1;
|
||||
else
|
||||
val = -1;
|
||||
|
||||
data += dstep;
|
||||
data += bpp;
|
||||
|
||||
if (last != val)
|
||||
empty_segs[l_num_empty++] = x;
|
||||
|
@ -626,13 +633,17 @@ make_horiz_segs (Boundary *boundary,
|
|||
e_e = *empty++;
|
||||
|
||||
if (e_s <= start && e_e >= end)
|
||||
process_horiz_seg (boundary,
|
||||
start, scanline, end, scanline, top);
|
||||
{
|
||||
process_horiz_seg (boundary,
|
||||
start, scanline, end, scanline, top);
|
||||
}
|
||||
else if ((e_s > start && e_s < end) ||
|
||||
(e_e < end && e_e > start))
|
||||
process_horiz_seg (boundary,
|
||||
MAX (e_s, start), scanline,
|
||||
MIN (e_e, end), scanline, top);
|
||||
{
|
||||
process_horiz_seg (boundary,
|
||||
MAX (e_s, start), scanline,
|
||||
MIN (e_e, end), scanline, top);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,22 +59,15 @@ color_balance_init (ColorBalance *cb)
|
|||
g_return_if_fail (cb != NULL);
|
||||
|
||||
for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
|
||||
color_balance_range_reset (cb, range);
|
||||
{
|
||||
cb->cyan_red[range] = 0.0;
|
||||
cb->magenta_green[range] = 0.0;
|
||||
cb->yellow_blue[range] = 0.0;
|
||||
}
|
||||
|
||||
cb->preserve_luminosity = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
color_balance_range_reset (ColorBalance *cb,
|
||||
GimpTransferMode range)
|
||||
{
|
||||
g_return_if_fail (cb != NULL);
|
||||
|
||||
cb->cyan_red[range] = 0.0;
|
||||
cb->magenta_green[range] = 0.0;
|
||||
cb->yellow_blue[range] = 0.0;
|
||||
}
|
||||
|
||||
void
|
||||
color_balance_create_lookup_tables (ColorBalance *cb)
|
||||
{
|
||||
|
|
|
@ -35,8 +35,6 @@ struct _ColorBalance
|
|||
|
||||
|
||||
void color_balance_init (ColorBalance *cb);
|
||||
void color_balance_range_reset (ColorBalance *cb,
|
||||
GimpTransferMode range);
|
||||
void color_balance_create_lookup_tables (ColorBalance *cb);
|
||||
void color_balance (ColorBalance *cb,
|
||||
PixelRegion *srcPR,
|
||||
|
|
|
@ -37,19 +37,13 @@ hue_saturation_init (HueSaturation *hs)
|
|||
g_return_if_fail (hs != NULL);
|
||||
|
||||
hs->overlap = 0.0;
|
||||
|
||||
for (partition = GIMP_ALL_HUES; partition <= GIMP_MAGENTA_HUES; partition++)
|
||||
hue_saturation_partition_reset (hs, partition);
|
||||
}
|
||||
|
||||
void
|
||||
hue_saturation_partition_reset (HueSaturation *hs,
|
||||
GimpHueRange partition)
|
||||
{
|
||||
g_return_if_fail (hs != NULL);
|
||||
|
||||
hs->hue[partition] = 0.0;
|
||||
hs->lightness[partition] = 0.0;
|
||||
hs->saturation[partition] = 0.0;
|
||||
{
|
||||
hs->hue[partition] = 0.0;
|
||||
hs->lightness[partition] = 0.0;
|
||||
hs->saturation[partition] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -65,6 +59,7 @@ hue_saturation_calculate_transfers (HueSaturation *hs)
|
|||
for (hue = 0; hue < 6; hue++)
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
/* Hue */
|
||||
value = (hs->hue[0] + hs->hue[hue + 1]) * 255.0 / 360.0;
|
||||
if ((i + value) < 0)
|
||||
hs->hue_transfer[hue][i] = 255 + (i + value);
|
||||
|
|
|
@ -34,8 +34,6 @@ struct _HueSaturation
|
|||
|
||||
|
||||
void hue_saturation_init (HueSaturation *hs);
|
||||
void hue_saturation_partition_reset (HueSaturation *hs,
|
||||
GimpHueRange partition);
|
||||
void hue_saturation_calculate_transfers (HueSaturation *hs);
|
||||
void hue_saturation (HueSaturation *hs,
|
||||
PixelRegion *srcPR,
|
||||
|
|
|
@ -51,40 +51,6 @@ levels_init (Levels *levels)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
levels_calculate_transfers (Levels *levels)
|
||||
{
|
||||
gdouble inten;
|
||||
gint i, j;
|
||||
|
||||
g_return_if_fail (levels != NULL);
|
||||
|
||||
/* Recalculate the levels arrays */
|
||||
for (j = 0; j < 5; j++)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
/* determine input intensity */
|
||||
if (levels->high_input[j] != levels->low_input[j])
|
||||
{
|
||||
inten = ((gdouble) (i - levels->low_input[j]) /
|
||||
(double) (levels->high_input[j] - levels->low_input[j]));
|
||||
}
|
||||
else
|
||||
{
|
||||
inten = (gdouble) (i - levels->low_input[j]);
|
||||
}
|
||||
|
||||
inten = CLAMP (inten, 0.0, 1.0);
|
||||
|
||||
if (levels->gamma[j] != 0.0)
|
||||
inten = pow (inten, (1.0 / levels->gamma[j]));
|
||||
|
||||
levels->input[j][i] = (guchar) (inten * 255.0 + 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gfloat
|
||||
levels_lut_func (Levels *levels,
|
||||
gint n_channels,
|
||||
|
|
|
@ -29,17 +29,14 @@ struct _Levels
|
|||
|
||||
gint low_output[5];
|
||||
gint high_output[5];
|
||||
|
||||
guchar input[5][256]; /* this is used only by the gui */
|
||||
};
|
||||
|
||||
|
||||
void levels_init (Levels *levels);
|
||||
void levels_calculate_transfers (Levels *levels);
|
||||
gfloat levels_lut_func (Levels *levels,
|
||||
gint n_channels,
|
||||
gint channel,
|
||||
gfloat value);
|
||||
void levels_init (Levels *levels);
|
||||
gfloat levels_lut_func (Levels *levels,
|
||||
gint n_channels,
|
||||
gint channel,
|
||||
gfloat value);
|
||||
|
||||
|
||||
#endif /* __LEVELS_H__ */
|
||||
|
|
|
@ -1079,4 +1079,3 @@ gimp_message_valist (Gimp *gimp,
|
|||
|
||||
g_free (message);
|
||||
}
|
||||
|
||||
|
|
|
@ -190,5 +190,7 @@ void gimp_message_valist (Gimp *gimp,
|
|||
const gchar *format,
|
||||
va_list args);
|
||||
|
||||
gboolean gimp_use_gegl (Gimp *gimp);
|
||||
|
||||
|
||||
#endif /* __GIMP_H__ */
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "base/pixel-region.h"
|
||||
|
||||
/* temp */
|
||||
#include "config/gimpcoreconfig.h"
|
||||
#include "gimp.h"
|
||||
#include "gimpimage.h"
|
||||
|
||||
|
@ -60,7 +59,7 @@ gimp_drawable_desaturate (GimpDrawable *drawable,
|
|||
g_return_if_fail (gimp_drawable_is_rgb (drawable));
|
||||
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
|
||||
|
||||
if (GIMP_ITEM (drawable)->image->gimp->config->use_gegl)
|
||||
if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
|
||||
{
|
||||
GeglNode *desaturate;
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "base/pixel-region.h"
|
||||
|
||||
/* temp */
|
||||
#include "config/gimpcoreconfig.h"
|
||||
#include "gimp.h"
|
||||
#include "gimpimage.h"
|
||||
|
||||
|
@ -48,7 +47,7 @@ gimp_drawable_invert (GimpDrawable *drawable,
|
|||
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
|
||||
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
|
||||
|
||||
if (GIMP_ITEM (drawable)->image->gimp->config->use_gegl)
|
||||
if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
|
||||
{
|
||||
GeglNode *invert;
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "gegl/gimplevelsconfig.h"
|
||||
|
||||
/* temp */
|
||||
#include "config/gimpcoreconfig.h"
|
||||
#include "gimp.h"
|
||||
#include "gimpimage.h"
|
||||
|
||||
|
@ -87,7 +86,7 @@ gimp_drawable_levels (GimpDrawable *drawable,
|
|||
"high-output", high_output / 255.0,
|
||||
NULL);
|
||||
|
||||
if (GIMP_ITEM (drawable)->image->gimp->config->use_gegl)
|
||||
if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
|
||||
{
|
||||
GeglNode *levels;
|
||||
|
||||
|
@ -115,8 +114,8 @@ gimp_drawable_levels (GimpDrawable *drawable,
|
|||
if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
return;
|
||||
|
||||
gimp_levels_config_to_levels_cruft (config, &levels,
|
||||
gimp_drawable_is_rgb (drawable));
|
||||
gimp_levels_config_to_cruft (config, &levels,
|
||||
gimp_drawable_is_rgb (drawable));
|
||||
|
||||
lut = gimp_lut_new ();
|
||||
gimp_lut_setup (lut,
|
||||
|
@ -169,7 +168,7 @@ gimp_drawable_levels_stretch (GimpDrawable *drawable,
|
|||
|
||||
gimp_histogram_free (histogram);
|
||||
|
||||
if (GIMP_ITEM (drawable)->image->gimp->config->use_gegl)
|
||||
if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
|
||||
{
|
||||
GeglNode *levels;
|
||||
|
||||
|
@ -192,8 +191,8 @@ gimp_drawable_levels_stretch (GimpDrawable *drawable,
|
|||
Levels levels;
|
||||
GimpLut *lut;
|
||||
|
||||
gimp_levels_config_to_levels_cruft (config, &levels,
|
||||
gimp_drawable_is_rgb (drawable));
|
||||
gimp_levels_config_to_cruft (config, &levels,
|
||||
gimp_drawable_is_rgb (drawable));
|
||||
|
||||
lut = gimp_lut_new ();
|
||||
gimp_lut_setup (lut,
|
||||
|
|
|
@ -150,11 +150,10 @@ gimp_image_undo_free (GimpImage *image)
|
|||
/* If the image was dirty, but could become clean by redo-ing
|
||||
* some actions, then it should now become 'infinitely' dirty.
|
||||
* This is because we've just nuked the actions that would allow
|
||||
* the image to become clean again. The only hope for salvation
|
||||
* is to save the image now! -- austin
|
||||
* the image to become clean again.
|
||||
*/
|
||||
if (image->dirty < 0)
|
||||
image->dirty = 10000;
|
||||
image->dirty = 100000;
|
||||
|
||||
/* The same applies to the case where the image would become clean
|
||||
* due to undo actions, but since user can't undo without an undo
|
||||
|
@ -195,15 +194,6 @@ gimp_image_undo_group_start (GimpImage *image,
|
|||
/* nuke the redo stack */
|
||||
gimp_image_undo_free_redo (image);
|
||||
|
||||
/* If the image was dirty, but could become clean by redo-ing
|
||||
* some actions, then it should now become 'infinitely' dirty.
|
||||
* This is because we've just nuked the actions that would allow
|
||||
* the image to become clean again. The only hope for salvation
|
||||
* is to save the image now! -- austin
|
||||
*/
|
||||
if (image->dirty < 0)
|
||||
image->dirty = 10000;
|
||||
|
||||
undo_group = gimp_undo_stack_new (image);
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (undo_group), name);
|
||||
|
@ -246,11 +236,11 @@ gimp_image_undo_group_end (GimpImage *image)
|
|||
}
|
||||
|
||||
GimpUndo *
|
||||
gimp_image_undo_push (GimpImage *image,
|
||||
GType object_type,
|
||||
GimpUndoType undo_type,
|
||||
const gchar *name,
|
||||
GimpDirtyMask dirty_mask,
|
||||
gimp_image_undo_push (GimpImage *image,
|
||||
GType object_type,
|
||||
GimpUndoType undo_type,
|
||||
const gchar *name,
|
||||
GimpDirtyMask dirty_mask,
|
||||
...)
|
||||
{
|
||||
GParameter *params = NULL;
|
||||
|
@ -292,15 +282,6 @@ gimp_image_undo_push (GimpImage *image,
|
|||
/* nuke the redo stack */
|
||||
gimp_image_undo_free_redo (image);
|
||||
|
||||
/* If the image was dirty, but could become clean by redo-ing
|
||||
* some actions, then it should now become 'infinitely' dirty.
|
||||
* This is because we've just nuked the actions that would allow
|
||||
* the image to become clean again. The only hope for salvation
|
||||
* is to save the image now! -- austin
|
||||
*/
|
||||
if (image->dirty < 0)
|
||||
image->dirty = 10000;
|
||||
|
||||
if (image->pushing_undo_group == GIMP_UNDO_GROUP_NONE)
|
||||
{
|
||||
gimp_undo_stack_push_undo (image->undo_stack, undo);
|
||||
|
@ -473,9 +454,7 @@ gimp_image_undo_free_space (GimpImage *image)
|
|||
static void
|
||||
gimp_image_undo_free_redo (GimpImage *image)
|
||||
{
|
||||
GimpContainer *container;
|
||||
|
||||
container = image->redo_stack->undos;
|
||||
GimpContainer *container = image->redo_stack->undos;
|
||||
|
||||
#ifdef DEBUG_IMAGE_UNDO
|
||||
g_printerr ("redo_steps: %d redo_bytes: %ld\n",
|
||||
|
@ -483,6 +462,9 @@ gimp_image_undo_free_redo (GimpImage *image)
|
|||
(glong) gimp_object_get_memsize (GIMP_OBJECT (container), NULL));
|
||||
#endif
|
||||
|
||||
if (gimp_container_is_empty (container))
|
||||
return;
|
||||
|
||||
while (gimp_container_num_children (container) > 0)
|
||||
{
|
||||
GimpUndo *freed = gimp_undo_stack_free_bottom (image->redo_stack,
|
||||
|
@ -499,6 +481,19 @@ gimp_image_undo_free_redo (GimpImage *image)
|
|||
|
||||
g_object_unref (freed);
|
||||
}
|
||||
|
||||
/* We need to use <= here because the undo counter has already been
|
||||
* incremented at this point.
|
||||
*/
|
||||
if (image->dirty <= 0)
|
||||
{
|
||||
/* If the image was dirty, but could become clean by redo-ing
|
||||
* some actions, then it should now become 'infinitely' dirty.
|
||||
* This is because we've just nuked the actions that would allow
|
||||
* the image to become clean again.
|
||||
*/
|
||||
image->dirty = 100000;
|
||||
}
|
||||
}
|
||||
|
||||
static GimpDirtyMask
|
||||
|
|
|
@ -1978,11 +1978,11 @@ unlink_item_callback (GObject *object,
|
|||
*
|
||||
* The image is dirty (ie, needs saving) if counter is non-zero.
|
||||
*
|
||||
* If the counter is around 10000, this is due to undo-ing back
|
||||
* before a saved version, then mutating the image (thus destroying
|
||||
* If the counter is around 100000, this is due to undo-ing back
|
||||
* before a saved version, then changing the image (thus destroying
|
||||
* the redo stack). Once this has happened, it's impossible to get
|
||||
* the image back to the state on disk, since the redo info has been
|
||||
* freed. See undo.c for the gorey details.
|
||||
* freed. See gimpimage-undo.c for the gory details.
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
#include "gimpprojection-construct.h"
|
||||
|
||||
|
||||
/* halfway between G_PRIORITY_HIGH_IDLE and G_PRIORITY_DEFAULT_IDLE */
|
||||
#define GIMP_PROJECTION_IDLE_PRIORITY 150
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
UPDATE,
|
||||
|
@ -544,7 +548,7 @@ gimp_projection_idle_render_init (GimpProjection *proj)
|
|||
gimp_projection_idle_render_next_area (proj);
|
||||
|
||||
proj->idle_render.idle_id =
|
||||
g_idle_add_full (G_PRIORITY_HIGH_IDLE,
|
||||
g_idle_add_full (GIMP_PROJECTION_IDLE_PRIORITY,
|
||||
gimp_projection_idle_render_callback, proj,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
@ -112,11 +112,7 @@ about_dialog_create (GimpContext *context)
|
|||
"role", "about-dialog",
|
||||
"window-position", GTK_WIN_POS_CENTER,
|
||||
"title", _("About GIMP"),
|
||||
#if GTK_CHECK_VERSION (2, 11, 0)
|
||||
"program-name", GIMP_ACRONYM,
|
||||
#else
|
||||
"name", GIMP_ACRONYM,
|
||||
#endif
|
||||
"version", GIMP_VERSION,
|
||||
"copyright", GIMP_COPYRIGHT,
|
||||
"comments", GIMP_NAME,
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
|
@ -81,7 +82,7 @@
|
|||
|
||||
|
||||
#define DEFAULT_EVENT_SMOOTHING 0.7
|
||||
|
||||
#define DEFAULT_EVENT_FILTER 0.5
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
|
@ -1251,6 +1252,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
if (gimp_display_shell_eval_event (shell,
|
||||
&image_coords,
|
||||
DEFAULT_EVENT_SMOOTHING,
|
||||
DEFAULT_EVENT_FILTER,
|
||||
history_events[i]->time))
|
||||
{
|
||||
tool_manager_motion_active (gimp,
|
||||
|
@ -1272,6 +1274,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
if (gimp_display_shell_eval_event (shell,
|
||||
&image_coords,
|
||||
DEFAULT_EVENT_SMOOTHING,
|
||||
DEFAULT_EVENT_FILTER,
|
||||
time))
|
||||
{
|
||||
tool_manager_motion_active (gimp,
|
||||
|
@ -1292,7 +1295,11 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
/* Early removal of useless events saves CPU time.
|
||||
* Smoothing is 0.0 here for coasting.
|
||||
*/
|
||||
if (gimp_display_shell_eval_event (shell, &image_coords, 0.0, time))
|
||||
if (gimp_display_shell_eval_event (shell,
|
||||
&image_coords,
|
||||
0.0,
|
||||
DEFAULT_EVENT_FILTER,
|
||||
time))
|
||||
{
|
||||
tool_manager_oper_update_active (gimp,
|
||||
&image_coords, state,
|
||||
|
|
|
@ -210,6 +210,7 @@ gboolean
|
|||
gimp_display_shell_eval_event (GimpDisplayShell *shell,
|
||||
GimpCoords *coords,
|
||||
gdouble inertia_factor,
|
||||
gdouble filter_treshhold,
|
||||
guint32 time)
|
||||
{
|
||||
const gdouble smooth_factor = 0.3;
|
||||
|
@ -230,10 +231,10 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
|
|||
gdouble dx = coords->delta_x = shell->last_coords.x - coords->x;
|
||||
gdouble dy = coords->delta_y = shell->last_coords.y - coords->y;
|
||||
|
||||
/* Events with distances less than 1 in either motion direction
|
||||
* are not worth handling.
|
||||
/* Events with distances less than the filter_threshold are not
|
||||
worth handling.
|
||||
*/
|
||||
if (fabs (dx) < 1.0 && fabs (dy) < 1.0)
|
||||
if (fabs (dx) < filter_treshhold && fabs (dy) < filter_treshhold)
|
||||
return FALSE;
|
||||
|
||||
coords->delta_time = thistime - shell->last_disp_motion_time;
|
||||
|
@ -260,7 +261,7 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
|
|||
coords->velocity = MIN (coords->velocity, 1.0);
|
||||
}
|
||||
|
||||
if (inertia_factor > 0)
|
||||
if (inertia_factor > 0 && coords->distance > 0)
|
||||
{
|
||||
/* Apply smoothing to X and Y. */
|
||||
|
||||
|
@ -292,7 +293,7 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
|
|||
new_x = (shell->last_coords.x - coords->delta_x) * 0.5 + coords->x * 0.5;
|
||||
new_y = (shell->last_coords.y - coords->delta_y) * 0.5 + coords->y * 0.5;
|
||||
|
||||
cur_deviation = SQR(coords->x-new_x) + SQR(coords->y-new_y);
|
||||
cur_deviation = SQR (coords->x - new_x) + SQR (coords->y - new_y);
|
||||
|
||||
while (cur_deviation >= max_deviation)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ void gimp_display_shell_get_device_state (GimpDisplayShell *shell,
|
|||
gboolean gimp_display_shell_eval_event (GimpDisplayShell *shell,
|
||||
GimpCoords *coords,
|
||||
gdouble inertia_factor,
|
||||
gdouble filter_threshhold,
|
||||
guint32 time);
|
||||
|
||||
|
||||
|
|
|
@ -251,8 +251,8 @@ selection_start (Selection *selection)
|
|||
{
|
||||
selection_stop (selection);
|
||||
|
||||
/* If this selection is paused or invisible, do not start it */
|
||||
if (selection->paused == 0 && selection->visible)
|
||||
/* If this selection is paused, do not start it */
|
||||
if (selection->paused == 0)
|
||||
{
|
||||
selection->timeout = g_idle_add ((GSourceFunc) selection_start_timeout,
|
||||
selection);
|
||||
|
@ -706,11 +706,11 @@ selection_start_timeout (Selection *selection)
|
|||
selection->num_segs_out);
|
||||
|
||||
|
||||
if (selection->segs_in)
|
||||
if (selection->segs_in && selection->visible)
|
||||
selection->timeout = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
|
||||
config->marching_ants_speed,
|
||||
(GSourceFunc) selection_timeout,
|
||||
selection, NULL);
|
||||
selection, NULL);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -8,15 +8,25 @@ libappgegl_a_SOURCES = \
|
|||
gimp-gegl-utils.c \
|
||||
gimp-gegl-utils.h \
|
||||
\
|
||||
gimpcolorbalanceconfig.c \
|
||||
gimpcolorbalanceconfig.h \
|
||||
gimpcolorizeconfig.c \
|
||||
gimpcolorizeconfig.h \
|
||||
gimpcurvesconfig.c \
|
||||
gimpcurvesconfig.h \
|
||||
gimphuesaturationconfig.c \
|
||||
gimphuesaturationconfig.h \
|
||||
gimplevelsconfig.c \
|
||||
gimplevelsconfig.h \
|
||||
gimpthresholdconfig.c \
|
||||
gimpthresholdconfig.h \
|
||||
\
|
||||
gimpoperationcolorbalance.c \
|
||||
gimpoperationcolorbalance.h \
|
||||
gimpoperationcolorize.c \
|
||||
gimpoperationcolorize.h \
|
||||
gimpoperationcurves.c \
|
||||
gimpoperationcurves.h \
|
||||
gimpoperationdesaturate.c \
|
||||
gimpoperationdesaturate.h \
|
||||
gimpoperationhuesaturation.c \
|
||||
|
@ -39,4 +49,5 @@ INCLUDES = \
|
|||
-I$(top_builddir)/app \
|
||||
-I$(top_srcdir)/app \
|
||||
$(GEGL_CFLAGS) \
|
||||
$(GDK_PIXBUF_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
typedef struct _GimpOperationColorBalance GimpOperationColorBalance;
|
||||
typedef struct _GimpOperationColorize GimpOperationColorize;
|
||||
typedef struct _GimpOperationCurves GimpOperationCurves;
|
||||
typedef struct _GimpOperationDesaturate GimpOperationDesaturate;
|
||||
typedef struct _GimpOperationHueSaturation GimpOperationHueSaturation;
|
||||
typedef struct _GimpOperationLevels GimpOperationLevels;
|
||||
|
@ -41,8 +42,12 @@ typedef struct _GimpOperationTileSource GimpOperationTileSource;
|
|||
|
||||
/* operation config objects */
|
||||
|
||||
typedef struct _GimpColorBalanceConfig GimpColorBalanceConfig;
|
||||
typedef struct _GimpColorizeConfig GimpColorizeConfig;
|
||||
typedef struct _GimpCurvesConfig GimpCurvesConfig;
|
||||
typedef struct _GimpHueSaturationConfig GimpHueSaturationConfig;
|
||||
typedef struct _GimpLevelsConfig GimpLevelsConfig;
|
||||
typedef struct _GimpThresholdConfig GimpThresholdConfig;
|
||||
|
||||
|
||||
#endif /* __GEGL_TYPES_H__ */
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "gimp-gegl.h"
|
||||
#include "gimpoperationcolorbalance.h"
|
||||
#include "gimpoperationcolorize.h"
|
||||
#include "gimpoperationcurves.h"
|
||||
#include "gimpoperationdesaturate.h"
|
||||
#include "gimpoperationhuesaturation.h"
|
||||
#include "gimpoperationlevels.h"
|
||||
|
@ -42,6 +43,7 @@ gimp_gegl_init (void)
|
|||
{
|
||||
g_type_class_ref (GIMP_TYPE_OPERATION_COLOR_BALANCE);
|
||||
g_type_class_ref (GIMP_TYPE_OPERATION_COLORIZE);
|
||||
g_type_class_ref (GIMP_TYPE_OPERATION_CURVES);
|
||||
g_type_class_ref (GIMP_TYPE_OPERATION_DESATURATE);
|
||||
g_type_class_ref (GIMP_TYPE_OPERATION_HUE_SATURATION);
|
||||
g_type_class_ref (GIMP_TYPE_OPERATION_LEVELS);
|
||||
|
|
|
@ -0,0 +1,245 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpcolorbalanceconfig.c
|
||||
* Copyright (C) 2007 Michael Natterer <mitch@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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
#include "gegl-types.h"
|
||||
|
||||
/* temp cruft */
|
||||
#include "base/color-balance.h"
|
||||
|
||||
#include "gimpcolorbalanceconfig.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_RANGE,
|
||||
PROP_CYAN_RED,
|
||||
PROP_MAGENTA_GREEN,
|
||||
PROP_YELLOW_BLUE,
|
||||
PROP_PRESERVE_LUMINOSITY
|
||||
};
|
||||
|
||||
|
||||
static void gimp_color_balance_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_color_balance_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpColorBalanceConfig, gimp_color_balance_config,
|
||||
G_TYPE_OBJECT)
|
||||
|
||||
#define parent_class gimp_color_balance_config_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_color_balance_config_class_init (GimpColorBalanceConfigClass * klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = gimp_color_balance_config_set_property;
|
||||
object_class->get_property = gimp_color_balance_config_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_RANGE,
|
||||
g_param_spec_enum ("range",
|
||||
"range",
|
||||
"The affected range",
|
||||
GIMP_TYPE_TRANSFER_MODE,
|
||||
GIMP_MIDTONES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CYAN_RED,
|
||||
g_param_spec_double ("cyan-red",
|
||||
"Cyan-Red",
|
||||
"Cyan-Red",
|
||||
-1.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_MAGENTA_GREEN,
|
||||
g_param_spec_double ("magenta-green",
|
||||
"Magenta-Green",
|
||||
"Magenta-Green",
|
||||
-1.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_YELLOW_BLUE,
|
||||
g_param_spec_double ("yellow-blue",
|
||||
"Yellow-Blue",
|
||||
"Yellow-Blue",
|
||||
-1.0, 1.0, 1.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_PRESERVE_LUMINOSITY,
|
||||
g_param_spec_boolean ("preserve-luminosity",
|
||||
"Preserve Luminosity",
|
||||
"Preserve Luminosity",
|
||||
TRUE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_balance_config_init (GimpColorBalanceConfig *self)
|
||||
{
|
||||
gimp_color_balance_config_reset (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_balance_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpColorBalanceConfig *self = GIMP_COLOR_BALANCE_CONFIG (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_RANGE:
|
||||
g_value_set_enum (value, self->range);
|
||||
break;
|
||||
|
||||
case PROP_CYAN_RED:
|
||||
g_value_set_double (value, self->cyan_red[self->range]);
|
||||
break;
|
||||
|
||||
case PROP_MAGENTA_GREEN:
|
||||
g_value_set_double (value, self->magenta_green[self->range]);
|
||||
break;
|
||||
|
||||
case PROP_YELLOW_BLUE:
|
||||
g_value_set_double (value, self->yellow_blue[self->range]);
|
||||
break;
|
||||
|
||||
case PROP_PRESERVE_LUMINOSITY:
|
||||
g_value_set_boolean (value, self->preserve_luminosity);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_balance_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpColorBalanceConfig *self = GIMP_COLOR_BALANCE_CONFIG (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_RANGE:
|
||||
self->range = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_CYAN_RED:
|
||||
self->cyan_red[self->range] = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_MAGENTA_GREEN:
|
||||
self->magenta_green[self->range] = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_YELLOW_BLUE:
|
||||
self->yellow_blue[self->range] = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_PRESERVE_LUMINOSITY:
|
||||
self->preserve_luminosity = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_color_balance_config_reset (GimpColorBalanceConfig *config)
|
||||
{
|
||||
GimpTransferMode range;
|
||||
|
||||
g_return_if_fail (GIMP_IS_COLOR_BALANCE_CONFIG (config));
|
||||
|
||||
config->range = GIMP_MIDTONES;
|
||||
|
||||
for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
|
||||
{
|
||||
gimp_color_balance_config_reset_range (config, range);
|
||||
}
|
||||
|
||||
config->preserve_luminosity = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_color_balance_config_reset_range (GimpColorBalanceConfig *config,
|
||||
GimpTransferMode range)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_COLOR_BALANCE_CONFIG (config));
|
||||
|
||||
config->cyan_red[range] = 0.0;
|
||||
config->magenta_green[range] = 0.0;
|
||||
config->yellow_blue[range] = 0.0;
|
||||
}
|
||||
|
||||
|
||||
/* temp cruft */
|
||||
|
||||
void
|
||||
gimp_color_balance_config_to_cruft (GimpColorBalanceConfig *config,
|
||||
ColorBalance *cruft)
|
||||
{
|
||||
GimpTransferMode range;
|
||||
|
||||
g_return_if_fail (GIMP_IS_COLOR_BALANCE_CONFIG (config));
|
||||
g_return_if_fail (cruft != NULL);
|
||||
|
||||
for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
|
||||
{
|
||||
cruft->cyan_red[range] = config->cyan_red[range] * 100.0;
|
||||
cruft->magenta_green[range] = config->magenta_green[range] * 100.0;
|
||||
cruft->yellow_blue[range] = config->yellow_blue[range] * 100.0;
|
||||
}
|
||||
|
||||
cruft->preserve_luminosity = config->preserve_luminosity;
|
||||
|
||||
color_balance_create_lookup_tables (cruft);
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpcolorbalanceconfig.h
|
||||
* Copyright (C) 2007 Michael Natterer <mitch@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_COLOR_BALANCE_CONFIG_H__
|
||||
#define __GIMP_COLOR_BALANCE_CONFIG_H__
|
||||
|
||||
|
||||
#define GIMP_TYPE_COLOR_BALANCE_CONFIG (gimp_color_balance_config_get_type ())
|
||||
#define GIMP_COLOR_BALANCE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_BALANCE_CONFIG, GimpColorBalanceConfig))
|
||||
#define GIMP_COLOR_BALANCE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_BALANCE_CONFIG, GimpColorBalanceConfigClass))
|
||||
#define GIMP_IS_COLOR_BALANCE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_BALANCE_CONFIG))
|
||||
#define GIMP_IS_COLOR_BALANCE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_BALANCE_CONFIG))
|
||||
#define GIMP_COLOR_BALANCE_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_BALANCE_CONFIG, GimpColorBalanceConfigClass))
|
||||
|
||||
|
||||
typedef struct _GimpColorBalanceConfigClass GimpColorBalanceConfigClass;
|
||||
|
||||
struct _GimpColorBalanceConfig
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GimpTransferMode range;
|
||||
|
||||
gdouble cyan_red[3];
|
||||
gdouble magenta_green[3];
|
||||
gdouble yellow_blue[3];
|
||||
|
||||
gboolean preserve_luminosity;
|
||||
};
|
||||
|
||||
struct _GimpColorBalanceConfigClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_color_balance_config_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_color_balance_config_reset (GimpColorBalanceConfig *config);
|
||||
void gimp_color_balance_config_reset_range (GimpColorBalanceConfig *config,
|
||||
GimpTransferMode range);
|
||||
|
||||
/* temp cruft */
|
||||
void gimp_color_balance_config_to_cruft (GimpColorBalanceConfig *config,
|
||||
ColorBalance *cruft);
|
||||
|
||||
|
||||
#endif /* __GIMP_COLOR_BALANCE_CONFIG_H__ */
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
#include "gegl-types.h"
|
||||
|
||||
/* temp cruft */
|
||||
#include "base/colorize.h"
|
||||
|
||||
#include "gimpcolorizeconfig.h"
|
||||
|
||||
|
||||
|
@ -145,3 +148,33 @@ gimp_colorize_config_set_property (GObject *object,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_colorize_config_reset (GimpColorizeConfig *config)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_COLORIZE_CONFIG (config));
|
||||
|
||||
config->hue = 0.5;
|
||||
config->saturation = 0.5;
|
||||
config->lightness = 0.0;
|
||||
}
|
||||
|
||||
|
||||
/* temp cruft */
|
||||
|
||||
void
|
||||
gimp_colorize_config_to_cruft (GimpColorizeConfig *config,
|
||||
Colorize *cruft)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_COLORIZE_CONFIG (config));
|
||||
g_return_if_fail (cruft != NULL);
|
||||
|
||||
cruft->hue = config->hue * 360.0;
|
||||
cruft->saturation = config->saturation * 100.0;
|
||||
cruft->lightness = config->lightness * 100.0;
|
||||
|
||||
colorize_calculate (cruft);
|
||||
}
|
||||
|
|
|
@ -50,5 +50,11 @@ struct _GimpColorizeConfigClass
|
|||
|
||||
GType gimp_colorize_config_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_colorize_config_reset (GimpColorizeConfig *config);
|
||||
|
||||
/* temp cruft */
|
||||
void gimp_colorize_config_to_cruft (GimpColorizeConfig *config,
|
||||
Colorize *cruft);
|
||||
|
||||
|
||||
#endif /* __GIMP_COLORIZE_CONFIG_H__ */
|
||||
|
|
|
@ -0,0 +1,331 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpcurvesconfig.c
|
||||
* Copyright (C) 2007 Michael Natterer <mitch@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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
#include "gegl-types.h"
|
||||
|
||||
#include "base/gimphistogram.h"
|
||||
|
||||
/* temp cruft */
|
||||
#include "base/curves.h"
|
||||
|
||||
#include "gimpcurvesconfig.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CHANNEL,
|
||||
PROP_CURVE
|
||||
};
|
||||
|
||||
|
||||
static void gimp_curves_config_finalize (GObject *object);
|
||||
static void gimp_curves_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_curves_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCurvesConfig, gimp_curves_config, G_TYPE_OBJECT)
|
||||
|
||||
#define parent_class gimp_curves_config_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_curves_config_class_init (GimpCurvesConfigClass * klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_curves_config_finalize;
|
||||
object_class->set_property = gimp_curves_config_set_property;
|
||||
object_class->get_property = gimp_curves_config_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CHANNEL,
|
||||
g_param_spec_enum ("channel",
|
||||
"Channel",
|
||||
"The affected channel",
|
||||
GIMP_TYPE_HISTOGRAM_CHANNEL,
|
||||
GIMP_HISTOGRAM_VALUE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CURVE,
|
||||
g_param_spec_object ("curve",
|
||||
"Curve",
|
||||
"Curve",
|
||||
GIMP_TYPE_CURVE,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_curves_config_init (GimpCurvesConfig *self)
|
||||
{
|
||||
GimpHistogramChannel channel;
|
||||
|
||||
for (channel = GIMP_HISTOGRAM_VALUE;
|
||||
channel <= GIMP_HISTOGRAM_ALPHA;
|
||||
channel++)
|
||||
{
|
||||
self->curve[channel] = GIMP_CURVE (gimp_curve_new ("curves config"));
|
||||
}
|
||||
|
||||
gimp_curves_config_reset (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_curves_config_finalize (GObject *object)
|
||||
{
|
||||
GimpCurvesConfig *self = GIMP_CURVES_CONFIG (object);
|
||||
GimpHistogramChannel channel;
|
||||
|
||||
for (channel = GIMP_HISTOGRAM_VALUE;
|
||||
channel <= GIMP_HISTOGRAM_ALPHA;
|
||||
channel++)
|
||||
{
|
||||
if (self->curve[channel])
|
||||
{
|
||||
g_object_unref (self->curve[channel]);
|
||||
self->curve[channel] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_curves_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpCurvesConfig *self = GIMP_CURVES_CONFIG (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CHANNEL:
|
||||
g_value_set_enum (value, self->channel);
|
||||
break;
|
||||
|
||||
case PROP_CURVE:
|
||||
g_value_set_object (value, self->curve[self->channel]);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_curves_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpCurvesConfig *self = GIMP_CURVES_CONFIG (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CHANNEL:
|
||||
self->channel = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_CURVE:
|
||||
if (self->curve[self->channel])
|
||||
g_object_unref (self->curve[self->channel]);
|
||||
self->curve[self->channel] = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_curves_config_reset (GimpCurvesConfig *config)
|
||||
{
|
||||
GimpHistogramChannel channel;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CURVES_CONFIG (config));
|
||||
|
||||
config->channel = GIMP_HISTOGRAM_VALUE;
|
||||
|
||||
for (channel = GIMP_HISTOGRAM_VALUE;
|
||||
channel <= GIMP_HISTOGRAM_ALPHA;
|
||||
channel++)
|
||||
{
|
||||
gimp_curve_reset (config->curve[channel], FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_curves_config_reset_channel (GimpCurvesConfig *config,
|
||||
GimpHistogramChannel channel)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_CURVES_CONFIG (config));
|
||||
|
||||
gimp_curve_reset (config->curve[channel], FALSE);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_curves_config_load_cruft (GimpCurvesConfig *config,
|
||||
gpointer fp,
|
||||
GError **error)
|
||||
{
|
||||
FILE *file = fp;
|
||||
gint i, j;
|
||||
gint fields;
|
||||
gchar buf[50];
|
||||
gint index[5][GIMP_CURVE_NUM_POINTS];
|
||||
gint value[5][GIMP_CURVE_NUM_POINTS];
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CURVES_CONFIG (config), FALSE);
|
||||
g_return_val_if_fail (file != NULL, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
if (! fgets (buf, sizeof (buf), file) ||
|
||||
strcmp (buf, "# GIMP Curves File\n") != 0)
|
||||
{
|
||||
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_PARSE,
|
||||
_("not a GIMP Curves file"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
for (j = 0; j < GIMP_CURVE_NUM_POINTS; j++)
|
||||
{
|
||||
fields = fscanf (file, "%d %d ", &index[i][j], &value[i][j]);
|
||||
if (fields != 2)
|
||||
{
|
||||
/* FIXME: should have a helpful error message here */
|
||||
g_printerr ("fields != 2");
|
||||
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_PARSE,
|
||||
_("parse error"));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
GimpCurve *curve = config->curve[i];
|
||||
|
||||
gimp_data_freeze (GIMP_DATA (curve));
|
||||
|
||||
gimp_curve_set_curve_type (curve, GIMP_CURVE_SMOOTH);
|
||||
|
||||
for (j = 0; j < GIMP_CURVE_NUM_POINTS; j++)
|
||||
gimp_curve_set_point (curve, j, index[i][j], value[i][j]);
|
||||
|
||||
gimp_data_thaw (GIMP_DATA (curve));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_curves_config_save_cruft (GimpCurvesConfig *config,
|
||||
gpointer fp)
|
||||
{
|
||||
FILE *file = fp;
|
||||
gint i, j;
|
||||
gint32 index;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CURVES_CONFIG (config), FALSE);
|
||||
g_return_val_if_fail (file != NULL, FALSE);
|
||||
|
||||
fprintf (file, "# GIMP Curves File\n");
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
GimpCurve *curve = config->curve[i];
|
||||
|
||||
if (curve->curve_type == GIMP_CURVE_FREE)
|
||||
{
|
||||
/* pick representative points from the curve and make them
|
||||
* control points
|
||||
*/
|
||||
for (j = 0; j <= 8; j++)
|
||||
{
|
||||
index = CLAMP0255 (j * 32);
|
||||
|
||||
curve->points[j * 2][0] = index;
|
||||
curve->points[j * 2][1] = curve->curve[index];
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < GIMP_CURVE_NUM_POINTS; j++)
|
||||
fprintf (file, "%d %d ",
|
||||
curve->points[j][0],
|
||||
curve->points[j][1]);
|
||||
|
||||
fprintf (file, "\n");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* temp cruft */
|
||||
|
||||
void
|
||||
gimp_curves_config_to_cruft (GimpCurvesConfig *config,
|
||||
Curves *cruft,
|
||||
gboolean is_color)
|
||||
{
|
||||
GimpHistogramChannel channel;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CURVES_CONFIG (config));
|
||||
g_return_if_fail (cruft != NULL);
|
||||
|
||||
for (channel = GIMP_HISTOGRAM_VALUE;
|
||||
channel <= GIMP_HISTOGRAM_ALPHA;
|
||||
channel++)
|
||||
{
|
||||
gimp_curve_get_uchar (config->curve[channel], cruft->curve[channel]);
|
||||
}
|
||||
|
||||
if (! is_color)
|
||||
{
|
||||
gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_ALPHA], cruft->curve[1]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpcurvesconfig.h
|
||||
* Copyright (C) 2007 Michael Natterer <mitch@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_CURVES_CONFIG_H__
|
||||
#define __GIMP_CURVES_CONFIG_H__
|
||||
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h> /* eek */
|
||||
#include "core/core-types.h" /* eek */
|
||||
#include "core/gimpcurve.h" /* eek */
|
||||
|
||||
|
||||
#define GIMP_TYPE_CURVES_CONFIG (gimp_curves_config_get_type ())
|
||||
#define GIMP_CURVES_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CURVES_CONFIG, GimpCurvesConfig))
|
||||
#define GIMP_CURVES_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CURVES_CONFIG, GimpCurvesConfigClass))
|
||||
#define GIMP_IS_CURVES_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CURVES_CONFIG))
|
||||
#define GIMP_IS_CURVES_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CURVES_CONFIG))
|
||||
#define GIMP_CURVES_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CURVES_CONFIG, GimpCurvesConfigClass))
|
||||
|
||||
|
||||
typedef struct _GimpCurvesConfigClass GimpCurvesConfigClass;
|
||||
|
||||
struct _GimpCurvesConfig
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GimpHistogramChannel channel;
|
||||
|
||||
GimpCurve *curve[5];
|
||||
};
|
||||
|
||||
struct _GimpCurvesConfigClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_curves_config_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_curves_config_reset (GimpCurvesConfig *config);
|
||||
void gimp_curves_config_reset_channel (GimpCurvesConfig *config,
|
||||
GimpHistogramChannel channel);
|
||||
|
||||
gboolean gimp_curves_config_load_cruft (GimpCurvesConfig *config,
|
||||
gpointer fp,
|
||||
GError **error);
|
||||
gboolean gimp_curves_config_save_cruft (GimpCurvesConfig *config,
|
||||
gpointer fp);
|
||||
|
||||
|
||||
/* temp cruft */
|
||||
void gimp_curves_config_to_cruft (GimpCurvesConfig *config,
|
||||
Curves *cruft,
|
||||
gboolean is_color);
|
||||
|
||||
|
||||
#endif /* __GIMP_CURVES_CONFIG_H__ */
|
|
@ -0,0 +1,242 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimphuesaturationconfig.c
|
||||
* Copyright (C) 2007 Michael Natterer <mitch@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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#include "gegl-types.h"
|
||||
|
||||
/* temp cruft */
|
||||
#include "base/hue-saturation.h"
|
||||
|
||||
#include "gimphuesaturationconfig.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_RANGE,
|
||||
PROP_HUE,
|
||||
PROP_SATURATION,
|
||||
PROP_LIGHTNESS,
|
||||
PROP_OVERLAP
|
||||
};
|
||||
|
||||
|
||||
static void gimp_hue_saturation_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_hue_saturation_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpHueSaturationConfig, gimp_hue_saturation_config,
|
||||
G_TYPE_OBJECT)
|
||||
|
||||
#define parent_class gimp_hue_saturation_config_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_hue_saturation_config_class_init (GimpHueSaturationConfigClass * klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = gimp_hue_saturation_config_set_property;
|
||||
object_class->get_property = gimp_hue_saturation_config_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_RANGE,
|
||||
g_param_spec_enum ("range",
|
||||
"range",
|
||||
"The affected range",
|
||||
GIMP_TYPE_HUE_RANGE,
|
||||
GIMP_ALL_HUES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_HUE,
|
||||
g_param_spec_double ("hue",
|
||||
"Hue",
|
||||
"Hue",
|
||||
-1.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_SATURATION,
|
||||
g_param_spec_double ("saturation",
|
||||
"Saturation",
|
||||
"Saturation",
|
||||
-1.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_LIGHTNESS,
|
||||
g_param_spec_double ("lightness",
|
||||
"Lightness",
|
||||
"Lightness",
|
||||
-1.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_OVERLAP,
|
||||
g_param_spec_double ("overlap",
|
||||
"Overlap",
|
||||
"Overlap",
|
||||
0.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_hue_saturation_config_init (GimpHueSaturationConfig *self)
|
||||
{
|
||||
gimp_hue_saturation_config_reset (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_hue_saturation_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpHueSaturationConfig *self = GIMP_HUE_SATURATION_CONFIG (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_RANGE:
|
||||
g_value_set_enum (value, self->range);
|
||||
break;
|
||||
|
||||
case PROP_HUE:
|
||||
g_value_set_double (value, self->hue[self->range]);
|
||||
break;
|
||||
|
||||
case PROP_SATURATION:
|
||||
g_value_set_double (value, self->saturation[self->range]);
|
||||
break;
|
||||
|
||||
case PROP_LIGHTNESS:
|
||||
g_value_set_double (value, self->lightness[self->range]);
|
||||
break;
|
||||
|
||||
case PROP_OVERLAP:
|
||||
g_value_set_double (value, self->overlap);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_hue_saturation_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpHueSaturationConfig *self = GIMP_HUE_SATURATION_CONFIG (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_RANGE:
|
||||
self->range = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_HUE:
|
||||
self->hue[self->range] = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_SATURATION:
|
||||
self->saturation[self->range] = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_LIGHTNESS:
|
||||
self->lightness[self->range] = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_OVERLAP:
|
||||
self->overlap = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_hue_saturation_config_reset (GimpHueSaturationConfig *config)
|
||||
{
|
||||
GimpHueRange range;
|
||||
|
||||
g_return_if_fail (GIMP_IS_HUE_SATURATION_CONFIG (config));
|
||||
|
||||
config->range = GIMP_ALL_HUES;
|
||||
|
||||
for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++)
|
||||
{
|
||||
gimp_hue_saturation_config_reset_range (config, range);
|
||||
}
|
||||
|
||||
config->overlap = 0.0;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_hue_saturation_config_reset_range (GimpHueSaturationConfig *config,
|
||||
GimpHueRange range)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_HUE_SATURATION_CONFIG (config));
|
||||
|
||||
config->hue[range] = 0.0;
|
||||
config->saturation[range] = 0.0;
|
||||
config->lightness[range] = 0.0;
|
||||
}
|
||||
|
||||
|
||||
/* temp cruft */
|
||||
|
||||
void
|
||||
gimp_hue_saturation_config_to_cruft (GimpHueSaturationConfig *config,
|
||||
HueSaturation *cruft)
|
||||
{
|
||||
GimpHueRange range;
|
||||
|
||||
g_return_if_fail (GIMP_IS_HUE_SATURATION_CONFIG (config));
|
||||
g_return_if_fail (cruft != NULL);
|
||||
|
||||
for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++)
|
||||
{
|
||||
cruft->hue[range] = config->hue[range] * 180;
|
||||
cruft->saturation[range] = config->saturation[range] * 100;
|
||||
cruft->lightness[range] = config->lightness[range] * 100;
|
||||
}
|
||||
|
||||
cruft->overlap = config->overlap * 100;
|
||||
|
||||
hue_saturation_calculate_transfers (cruft);
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimphuesaturationconfig.h
|
||||
* Copyright (C) 2007 Michael Natterer <mitch@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_HUE_SATURATION_CONFIG_H__
|
||||
#define __GIMP_HUE_SATURATION_CONFIG_H__
|
||||
|
||||
|
||||
#define GIMP_TYPE_HUE_SATURATION_CONFIG (gimp_hue_saturation_config_get_type ())
|
||||
#define GIMP_HUE_SATURATION_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_HUE_SATURATION_CONFIG, GimpHueSaturationConfig))
|
||||
#define GIMP_HUE_SATURATION_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_HUE_SATURATION_CONFIG, GimpHueSaturationConfigClass))
|
||||
#define GIMP_IS_HUE_SATURATION_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_HUE_SATURATION_CONFIG))
|
||||
#define GIMP_IS_HUE_SATURATION_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_HUE_SATURATION_CONFIG))
|
||||
#define GIMP_HUE_SATURATION_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_HUE_SATURATION_CONFIG, GimpHueSaturationConfigClass))
|
||||
|
||||
|
||||
typedef struct _GimpHueSaturationConfigClass GimpHueSaturationConfigClass;
|
||||
|
||||
struct _GimpHueSaturationConfig
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GimpHueRange range;
|
||||
|
||||
gdouble hue[7];
|
||||
gdouble saturation[7];
|
||||
gdouble lightness[7];
|
||||
|
||||
gdouble overlap;
|
||||
};
|
||||
|
||||
struct _GimpHueSaturationConfigClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_hue_saturation_config_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_hue_saturation_config_reset (GimpHueSaturationConfig *config);
|
||||
void gimp_hue_saturation_config_reset_range (GimpHueSaturationConfig *config,
|
||||
GimpHueRange range);
|
||||
|
||||
/* temp cruft */
|
||||
void gimp_hue_saturation_config_to_cruft (GimpHueSaturationConfig *config,
|
||||
HueSaturation *cruft);
|
||||
|
||||
|
||||
#endif /* __GIMP_HUE_SATURATION_CONFIG_H__ */
|
|
@ -21,10 +21,15 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
#include "gegl-types.h"
|
||||
|
||||
|
@ -35,6 +40,8 @@
|
|||
|
||||
#include "gimplevelsconfig.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -413,13 +420,106 @@ gimp_levels_config_adjust_by_colors (GimpLevelsConfig *config,
|
|||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_levels_config_load_cruft (GimpLevelsConfig *config,
|
||||
gpointer fp,
|
||||
GError **error)
|
||||
{
|
||||
FILE *file = fp;
|
||||
gint low_input[5];
|
||||
gint high_input[5];
|
||||
gint low_output[5];
|
||||
gint high_output[5];
|
||||
gdouble gamma[5];
|
||||
gint i;
|
||||
gint fields;
|
||||
gchar buf[50];
|
||||
gchar *nptr;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_LEVELS_CONFIG (config), FALSE);
|
||||
g_return_val_if_fail (file != NULL, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
if (! fgets (buf, sizeof (buf), file) ||
|
||||
strcmp (buf, "# GIMP Levels File\n") != 0)
|
||||
{
|
||||
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_PARSE,
|
||||
_("not a GIMP Levels file"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
fields = fscanf (file, "%d %d %d %d ",
|
||||
&low_input[i],
|
||||
&high_input[i],
|
||||
&low_output[i],
|
||||
&high_output[i]);
|
||||
|
||||
if (fields != 4)
|
||||
goto error;
|
||||
|
||||
if (! fgets (buf, 50, file))
|
||||
goto error;
|
||||
|
||||
gamma[i] = g_ascii_strtod (buf, &nptr);
|
||||
|
||||
if (buf == nptr || errno == ERANGE)
|
||||
goto error;
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
config->low_input[i] = low_input[i] / 255.0;
|
||||
config->high_input[i] = high_input[i] / 255.0;
|
||||
config->low_output[i] = low_output[i] / 255.0;
|
||||
config->high_output[i] = high_output[i] / 255.0;
|
||||
config->gamma[i] = gamma[i];
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
error:
|
||||
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_PARSE,
|
||||
_("parse error"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_levels_config_save_cruft (GimpLevelsConfig *config,
|
||||
gpointer fp)
|
||||
{
|
||||
FILE *file = fp;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_LEVELS_CONFIG (config), FALSE);
|
||||
g_return_val_if_fail (file != NULL, FALSE);
|
||||
|
||||
fprintf (file, "# GIMP Levels File\n");
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
|
||||
fprintf (file, "%d %d %d %d %s\n",
|
||||
(gint) (config->low_input[i] * 255.999),
|
||||
(gint) (config->high_input[i] * 255.999),
|
||||
(gint) (config->low_output[i] * 255.999),
|
||||
(gint) (config->high_output[i] * 255.999),
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
config->gamma[i]));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* temp cruft */
|
||||
|
||||
void
|
||||
gimp_levels_config_to_levels_cruft (GimpLevelsConfig *config,
|
||||
Levels *cruft,
|
||||
gboolean is_color)
|
||||
gimp_levels_config_to_cruft (GimpLevelsConfig *config,
|
||||
Levels *cruft,
|
||||
gboolean is_color)
|
||||
{
|
||||
GimpHistogramChannel channel;
|
||||
|
||||
|
|
|
@ -54,28 +54,35 @@ struct _GimpLevelsConfigClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_levels_config_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_levels_config_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_levels_config_reset (GimpLevelsConfig *config);
|
||||
void gimp_levels_config_reset_channel (GimpLevelsConfig *config,
|
||||
GimpHistogramChannel channel);
|
||||
void gimp_levels_config_reset (GimpLevelsConfig *config);
|
||||
void gimp_levels_config_reset_channel (GimpLevelsConfig *config,
|
||||
GimpHistogramChannel channel);
|
||||
|
||||
void gimp_levels_config_stretch (GimpLevelsConfig *config,
|
||||
GimpHistogram *histogram,
|
||||
gboolean is_color);
|
||||
void gimp_levels_config_stretch_channel (GimpLevelsConfig *config,
|
||||
GimpHistogram *histogram,
|
||||
GimpHistogramChannel channel);
|
||||
void gimp_levels_config_adjust_by_colors (GimpLevelsConfig *config,
|
||||
GimpHistogramChannel channel,
|
||||
const GimpRGB *black,
|
||||
const GimpRGB *gray,
|
||||
const GimpRGB *white);
|
||||
|
||||
gboolean gimp_levels_config_load_cruft (GimpLevelsConfig *config,
|
||||
gpointer fp,
|
||||
GError **error);
|
||||
gboolean gimp_levels_config_save_cruft (GimpLevelsConfig *config,
|
||||
gpointer fp);
|
||||
|
||||
void gimp_levels_config_stretch (GimpLevelsConfig *config,
|
||||
GimpHistogram *histogram,
|
||||
gboolean is_color);
|
||||
void gimp_levels_config_stretch_channel (GimpLevelsConfig *config,
|
||||
GimpHistogram *histogram,
|
||||
GimpHistogramChannel channel);
|
||||
void gimp_levels_config_adjust_by_colors (GimpLevelsConfig *config,
|
||||
GimpHistogramChannel channel,
|
||||
const GimpRGB *black,
|
||||
const GimpRGB *gray,
|
||||
const GimpRGB *white);
|
||||
|
||||
/* temp cruft */
|
||||
void gimp_levels_config_to_levels_cruft (GimpLevelsConfig *config,
|
||||
Levels *cruft,
|
||||
gboolean is_color);
|
||||
void gimp_levels_config_to_cruft (GimpLevelsConfig *config,
|
||||
Levels *cruft,
|
||||
gboolean is_color);
|
||||
|
||||
|
||||
#endif /* __GIMP_LEVELS_CONFIG_H__ */
|
||||
|
|
|
@ -28,20 +28,18 @@
|
|||
|
||||
#include "gegl-types.h"
|
||||
|
||||
#include "gimpcolorbalanceconfig.h"
|
||||
#include "gimpoperationcolorbalance.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_RANGE,
|
||||
PROP_CYAN_RED,
|
||||
PROP_MAGENTA_GREEN,
|
||||
PROP_YELLOW_BLUE,
|
||||
PROP_PRESERVE_LUMINOSITY
|
||||
PROP_CONFIG
|
||||
};
|
||||
|
||||
|
||||
static void gimp_operation_color_balance_finalize (GObject *object);
|
||||
static void gimp_operation_color_balance_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
|
@ -70,6 +68,7 @@ gimp_operation_color_balance_class_init (GimpOperationColorBalanceClass * klass)
|
|||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_operation_color_balance_finalize;
|
||||
object_class->set_property = gimp_operation_color_balance_set_property;
|
||||
object_class->get_property = gimp_operation_color_balance_get_property;
|
||||
|
||||
|
@ -77,63 +76,32 @@ gimp_operation_color_balance_class_init (GimpOperationColorBalanceClass * klass)
|
|||
|
||||
gegl_operation_class_set_name (operation_class, "gimp-color-balance");
|
||||
|
||||
g_object_class_install_property (object_class, PROP_RANGE,
|
||||
g_param_spec_enum ("range",
|
||||
"range",
|
||||
"The affected range",
|
||||
GIMP_TYPE_TRANSFER_MODE,
|
||||
GIMP_MIDTONES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CYAN_RED,
|
||||
g_param_spec_double ("cyan-red",
|
||||
"Cyan-Red",
|
||||
"Cyan-Red",
|
||||
-1.0, 1.0, 0.0,
|
||||
g_object_class_install_property (object_class, PROP_CONFIG,
|
||||
g_param_spec_object ("config",
|
||||
"Config",
|
||||
"The config object",
|
||||
GIMP_TYPE_COLOR_BALANCE_CONFIG,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_MAGENTA_GREEN,
|
||||
g_param_spec_double ("magenta-green",
|
||||
"Magenta-Green",
|
||||
"Magenta-Green",
|
||||
-1.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_YELLOW_BLUE,
|
||||
g_param_spec_double ("yellow-blue",
|
||||
"Yellow-Blue",
|
||||
"Yellow-Blue",
|
||||
-1.0, 1.0, 1.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_PRESERVE_LUMINOSITY,
|
||||
g_param_spec_boolean ("preserve-luminosity",
|
||||
"Preserve Luminosity",
|
||||
"Preserve Luminosity",
|
||||
TRUE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_color_balance_init (GimpOperationColorBalance *self)
|
||||
{
|
||||
GimpTransferMode range;
|
||||
}
|
||||
|
||||
self->range = GIMP_MIDTONES;
|
||||
static void
|
||||
gimp_operation_color_balance_finalize (GObject *object)
|
||||
{
|
||||
GimpOperationColorBalance *self = GIMP_OPERATION_COLOR_BALANCE (object);
|
||||
|
||||
for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
|
||||
if (self->config)
|
||||
{
|
||||
self->cyan_red[range] = 0.0;
|
||||
self->magenta_green[range] = 0.0;
|
||||
self->yellow_blue[range] = 0.0;
|
||||
g_object_unref (self->config);
|
||||
self->config = NULL;
|
||||
}
|
||||
|
||||
self->preserve_luminosity = TRUE;
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -146,24 +114,8 @@ gimp_operation_color_balance_get_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_RANGE:
|
||||
g_value_set_enum (value, self->range);
|
||||
break;
|
||||
|
||||
case PROP_CYAN_RED:
|
||||
g_value_set_double (value, self->cyan_red[self->range]);
|
||||
break;
|
||||
|
||||
case PROP_MAGENTA_GREEN:
|
||||
g_value_set_double (value, self->magenta_green[self->range]);
|
||||
break;
|
||||
|
||||
case PROP_YELLOW_BLUE:
|
||||
g_value_set_double (value, self->yellow_blue[self->range]);
|
||||
break;
|
||||
|
||||
case PROP_PRESERVE_LUMINOSITY:
|
||||
g_value_set_boolean (value, self->preserve_luminosity);
|
||||
case PROP_CONFIG:
|
||||
g_value_set_object (value, self->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -182,24 +134,10 @@ gimp_operation_color_balance_set_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_RANGE:
|
||||
self->range = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_CYAN_RED:
|
||||
self->cyan_red[self->range] = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_MAGENTA_GREEN:
|
||||
self->magenta_green[self->range] = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_YELLOW_BLUE:
|
||||
self->yellow_blue[self->range] = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_PRESERVE_LUMINOSITY:
|
||||
self->preserve_luminosity = g_value_get_boolean (value);
|
||||
case PROP_CONFIG:
|
||||
if (self->config)
|
||||
g_object_unref (self->config);
|
||||
self->config = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -250,11 +188,15 @@ gimp_operation_color_balance_process (GeglOperation *operation,
|
|||
void *out_buf,
|
||||
glong samples)
|
||||
{
|
||||
GimpOperationColorBalance *self = GIMP_OPERATION_COLOR_BALANCE (operation);
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
GimpOperationColorBalance *self = GIMP_OPERATION_COLOR_BALANCE (operation);
|
||||
GimpColorBalanceConfig *config = self->config;
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
glong sample;
|
||||
|
||||
if (! config)
|
||||
return FALSE;
|
||||
|
||||
for (sample = 0; sample < samples; sample++)
|
||||
{
|
||||
gfloat r = src[RED_PIX];
|
||||
|
@ -265,21 +207,21 @@ gimp_operation_color_balance_process (GeglOperation *operation,
|
|||
gfloat b_n;
|
||||
|
||||
r_n = gimp_operation_color_balance_map (r,
|
||||
self->cyan_red[GIMP_SHADOWS],
|
||||
self->cyan_red[GIMP_MIDTONES],
|
||||
self->cyan_red[GIMP_HIGHLIGHTS]);
|
||||
config->cyan_red[GIMP_SHADOWS],
|
||||
config->cyan_red[GIMP_MIDTONES],
|
||||
config->cyan_red[GIMP_HIGHLIGHTS]);
|
||||
|
||||
g_n = gimp_operation_color_balance_map (g,
|
||||
self->magenta_green[GIMP_SHADOWS],
|
||||
self->magenta_green[GIMP_MIDTONES],
|
||||
self->magenta_green[GIMP_HIGHLIGHTS]);
|
||||
config->magenta_green[GIMP_SHADOWS],
|
||||
config->magenta_green[GIMP_MIDTONES],
|
||||
config->magenta_green[GIMP_HIGHLIGHTS]);
|
||||
|
||||
b_n = gimp_operation_color_balance_map (b,
|
||||
self->yellow_blue[GIMP_SHADOWS],
|
||||
self->yellow_blue[GIMP_MIDTONES],
|
||||
self->yellow_blue[GIMP_HIGHLIGHTS]);
|
||||
config->yellow_blue[GIMP_SHADOWS],
|
||||
config->yellow_blue[GIMP_MIDTONES],
|
||||
config->yellow_blue[GIMP_HIGHLIGHTS]);
|
||||
|
||||
if (self->preserve_luminosity)
|
||||
if (config->preserve_luminosity)
|
||||
{
|
||||
GimpRGB rgb;
|
||||
GimpHSL hsl;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#define __GIMP_OPERATION_COLOR_BALANCE_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
|
||||
|
||||
|
@ -40,13 +41,7 @@ struct _GimpOperationColorBalance
|
|||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GimpTransferMode range;
|
||||
|
||||
gdouble cyan_red[3];
|
||||
gdouble magenta_green[3];
|
||||
gdouble yellow_blue[3];
|
||||
|
||||
gboolean preserve_luminosity;
|
||||
GimpColorBalanceConfig *config;
|
||||
};
|
||||
|
||||
struct _GimpOperationColorBalanceClass
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef __GIMP_OPERATION_COLORIZE_H__
|
||||
#define __GIMP_OPERATION_COLORIZE_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,212 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpoperationcurves.c
|
||||
* Copyright (C) 2007 Michael Natterer <mitch@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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
#include "gegl-types.h"
|
||||
|
||||
#include "gimpcurvesconfig.h"
|
||||
#include "gimpoperationcurves.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CONFIG
|
||||
};
|
||||
|
||||
|
||||
static void gimp_operation_curves_finalize (GObject *object);
|
||||
static void gimp_operation_curves_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_operation_curves_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean gimp_operation_curves_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpOperationCurves, gimp_operation_curves,
|
||||
GEGL_TYPE_OPERATION_POINT_FILTER)
|
||||
|
||||
#define parent_class gimp_operation_curves_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_operation_curves_class_init (GimpOperationCurvesClass * klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_operation_curves_finalize;
|
||||
object_class->set_property = gimp_operation_curves_set_property;
|
||||
object_class->get_property = gimp_operation_curves_get_property;
|
||||
|
||||
point_class->process = gimp_operation_curves_process;
|
||||
|
||||
gegl_operation_class_set_name (operation_class, "gimp-curves");
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CONFIG,
|
||||
g_param_spec_object ("config",
|
||||
"Config",
|
||||
"The config object",
|
||||
GIMP_TYPE_CURVES_CONFIG,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_curves_init (GimpOperationCurves *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_curves_finalize (GObject *object)
|
||||
{
|
||||
GimpOperationCurves *self = GIMP_OPERATION_CURVES (object);
|
||||
|
||||
if (self->config)
|
||||
{
|
||||
g_object_unref (self->config);
|
||||
self->config = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_curves_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationCurves *self = GIMP_OPERATION_CURVES (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
g_value_set_object (value, self->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_curves_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationCurves *self = GIMP_OPERATION_CURVES (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
if (self->config)
|
||||
g_object_unref (self->config);
|
||||
self->config = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline gdouble
|
||||
gimp_operation_curves_map (gdouble value,
|
||||
GimpCurve *curve)
|
||||
{
|
||||
if (value < 0.0)
|
||||
{
|
||||
value = curve->curve[0] / 255.0;
|
||||
}
|
||||
else if (value >= 1.0)
|
||||
{
|
||||
value = curve->curve[255] / 255.0;
|
||||
}
|
||||
else /* interpolate the curve */
|
||||
{
|
||||
gint index = floor (value * 255.0);
|
||||
gdouble f = value * 255.0 - index;
|
||||
|
||||
value = ((1.0 - f) * curve->curve[index ] +
|
||||
f * curve->curve[index + 1] ) / 255.0;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_operation_curves_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples)
|
||||
{
|
||||
GimpOperationCurves *self = GIMP_OPERATION_CURVES (operation);
|
||||
GimpCurvesConfig *config = self->config;
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
glong sample;
|
||||
|
||||
if (! config)
|
||||
return FALSE;
|
||||
|
||||
for (sample = 0; sample < samples; sample++)
|
||||
{
|
||||
gint channel;
|
||||
|
||||
for (channel = 0; channel < 4; channel++)
|
||||
{
|
||||
gdouble value;
|
||||
|
||||
value = gimp_operation_curves_map (src[channel],
|
||||
config->curve[channel + 1]);
|
||||
|
||||
/* don't apply the overall curve to the alpha channel */
|
||||
if (channel != ALPHA_PIX)
|
||||
value = gimp_operation_curves_map (value,
|
||||
config->curve[0]);
|
||||
|
||||
dest[channel] = value;
|
||||
}
|
||||
|
||||
src += 4;
|
||||
dest += 4;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpoperationcurves.h
|
||||
* Copyright (C) 2007 Michael Natterer <mitch@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_OPERATION_CURVES_H__
|
||||
#define __GIMP_OPERATION_CURVES_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
|
||||
|
||||
#define GIMP_TYPE_OPERATION_CURVES (gimp_operation_curves_get_type ())
|
||||
#define GIMP_OPERATION_CURVES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_CURVES, GimpOperationCurves))
|
||||
#define GIMP_OPERATION_CURVES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_CURVES, GimpOperationCurvesClass))
|
||||
#define GIMP_IS_OPERATION_CURVES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_CURVES))
|
||||
#define GIMP_IS_OPERATION_CURVES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_CURVES))
|
||||
#define GIMP_OPERATION_CURVES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_CURVES, GimpOperationCurvesClass))
|
||||
|
||||
|
||||
typedef struct _GimpOperationCurvesClass GimpOperationCurvesClass;
|
||||
|
||||
struct _GimpOperationCurves
|
||||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GimpCurvesConfig *config;
|
||||
};
|
||||
|
||||
struct _GimpOperationCurvesClass
|
||||
{
|
||||
GeglOperationPointFilterClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_operation_curves_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_OPERATION_CURVES_H__ */
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef __GIMP_OPERATION_DESATURATE_H__
|
||||
#define __GIMP_OPERATION_DESATURATE_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
|
||||
|
||||
|
|
|
@ -28,20 +28,18 @@
|
|||
|
||||
#include "gegl-types.h"
|
||||
|
||||
#include "gimphuesaturationconfig.h"
|
||||
#include "gimpoperationhuesaturation.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_RANGE,
|
||||
PROP_HUE,
|
||||
PROP_SATURATION,
|
||||
PROP_LIGHTNESS,
|
||||
PROP_OVERLAP
|
||||
PROP_CONFIG
|
||||
};
|
||||
|
||||
|
||||
static void gimp_operation_hue_saturation_finalize (GObject *object);
|
||||
static void gimp_operation_hue_saturation_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
|
@ -70,6 +68,7 @@ gimp_operation_hue_saturation_class_init (GimpOperationHueSaturationClass * klas
|
|||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_operation_hue_saturation_finalize;
|
||||
object_class->set_property = gimp_operation_hue_saturation_set_property;
|
||||
object_class->get_property = gimp_operation_hue_saturation_get_property;
|
||||
|
||||
|
@ -77,44 +76,11 @@ gimp_operation_hue_saturation_class_init (GimpOperationHueSaturationClass * klas
|
|||
|
||||
gegl_operation_class_set_name (operation_class, "gimp-hue-saturation");
|
||||
|
||||
g_object_class_install_property (object_class, PROP_RANGE,
|
||||
g_param_spec_enum ("range",
|
||||
"range",
|
||||
"The affected range",
|
||||
GIMP_TYPE_HUE_RANGE,
|
||||
GIMP_ALL_HUES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_HUE,
|
||||
g_param_spec_double ("hue",
|
||||
"Hue",
|
||||
"Hue",
|
||||
-1.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_SATURATION,
|
||||
g_param_spec_double ("saturation",
|
||||
"Saturation",
|
||||
"Saturation",
|
||||
-1.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_LIGHTNESS,
|
||||
g_param_spec_double ("lightness",
|
||||
"Lightness",
|
||||
"Lightness",
|
||||
-1.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_OVERLAP,
|
||||
g_param_spec_double ("overlap",
|
||||
"Overlap",
|
||||
"Overlap",
|
||||
0.0, 1.0, 0.0,
|
||||
g_object_class_install_property (object_class, PROP_CONFIG,
|
||||
g_param_spec_object ("config",
|
||||
"Config",
|
||||
"The config object",
|
||||
GIMP_TYPE_HUE_SATURATION_CONFIG,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
}
|
||||
|
@ -122,18 +88,20 @@ gimp_operation_hue_saturation_class_init (GimpOperationHueSaturationClass * klas
|
|||
static void
|
||||
gimp_operation_hue_saturation_init (GimpOperationHueSaturation *self)
|
||||
{
|
||||
GimpHueRange range;
|
||||
}
|
||||
|
||||
self->range = GIMP_ALL_HUES;
|
||||
static void
|
||||
gimp_operation_hue_saturation_finalize (GObject *object)
|
||||
{
|
||||
GimpOperationHueSaturation *self = GIMP_OPERATION_HUE_SATURATION (object);
|
||||
|
||||
for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++)
|
||||
if (self->config)
|
||||
{
|
||||
self->hue[range] = 0.0;
|
||||
self->saturation[range] = 0.0;
|
||||
self->lightness[range] = 0.0;
|
||||
g_object_unref (self->config);
|
||||
self->config = NULL;
|
||||
}
|
||||
|
||||
self->overlap = 0.0;
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -146,24 +114,8 @@ gimp_operation_hue_saturation_get_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_RANGE:
|
||||
g_value_set_enum (value, self->range);
|
||||
break;
|
||||
|
||||
case PROP_HUE:
|
||||
g_value_set_double (value, self->hue[self->range]);
|
||||
break;
|
||||
|
||||
case PROP_SATURATION:
|
||||
g_value_set_double (value, self->saturation[self->range]);
|
||||
break;
|
||||
|
||||
case PROP_LIGHTNESS:
|
||||
g_value_set_double (value, self->lightness[self->range]);
|
||||
break;
|
||||
|
||||
case PROP_OVERLAP:
|
||||
g_value_set_double (value, self->overlap);
|
||||
case PROP_CONFIG:
|
||||
g_value_set_object (value, self->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -182,24 +134,10 @@ gimp_operation_hue_saturation_set_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_RANGE:
|
||||
self->range = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_HUE:
|
||||
self->hue[self->range] = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_SATURATION:
|
||||
self->saturation[self->range] = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_LIGHTNESS:
|
||||
self->lightness[self->range] = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_OVERLAP:
|
||||
self->overlap = g_value_get_double (value);
|
||||
case PROP_CONFIG:
|
||||
if (self->config)
|
||||
g_object_unref (self->config);
|
||||
self->config = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -209,11 +147,11 @@ gimp_operation_hue_saturation_set_property (GObject *object,
|
|||
}
|
||||
|
||||
static inline gdouble
|
||||
map_hue (GimpOperationHueSaturation *self,
|
||||
gint hue,
|
||||
gdouble value)
|
||||
map_hue (GimpHueSaturationConfig *config,
|
||||
GimpHueRange range,
|
||||
gdouble value)
|
||||
{
|
||||
value += (self->hue[0] + self->hue[hue + 1]) / 2.0;
|
||||
value += (config->hue[GIMP_ALL_HUES] + config->hue[range]) / 2.0;
|
||||
|
||||
if (value < 0)
|
||||
return value + 1.0;
|
||||
|
@ -224,13 +162,11 @@ map_hue (GimpOperationHueSaturation *self,
|
|||
}
|
||||
|
||||
static inline gdouble
|
||||
map_saturation (GimpOperationHueSaturation *self,
|
||||
gint hue,
|
||||
gdouble value)
|
||||
map_saturation (GimpHueSaturationConfig *config,
|
||||
GimpHueRange range,
|
||||
gdouble value)
|
||||
{
|
||||
gdouble v = self->saturation[0] + self->saturation[hue + 1];
|
||||
|
||||
// v = CLAMP (v, -1.0, 1.0);
|
||||
gdouble v = config->saturation[GIMP_ALL_HUES] + config->saturation[range];
|
||||
|
||||
/* This change affects the way saturation is computed. With the old
|
||||
* code (different code for value < 0), increasing the saturation
|
||||
|
@ -246,13 +182,11 @@ map_saturation (GimpOperationHueSaturation *self,
|
|||
}
|
||||
|
||||
static inline gdouble
|
||||
map_lightness (GimpOperationHueSaturation *self,
|
||||
gint hue,
|
||||
gdouble value)
|
||||
map_lightness (GimpHueSaturationConfig *config,
|
||||
GimpHueRange range,
|
||||
gdouble value)
|
||||
{
|
||||
gdouble v = (self->lightness[0] + self->lightness[hue + 1]) / 2.0;
|
||||
|
||||
// v = CLAMP (v, -1.0, 1.0);
|
||||
gdouble v = (config->lightness[GIMP_ALL_HUES] + config->lightness[range]) / 2.0;
|
||||
|
||||
if (v < 0)
|
||||
return value * (v + 1.0);
|
||||
|
@ -267,9 +201,10 @@ gimp_operation_hue_saturation_process (GeglOperation *operation,
|
|||
glong samples)
|
||||
{
|
||||
GimpOperationHueSaturation *self = GIMP_OPERATION_HUE_SATURATION (operation);
|
||||
GimpHueSaturationConfig *config = self->config;
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
gfloat overlap = self->overlap / 2.0;
|
||||
gfloat overlap = config->overlap / 2.0;
|
||||
glong sample;
|
||||
|
||||
for (sample = 0; sample < samples; sample++)
|
||||
|
@ -331,22 +266,26 @@ gimp_operation_hue_saturation_process (GeglOperation *operation,
|
|||
secondary_hue = 0;
|
||||
}
|
||||
|
||||
/* transform into GimpHueRange values */
|
||||
hue++;
|
||||
secondary_hue++;
|
||||
|
||||
if (use_secondary_hue)
|
||||
{
|
||||
hsl.h = (map_hue (self, hue, hsl.h) * primary_intensity +
|
||||
map_hue (self, secondary_hue, hsl.h) * secondary_intensity);
|
||||
hsl.h = (map_hue (config, hue, hsl.h) * primary_intensity +
|
||||
map_hue (config, secondary_hue, hsl.h) * secondary_intensity);
|
||||
|
||||
hsl.s = (map_saturation (self, hue, hsl.s) * primary_intensity +
|
||||
map_saturation (self, secondary_hue, hsl.s) * secondary_intensity);
|
||||
hsl.s = (map_saturation (config, hue, hsl.s) * primary_intensity +
|
||||
map_saturation (config, secondary_hue, hsl.s) * secondary_intensity);
|
||||
|
||||
hsl.l = (map_lightness (self, hue, hsl.l) * primary_intensity +
|
||||
map_lightness (self, secondary_hue, hsl.l) * secondary_intensity);
|
||||
hsl.l = (map_lightness (config, hue, hsl.l) * primary_intensity +
|
||||
map_lightness (config, secondary_hue, hsl.l) * secondary_intensity);
|
||||
}
|
||||
else
|
||||
{
|
||||
hsl.h = map_hue (self, hue, hsl.h);
|
||||
hsl.s = map_saturation (self, hue, hsl.s);
|
||||
hsl.l = map_lightness (self, hue, hsl.l);
|
||||
hsl.h = map_hue (config, hue, hsl.h);
|
||||
hsl.s = map_saturation (config, hue, hsl.s);
|
||||
hsl.l = map_lightness (config, hue, hsl.l);
|
||||
}
|
||||
|
||||
gimp_hsl_to_rgb (&hsl, &rgb);
|
||||
|
@ -362,3 +301,27 @@ gimp_operation_hue_saturation_process (GeglOperation *operation,
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_operation_hue_saturation_map (GimpHueSaturationConfig *config,
|
||||
const GimpRGB *color,
|
||||
GimpHueRange range,
|
||||
GimpRGB *result)
|
||||
{
|
||||
GimpHSL hsl;
|
||||
|
||||
g_return_if_fail (GIMP_IS_HUE_SATURATION_CONFIG (config));
|
||||
g_return_if_fail (color != NULL);
|
||||
g_return_if_fail (result != NULL);
|
||||
|
||||
gimp_rgb_to_hsl (color, &hsl);
|
||||
|
||||
hsl.h = map_hue (config, range, hsl.h);
|
||||
hsl.s = map_saturation (config, range, hsl.s);
|
||||
hsl.l = map_lightness (config, range, hsl.l);
|
||||
|
||||
gimp_hsl_to_rgb (&hsl, result);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef __GIMP_OPERATION_HUE_SATURATION_H__
|
||||
#define __GIMP_OPERATION_HUE_SATURATION_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
|
||||
|
||||
|
@ -40,13 +40,7 @@ struct _GimpOperationHueSaturation
|
|||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GimpHueRange range;
|
||||
|
||||
gdouble hue[7];
|
||||
gdouble saturation[7];
|
||||
gdouble lightness[7];
|
||||
|
||||
gdouble overlap;
|
||||
GimpHueSaturationConfig *config;
|
||||
};
|
||||
|
||||
struct _GimpOperationHueSaturationClass
|
||||
|
@ -57,5 +51,10 @@ struct _GimpOperationHueSaturationClass
|
|||
|
||||
GType gimp_operation_hue_saturation_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_operation_hue_saturation_map (GimpHueSaturationConfig *config,
|
||||
const GimpRGB *color,
|
||||
GimpHueRange range,
|
||||
GimpRGB *result);
|
||||
|
||||
|
||||
#endif /* __GIMP_OPERATION_HUE_SATURATION_H__ */
|
||||
|
|
|
@ -225,3 +225,31 @@ gimp_operation_levels_process (GeglOperation *operation,
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
gdouble
|
||||
gimp_operation_levels_map_input (GimpLevelsConfig *config,
|
||||
GimpHistogramChannel channel,
|
||||
gdouble value)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_LEVELS_CONFIG (config), 0.0);
|
||||
|
||||
/* determine input intensity */
|
||||
if (config->high_input[channel] != config->low_input[channel])
|
||||
value = ((value - config->low_input[channel]) /
|
||||
(config->high_input[channel] - config->low_input[channel]));
|
||||
else
|
||||
value = (value - config->low_input[channel]);
|
||||
|
||||
value = CLAMP (value, 0.0, 1.0);
|
||||
|
||||
if (config->gamma[channel] != 0.0)
|
||||
{
|
||||
value = pow (value, 1.0 / config->gamma[channel]);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#define __GIMP_OPERATION_LEVELS_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
|
||||
|
||||
|
@ -49,7 +50,11 @@ struct _GimpOperationLevelsClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_operation_levels_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_operation_levels_get_type (void) G_GNUC_CONST;
|
||||
|
||||
gdouble gimp_operation_levels_map_input (GimpLevelsConfig *config,
|
||||
GimpHistogramChannel channel,
|
||||
gdouble value);
|
||||
|
||||
|
||||
#endif /* __GIMP_OPERATION_LEVELS_H__ */
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#define __GIMP_OPERATION_POSTERIZE_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
|
||||
|
||||
|
|
|
@ -28,16 +28,17 @@
|
|||
#include "gegl-types.h"
|
||||
|
||||
#include "gimpoperationthreshold.h"
|
||||
#include "gimpthresholdconfig.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_LOW,
|
||||
PROP_HIGH
|
||||
PROP_CONFIG
|
||||
};
|
||||
|
||||
|
||||
static void gimp_operation_threshold_finalize (GObject *object);
|
||||
static void gimp_operation_threshold_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
|
@ -66,6 +67,7 @@ gimp_operation_threshold_class_init (GimpOperationThresholdClass * klass)
|
|||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_operation_threshold_finalize;
|
||||
object_class->set_property = gimp_operation_threshold_set_property;
|
||||
object_class->get_property = gimp_operation_threshold_get_property;
|
||||
|
||||
|
@ -73,19 +75,11 @@ gimp_operation_threshold_class_init (GimpOperationThresholdClass * klass)
|
|||
|
||||
gegl_operation_class_set_name (operation_class, "gimp-threshold");
|
||||
|
||||
g_object_class_install_property (object_class, PROP_LOW,
|
||||
g_param_spec_double ("low",
|
||||
"Low",
|
||||
"Low threshold",
|
||||
0.0, 1.0, 0.5,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_HIGH,
|
||||
g_param_spec_double ("high",
|
||||
"High",
|
||||
"High threshold",
|
||||
0.0, 1.0, 1.0,
|
||||
g_object_class_install_property (object_class, PROP_CONFIG,
|
||||
g_param_spec_object ("config",
|
||||
"Config",
|
||||
"The config object",
|
||||
GIMP_TYPE_THRESHOLD_CONFIG,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
}
|
||||
|
@ -95,6 +89,20 @@ gimp_operation_threshold_init (GimpOperationThreshold *self)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_threshold_finalize (GObject *object)
|
||||
{
|
||||
GimpOperationThreshold *self = GIMP_OPERATION_THRESHOLD (object);
|
||||
|
||||
if (self->config)
|
||||
{
|
||||
g_object_unref (self->config);
|
||||
self->config = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_threshold_get_property (GObject *object,
|
||||
guint property_id,
|
||||
|
@ -105,12 +113,8 @@ gimp_operation_threshold_get_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_LOW:
|
||||
g_value_set_double (value, self->low);
|
||||
break;
|
||||
|
||||
case PROP_HIGH:
|
||||
g_value_set_double (value, self->high);
|
||||
case PROP_CONFIG:
|
||||
g_value_set_object (value, self->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -129,12 +133,10 @@ gimp_operation_threshold_set_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_LOW:
|
||||
self->low = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_HIGH:
|
||||
self->high = g_value_get_double (value);
|
||||
case PROP_CONFIG:
|
||||
if (self->config)
|
||||
g_object_unref (self->config);
|
||||
self->config = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -149,11 +151,15 @@ gimp_operation_threshold_process (GeglOperation *operation,
|
|||
void *out_buf,
|
||||
glong samples)
|
||||
{
|
||||
GimpOperationThreshold *self = GIMP_OPERATION_THRESHOLD (operation);
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
GimpOperationThreshold *self = GIMP_OPERATION_THRESHOLD (operation);
|
||||
GimpThresholdConfig *config = self->config;
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
glong sample;
|
||||
|
||||
if (! config)
|
||||
return FALSE;
|
||||
|
||||
for (sample = 0; sample < samples; sample++)
|
||||
{
|
||||
gfloat value;
|
||||
|
@ -161,7 +167,7 @@ gimp_operation_threshold_process (GeglOperation *operation,
|
|||
value = MAX (src[RED_PIX], src[GREEN_PIX]);
|
||||
value = MAX (value, src[BLUE_PIX]);
|
||||
|
||||
value = (value >= self->low && value <= self->high) ? 1.0 : 0.0;
|
||||
value = (value >= config->low && value <= config->high) ? 1.0 : 0.0;
|
||||
|
||||
dest[RED_PIX] = value;
|
||||
dest[GREEN_PIX] = value;
|
||||
|
|
|
@ -23,13 +23,16 @@
|
|||
#define __GIMP_OPERATION_THRESHOLD_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
|
||||
|
||||
#define GIMP_TYPE_OPERATION_THRESHOLD (gimp_operation_threshold_get_type ())
|
||||
#define GIMP_OPERATION_THRESHOLD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_THRESHOLD, GimpOperationThreshold))
|
||||
#define GIMP_OPERATION_THRESHOLD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_THRESHOLD, GimpOperationThresholdClass))
|
||||
#define GIMP_OPERATION_THRESHOLD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_THRESHOLD, GimpOperationThresholdClass))
|
||||
#define GIMP_TYPE_OPERATION_THRESHOLD (gimp_operation_threshold_get_type ())
|
||||
#define GIMP_OPERATION_THRESHOLD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_THRESHOLD, GimpOperationThreshold))
|
||||
#define GIMP_OPERATION_THRESHOLD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_THRESHOLD, GimpOperationThresholdClass))
|
||||
#define GIMP_IS_OPERATION_THRESHOLD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_THRESHOLD))
|
||||
#define GIMP_IS_OPERATION_THRESHOLD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_THRESHOLD))
|
||||
#define GIMP_OPERATION_THRESHOLD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_THRESHOLD, GimpOperationThresholdClass))
|
||||
|
||||
|
||||
typedef struct _GimpOperationThresholdClass GimpOperationThresholdClass;
|
||||
|
@ -38,8 +41,7 @@ struct _GimpOperationThreshold
|
|||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
gdouble low;
|
||||
gdouble high;
|
||||
GimpThresholdConfig *config;
|
||||
};
|
||||
|
||||
struct _GimpOperationThresholdClass
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef __GIMP_OPERATION_TILE_SINK_H__
|
||||
#define __GIMP_OPERATION_TILE_SINK_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-sink.h>
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef __GIMP_OPERATION_TILE_SOURCE_H__
|
||||
#define __GIMP_OPERATION_TILE_SOURCE_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-source.h>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpthresholdconfig.c
|
||||
* Copyright (C) 2007 Michael Natterer <mitch@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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#include "gegl-types.h"
|
||||
|
||||
/* temp cruft */
|
||||
#include "base/threshold.h"
|
||||
|
||||
#include "gimpthresholdconfig.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_LOW,
|
||||
PROP_HIGH
|
||||
};
|
||||
|
||||
|
||||
static void gimp_threshold_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_threshold_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpThresholdConfig, gimp_threshold_config,
|
||||
G_TYPE_OBJECT)
|
||||
|
||||
#define parent_class gimp_threshold_config_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_threshold_config_class_init (GimpThresholdConfigClass * klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = gimp_threshold_config_set_property;
|
||||
object_class->get_property = gimp_threshold_config_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_LOW,
|
||||
g_param_spec_double ("low",
|
||||
"Low",
|
||||
"Low threshold",
|
||||
0.0, 1.0, 0.5,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_HIGH,
|
||||
g_param_spec_double ("high",
|
||||
"High",
|
||||
"High threshold",
|
||||
0.0, 1.0, 1.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_threshold_config_init (GimpThresholdConfig *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_threshold_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpThresholdConfig *self = GIMP_THRESHOLD_CONFIG (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_LOW:
|
||||
g_value_set_double (value, self->low);
|
||||
break;
|
||||
|
||||
case PROP_HIGH:
|
||||
g_value_set_double (value, self->high);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_threshold_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpThresholdConfig *self = GIMP_THRESHOLD_CONFIG (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_LOW:
|
||||
self->low = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_HIGH:
|
||||
self->high = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_threshold_config_reset (GimpThresholdConfig *config)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_THRESHOLD_CONFIG (config));
|
||||
|
||||
config->low = 0.5;
|
||||
config->high = 1.0;
|
||||
}
|
||||
|
||||
|
||||
/* temp cruft */
|
||||
|
||||
void
|
||||
gimp_threshold_config_to_cruft (GimpThresholdConfig *config,
|
||||
Threshold *cruft)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_THRESHOLD_CONFIG (config));
|
||||
g_return_if_fail (cruft != NULL);
|
||||
|
||||
cruft->low_threshold = config->low * 255.999;
|
||||
cruft->high_threshold = config->high * 255.999;
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpthresholdconfig.h
|
||||
* Copyright (C) 2007 Michael Natterer <mitch@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_THRESHOLD_CONFIG_H__
|
||||
#define __GIMP_THRESHOLD_CONFIG_H__
|
||||
|
||||
|
||||
#define GIMP_TYPE_THRESHOLD_CONFIG (gimp_threshold_config_get_type ())
|
||||
#define GIMP_THRESHOLD_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_THRESHOLD_CONFIG, GimpThresholdConfig))
|
||||
#define GIMP_THRESHOLD_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_THRESHOLD_CONFIG, GimpThresholdConfigClass))
|
||||
#define GIMP_IS_THRESHOLD_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_THRESHOLD_CONFIG))
|
||||
#define GIMP_IS_THRESHOLD_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_THRESHOLD_CONFIG))
|
||||
#define GIMP_THRESHOLD_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_THRESHOLD_CONFIG, GimpThresholdConfigClass))
|
||||
|
||||
|
||||
typedef struct _GimpThresholdConfigClass GimpThresholdConfigClass;
|
||||
|
||||
struct _GimpThresholdConfig
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
gdouble low;
|
||||
gdouble high;
|
||||
};
|
||||
|
||||
struct _GimpThresholdConfigClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_threshold_config_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_threshold_config_reset (GimpThresholdConfig *config);
|
||||
|
||||
/* temp cruft */
|
||||
void gimp_threshold_config_to_cruft (GimpThresholdConfig *config,
|
||||
Threshold *cruft);
|
||||
|
||||
|
||||
#endif /* __GIMP_THRESHOLD_CONFIG_H__ */
|
|
@ -268,15 +268,13 @@ gui_post_init (Gimp *gimp)
|
|||
static gchar *
|
||||
gui_sanity_check (void)
|
||||
{
|
||||
const gchar *mismatch;
|
||||
|
||||
#define GTK_REQUIRED_MAJOR 2
|
||||
#define GTK_REQUIRED_MINOR 12
|
||||
#define GTK_REQUIRED_MICRO 1
|
||||
|
||||
mismatch = gtk_check_version (GTK_REQUIRED_MAJOR,
|
||||
GTK_REQUIRED_MINOR,
|
||||
GTK_REQUIRED_MICRO);
|
||||
const gchar *mismatch = gtk_check_version (GTK_REQUIRED_MAJOR,
|
||||
GTK_REQUIRED_MINOR,
|
||||
GTK_REQUIRED_MICRO);
|
||||
|
||||
if (mismatch)
|
||||
{
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "base/pixel-region.h"
|
||||
#include "base/temp-buf.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "core/gimpbrush.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
@ -784,6 +786,9 @@ gimp_brush_core_create_bound_segs (GimpBrushCore *core,
|
|||
pixel_region_init_temp_buf (&PR, mask,
|
||||
0, 0, mask->width, mask->height);
|
||||
|
||||
/* smooth the mask in order to obtain a simpler boundary */
|
||||
smooth_region (&PR);
|
||||
|
||||
boundary = boundary_find (&PR, BOUNDARY_WITHIN_BOUNDS,
|
||||
0, 0, PR.w, PR.h,
|
||||
0,
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "base/pixel-processor.h"
|
||||
#include "base/pixel-region.h"
|
||||
#include "base/threshold.h"
|
||||
#include "config/gimpcoreconfig.h"
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcurve.h"
|
||||
#include "core/gimpdrawable-desaturate.h"
|
||||
|
@ -80,7 +79,7 @@ brightness_contrast_invoker (GimpProcedure *procedure,
|
|||
|
||||
if (success)
|
||||
{
|
||||
if (gimp->config->use_gegl)
|
||||
if (gimp_use_gegl (gimp))
|
||||
{
|
||||
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "brightness-contrast",
|
||||
|
@ -254,7 +253,7 @@ posterize_invoker (GimpProcedure *procedure,
|
|||
|
||||
if (success)
|
||||
{
|
||||
if (gimp->config->use_gegl)
|
||||
if (gimp_use_gegl (gimp))
|
||||
{
|
||||
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "gimp-posterize",
|
||||
|
@ -675,7 +674,7 @@ colorize_invoker (GimpProcedure *procedure,
|
|||
|
||||
if (success)
|
||||
{
|
||||
if (gimp->config->use_gegl)
|
||||
if (gimp_use_gegl (gimp))
|
||||
{
|
||||
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "gimp-colorize",
|
||||
|
@ -889,7 +888,7 @@ threshold_invoker (GimpProcedure *procedure,
|
|||
|
||||
if (success)
|
||||
{
|
||||
if (gimp->config->use_gegl)
|
||||
if (gimp_use_gegl (gimp))
|
||||
{
|
||||
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "gimp-threshold",
|
||||
|
|
32
app/sanity.c
32
app/sanity.c
|
@ -89,15 +89,13 @@ sanity_check_gimp (void)
|
|||
static gchar *
|
||||
sanity_check_glib (void)
|
||||
{
|
||||
const gchar *mismatch;
|
||||
|
||||
#define GLIB_REQUIRED_MAJOR 2
|
||||
#define GLIB_REQUIRED_MINOR 14
|
||||
#define GLIB_REQUIRED_MICRO 1
|
||||
|
||||
mismatch = glib_check_version (GLIB_REQUIRED_MAJOR,
|
||||
GLIB_REQUIRED_MINOR,
|
||||
GLIB_REQUIRED_MICRO);
|
||||
const gchar *mismatch = glib_check_version (GLIB_REQUIRED_MAJOR,
|
||||
GLIB_REQUIRED_MINOR,
|
||||
GLIB_REQUIRED_MICRO);
|
||||
|
||||
if (mismatch)
|
||||
{
|
||||
|
@ -124,21 +122,20 @@ sanity_check_glib (void)
|
|||
static gchar *
|
||||
sanity_check_pango (void)
|
||||
{
|
||||
gint pango_major_version = pango_version () / 100 / 100;
|
||||
gint pango_minor_version = pango_version () / 100 % 100;
|
||||
gint pango_micro_version = pango_version () % 100;
|
||||
const gchar *mismatch;
|
||||
|
||||
#define PANGO_REQUIRED_MAJOR 1
|
||||
#define PANGO_REQUIRED_MINOR 18
|
||||
#define PANGO_REQUIRED_MICRO 0
|
||||
|
||||
mismatch = pango_version_check (PANGO_REQUIRED_MAJOR,
|
||||
PANGO_REQUIRED_MINOR,
|
||||
PANGO_REQUIRED_MICRO);
|
||||
const gchar *mismatch = pango_version_check (PANGO_REQUIRED_MAJOR,
|
||||
PANGO_REQUIRED_MINOR,
|
||||
PANGO_REQUIRED_MICRO);
|
||||
|
||||
if (mismatch)
|
||||
{
|
||||
const gint pango_major_version = pango_version () / 100 / 100;
|
||||
const gint pango_minor_version = pango_version () / 100 % 100;
|
||||
const gint pango_micro_version = pango_version () % 100;
|
||||
|
||||
return g_strdup_printf
|
||||
("%s\n\n"
|
||||
"GIMP requires Pango version %d.%d.%d or later.\n"
|
||||
|
@ -162,10 +159,7 @@ sanity_check_pango (void)
|
|||
static gchar *
|
||||
sanity_check_fontconfig (void)
|
||||
{
|
||||
gint fc_version = FcGetVersion ();
|
||||
gint fc_major_version = fc_version / 100 / 100;
|
||||
gint fc_minor_version = fc_version / 100 % 100;
|
||||
gint fc_micro_version = fc_version % 100;
|
||||
const gint fc_version = FcGetVersion ();
|
||||
|
||||
#define FC_REQUIRED_MAJOR 2
|
||||
#define FC_REQUIRED_MINOR 2
|
||||
|
@ -175,6 +169,10 @@ sanity_check_fontconfig (void)
|
|||
(FC_REQUIRED_MINOR * 100) +
|
||||
(FC_REQUIRED_MICRO * 1)))
|
||||
{
|
||||
const gint fc_major_version = fc_version / 100 / 100;
|
||||
const gint fc_minor_version = fc_version / 100 % 100;
|
||||
const gint fc_micro_version = fc_version % 100;
|
||||
|
||||
return g_strdup_printf
|
||||
("The Fontconfig version being used is too old!\n\n"
|
||||
"GIMP requires Fontconfig version %d.%d.%d or later.\n"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
|
|
@ -28,10 +28,8 @@
|
|||
#include "base/gimplut.h"
|
||||
#include "base/lut-funcs.h"
|
||||
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimagemap.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
|
||||
|
|
|
@ -295,8 +295,8 @@ gimp_brush_tool_draw_brush (GimpBrushTool *brush_tool,
|
|||
if (brush_core->brush_bound_segs)
|
||||
{
|
||||
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (draw_tool->display->shell);
|
||||
gdouble width = (gdouble) brush_core->brush_bound_width;
|
||||
gdouble height = (gdouble) brush_core->brush_bound_height;
|
||||
gdouble width = brush_core->brush_bound_width;
|
||||
gdouble height = brush_core->brush_bound_height;
|
||||
|
||||
/* don't draw the boundary if it becomes too small */
|
||||
if (SCALEX (shell, width) > 4 && SCALEY (shell, height) > 4)
|
||||
|
|
|
@ -27,9 +27,10 @@
|
|||
|
||||
#include "base/color-balance.h"
|
||||
|
||||
#include "gegl/gimpcolorbalanceconfig.h"
|
||||
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimagemap.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
|
||||
|
@ -116,7 +117,6 @@ gimp_color_balance_tool_init (GimpColorBalanceTool *cb_tool)
|
|||
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (cb_tool);
|
||||
|
||||
cb_tool->color_balance = g_slice_new0 (ColorBalance);
|
||||
cb_tool->transfer_mode = GIMP_MIDTONES;
|
||||
|
||||
color_balance_init (cb_tool->color_balance);
|
||||
|
||||
|
@ -129,6 +129,12 @@ gimp_color_balance_tool_finalize (GObject *object)
|
|||
{
|
||||
GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (object);
|
||||
|
||||
if (cb_tool->config)
|
||||
{
|
||||
g_object_unref (cb_tool->config);
|
||||
cb_tool->config = NULL;
|
||||
}
|
||||
|
||||
g_slice_free (ColorBalance, cb_tool->color_balance);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
|
@ -154,12 +160,13 @@ gimp_color_balance_tool_initialize (GimpTool *tool,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
color_balance_init (cb_tool->color_balance);
|
||||
|
||||
cb_tool->transfer_mode = GIMP_MIDTONES;
|
||||
gimp_color_balance_config_reset (cb_tool->config);
|
||||
|
||||
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
|
||||
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (cb_tool->range_radio),
|
||||
cb_tool->config->range);
|
||||
|
||||
color_balance_update (cb_tool);
|
||||
|
||||
return TRUE;
|
||||
|
@ -168,36 +175,28 @@ gimp_color_balance_tool_initialize (GimpTool *tool,
|
|||
static GeglNode *
|
||||
gimp_color_balance_tool_get_operation (GimpImageMapTool *im_tool)
|
||||
{
|
||||
return g_object_new (GEGL_TYPE_NODE,
|
||||
GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (im_tool);
|
||||
GeglNode *node;
|
||||
|
||||
node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "gimp-color-balance",
|
||||
NULL);
|
||||
|
||||
cb_tool->config = g_object_new (GIMP_TYPE_COLOR_BALANCE_CONFIG, NULL);
|
||||
|
||||
gegl_node_set (node,
|
||||
"config", cb_tool->config,
|
||||
NULL);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_balance_tool_map (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (image_map_tool);
|
||||
ColorBalance *cb = cb_tool->color_balance;
|
||||
GimpTransferMode range;
|
||||
|
||||
for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
|
||||
{
|
||||
gegl_node_set (image_map_tool->operation,
|
||||
"range", range,
|
||||
NULL);
|
||||
|
||||
gegl_node_set (image_map_tool->operation,
|
||||
"cyan-red", cb->cyan_red[range] / 256.0,
|
||||
"magenta-green", cb->magenta_green[range] / 256.0,
|
||||
"yellow-blue", cb->yellow_blue[range] / 256.0,
|
||||
NULL);
|
||||
}
|
||||
|
||||
gegl_node_set (image_map_tool->operation,
|
||||
"preserve-luminosity", cb->preserve_luminosity,
|
||||
NULL);
|
||||
|
||||
color_balance_create_lookup_tables (cb_tool->color_balance);
|
||||
gimp_color_balance_config_to_cruft (cb_tool->config, cb_tool->color_balance);
|
||||
}
|
||||
|
||||
|
||||
|
@ -252,7 +251,6 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *im_tool)
|
|||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *toggle;
|
||||
GtkWidget *button;
|
||||
GtkWidget *frame;
|
||||
|
||||
|
@ -260,7 +258,7 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *im_tool)
|
|||
gtk_label_new (_("Select Range to Adjust")),
|
||||
G_CALLBACK (color_balance_range_callback),
|
||||
cb_tool,
|
||||
&toggle);
|
||||
&cb_tool->range_radio);
|
||||
gtk_box_pack_start (GTK_BOX (im_tool->main_vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
|
@ -279,22 +277,22 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *im_tool)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
cb_tool->cyan_red_adj =
|
||||
create_levels_scale (_("Cyan"), _("Red"), table, 0);
|
||||
cb_tool->cyan_red_adj = create_levels_scale (_("Cyan"), _("Red"),
|
||||
table, 0);
|
||||
|
||||
g_signal_connect (cb_tool->cyan_red_adj, "value-changed",
|
||||
G_CALLBACK (color_balance_cr_changed),
|
||||
cb_tool);
|
||||
|
||||
cb_tool->magenta_green_adj =
|
||||
create_levels_scale (_("Magenta"), _("Green"), table, 1);
|
||||
cb_tool->magenta_green_adj = create_levels_scale (_("Magenta"), _("Green"),
|
||||
table, 1);
|
||||
|
||||
g_signal_connect (cb_tool->magenta_green_adj, "value-changed",
|
||||
G_CALLBACK (color_balance_mg_changed),
|
||||
cb_tool);
|
||||
|
||||
cb_tool->yellow_blue_adj =
|
||||
create_levels_scale (_("Yellow"), _("Blue"), table, 2);
|
||||
cb_tool->yellow_blue_adj = create_levels_scale (_("Yellow"), _("Blue"),
|
||||
table, 2);
|
||||
|
||||
g_signal_connect (cb_tool->yellow_blue_adj, "value-changed",
|
||||
G_CALLBACK (color_balance_yb_changed),
|
||||
|
@ -315,7 +313,7 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *im_tool)
|
|||
cb_tool->preserve_toggle =
|
||||
gtk_check_button_new_with_mnemonic (_("Preserve _luminosity"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_tool->preserve_toggle),
|
||||
cb_tool->color_balance->preserve_luminosity);
|
||||
cb_tool->config->preserve_luminosity);
|
||||
gtk_box_pack_end (GTK_BOX (im_tool->main_vbox), cb_tool->preserve_toggle,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (cb_tool->preserve_toggle);
|
||||
|
@ -323,51 +321,62 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *im_tool)
|
|||
g_signal_connect (cb_tool->preserve_toggle, "toggled",
|
||||
G_CALLBACK (color_balance_preserve_toggled),
|
||||
cb_tool);
|
||||
|
||||
/* set range after everything is in place */
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (toggle),
|
||||
cb_tool->transfer_mode);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_balance_tool_reset (GimpImageMapTool *im_tool)
|
||||
{
|
||||
GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (im_tool);
|
||||
GimpTransferMode range = cb_tool->config->range;
|
||||
|
||||
gimp_color_balance_config_reset (cb_tool->config);
|
||||
g_object_set (cb_tool->config,
|
||||
"range", range,
|
||||
NULL);
|
||||
|
||||
color_balance_init (cb_tool->color_balance);
|
||||
color_balance_update (cb_tool);
|
||||
}
|
||||
|
||||
static void
|
||||
color_balance_update (GimpColorBalanceTool *cb_tool)
|
||||
{
|
||||
GimpTransferMode tm = cb_tool->transfer_mode;
|
||||
GimpColorBalanceConfig *config = cb_tool->config;
|
||||
|
||||
gtk_adjustment_set_value (cb_tool->cyan_red_adj,
|
||||
cb_tool->color_balance->cyan_red[tm]);
|
||||
config->cyan_red[config->range] * 100.0);
|
||||
gtk_adjustment_set_value (cb_tool->magenta_green_adj,
|
||||
cb_tool->color_balance->magenta_green[tm]);
|
||||
config->magenta_green[config->range] * 100.0);
|
||||
gtk_adjustment_set_value (cb_tool->yellow_blue_adj,
|
||||
cb_tool->color_balance->yellow_blue[tm]);
|
||||
config->yellow_blue[config->range] * 100.0);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_tool->preserve_toggle),
|
||||
cb_tool->color_balance->preserve_luminosity);
|
||||
config->preserve_luminosity);
|
||||
}
|
||||
|
||||
static void
|
||||
color_balance_range_callback (GtkWidget *widget,
|
||||
GimpColorBalanceTool *cb_tool)
|
||||
{
|
||||
gimp_radio_button_update (widget, &cb_tool->transfer_mode);
|
||||
color_balance_update (cb_tool);
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
||||
{
|
||||
GimpTransferMode range;
|
||||
|
||||
gimp_radio_button_update (widget, &range);
|
||||
g_object_set (cb_tool->config,
|
||||
"range", range,
|
||||
NULL);
|
||||
|
||||
color_balance_update (cb_tool);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
color_balance_range_reset_callback (GtkWidget *widget,
|
||||
GimpColorBalanceTool *cb_tool)
|
||||
{
|
||||
color_balance_range_reset (cb_tool->color_balance,
|
||||
cb_tool->transfer_mode);
|
||||
gimp_color_balance_config_reset_range (cb_tool->config,
|
||||
cb_tool->config->range);
|
||||
|
||||
color_balance_update (cb_tool);
|
||||
|
||||
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (cb_tool));
|
||||
|
@ -377,11 +386,14 @@ static void
|
|||
color_balance_preserve_toggled (GtkWidget *widget,
|
||||
GimpColorBalanceTool *cb_tool)
|
||||
{
|
||||
gboolean active = GTK_TOGGLE_BUTTON (widget)->active;
|
||||
GimpColorBalanceConfig *config = cb_tool->config;
|
||||
gboolean active = GTK_TOGGLE_BUTTON (widget)->active;
|
||||
|
||||
if (cb_tool->color_balance->preserve_luminosity != active)
|
||||
if (config->preserve_luminosity != active)
|
||||
{
|
||||
cb_tool->color_balance->preserve_luminosity = active;
|
||||
g_object_set (config,
|
||||
"preserve-luminosity", active,
|
||||
NULL);
|
||||
|
||||
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (cb_tool));
|
||||
}
|
||||
|
@ -391,11 +403,14 @@ static void
|
|||
color_balance_cr_changed (GtkAdjustment *adjustment,
|
||||
GimpColorBalanceTool *cb_tool)
|
||||
{
|
||||
GimpTransferMode tm = cb_tool->transfer_mode;
|
||||
GimpColorBalanceConfig *config = cb_tool->config;
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
|
||||
if (cb_tool->color_balance->cyan_red[tm] != adjustment->value)
|
||||
if (config->cyan_red[config->range] != value)
|
||||
{
|
||||
cb_tool->color_balance->cyan_red[tm] = adjustment->value;
|
||||
g_object_set (config,
|
||||
"cyan-red", value,
|
||||
NULL);
|
||||
|
||||
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (cb_tool));
|
||||
}
|
||||
|
@ -405,11 +420,14 @@ static void
|
|||
color_balance_mg_changed (GtkAdjustment *adjustment,
|
||||
GimpColorBalanceTool *cb_tool)
|
||||
{
|
||||
GimpTransferMode tm = cb_tool->transfer_mode;
|
||||
GimpColorBalanceConfig *config = cb_tool->config;
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
|
||||
if (cb_tool->color_balance->magenta_green[tm] != adjustment->value)
|
||||
if (config->magenta_green[config->range] != value)
|
||||
{
|
||||
cb_tool->color_balance->magenta_green[tm] = adjustment->value;
|
||||
g_object_set (config,
|
||||
"magenta-green", value,
|
||||
NULL);
|
||||
|
||||
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (cb_tool));
|
||||
}
|
||||
|
@ -419,11 +437,14 @@ static void
|
|||
color_balance_yb_changed (GtkAdjustment *adjustment,
|
||||
GimpColorBalanceTool *cb_tool)
|
||||
{
|
||||
GimpTransferMode tm = cb_tool->transfer_mode;
|
||||
GimpColorBalanceConfig *config = cb_tool->config;
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
|
||||
if (cb_tool->color_balance->yellow_blue[tm] != adjustment->value)
|
||||
if (config->yellow_blue[config->range] != value)
|
||||
{
|
||||
cb_tool->color_balance->yellow_blue[tm] = adjustment->value;
|
||||
g_object_set (config,
|
||||
"yellow-blue", value,
|
||||
NULL);
|
||||
|
||||
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (cb_tool));
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_COLOR_BALANCE_DIALOG_H__
|
||||
#define __GIMP_COLOR_BALANCE_DIALOG_H__
|
||||
#ifndef __GIMP_COLOR_BALANCE_TOOL_H__
|
||||
#define __GIMP_COLOR_BALANCE_TOOL_H__
|
||||
|
||||
|
||||
#include "gimpimagemaptool.h"
|
||||
|
@ -37,16 +37,17 @@ typedef struct _GimpColorBalanceToolClass GimpColorBalanceToolClass;
|
|||
|
||||
struct _GimpColorBalanceTool
|
||||
{
|
||||
GimpImageMapTool parent_instance;
|
||||
GimpImageMapTool parent_instance;
|
||||
|
||||
ColorBalance *color_balance;
|
||||
GimpColorBalanceConfig *config;
|
||||
ColorBalance *color_balance;
|
||||
|
||||
/* dialog */
|
||||
GimpTransferMode transfer_mode;
|
||||
GtkAdjustment *cyan_red_adj;
|
||||
GtkAdjustment *magenta_green_adj;
|
||||
GtkAdjustment *yellow_blue_adj;
|
||||
GtkWidget *preserve_toggle;
|
||||
GtkWidget *range_radio;
|
||||
GtkAdjustment *cyan_red_adj;
|
||||
GtkAdjustment *magenta_green_adj;
|
||||
GtkAdjustment *yellow_blue_adj;
|
||||
GtkWidget *preserve_toggle;
|
||||
};
|
||||
|
||||
struct _GimpColorBalanceToolClass
|
||||
|
@ -61,4 +62,4 @@ void gimp_color_balance_tool_register (GimpToolRegisterCallback callback,
|
|||
GType gimp_color_balance_tool_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_COLOR_BALANCE_GIMP_H__ */
|
||||
#endif /* __GIMP_COLOR_BALANCE_TOOL_H__ */
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimagemap.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
|
||||
|
@ -126,14 +125,14 @@ gimp_colorize_tool_finalize (GObject *object)
|
|||
{
|
||||
GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (object);
|
||||
|
||||
g_slice_free (Colorize, col_tool->colorize);
|
||||
|
||||
if (col_tool->config)
|
||||
{
|
||||
g_object_unref (col_tool->config);
|
||||
col_tool->config = NULL;
|
||||
}
|
||||
|
||||
g_slice_free (Colorize, col_tool->colorize);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -155,11 +154,7 @@ gimp_colorize_tool_initialize (GimpTool *tool,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
g_object_set (col_tool->config,
|
||||
"hue", 0.5,
|
||||
"saturation", 0.5,
|
||||
"lightness", 0.0,
|
||||
NULL);
|
||||
gimp_colorize_config_reset (col_tool->config);
|
||||
|
||||
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
|
||||
|
||||
|
@ -193,14 +188,8 @@ static void
|
|||
gimp_colorize_tool_map (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (image_map_tool);
|
||||
GimpColorizeConfig *config = col_tool->config;
|
||||
Colorize *colorize = col_tool->colorize;
|
||||
|
||||
colorize->hue = config->hue * 360.0;
|
||||
colorize->saturation = config->saturation * 100.0;
|
||||
colorize->lightness = config->lightness * 100.0;
|
||||
|
||||
colorize_calculate (colorize);
|
||||
gimp_colorize_config_to_cruft (col_tool->config, col_tool->colorize);
|
||||
}
|
||||
|
||||
|
||||
|
@ -282,11 +271,7 @@ gimp_colorize_tool_reset (GimpImageMapTool *image_map_tool)
|
|||
{
|
||||
GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (image_map_tool);
|
||||
|
||||
g_object_set (col_tool->config,
|
||||
"hue", 0.5,
|
||||
"saturation", 0.5,
|
||||
"lightness", 0.0,
|
||||
NULL);
|
||||
gimp_colorize_config_reset (col_tool->config);
|
||||
|
||||
colorize_update_sliders (col_tool);
|
||||
}
|
||||
|
|
|
@ -18,16 +18,10 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "tools-types.h"
|
||||
|
@ -36,12 +30,14 @@
|
|||
#include "base/gimphistogram.h"
|
||||
#include "base/gimplut.h"
|
||||
|
||||
#include "gegl/gimpcurvesconfig.h"
|
||||
#include "gegl/gimpoperationcurves.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcurve.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpdrawable-histogram.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimagemap.h"
|
||||
|
||||
#include "widgets/gimpcolorbar.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
|
@ -62,52 +58,53 @@
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_curves_tool_finalize (GObject *object);
|
||||
static void gimp_curves_tool_finalize (GObject *object);
|
||||
|
||||
static gboolean gimp_curves_tool_initialize (GimpTool *tool,
|
||||
GimpDisplay *display,
|
||||
GError **error);
|
||||
static void gimp_curves_tool_button_release (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GimpButtonReleaseType release_type,
|
||||
GimpDisplay *display);
|
||||
static gboolean gimp_curves_tool_key_press (GimpTool *tool,
|
||||
GdkEventKey *kevent,
|
||||
GimpDisplay *display);
|
||||
static void gimp_curves_tool_oper_update (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
GdkModifierType state,
|
||||
gboolean proximity,
|
||||
GimpDisplay *display);
|
||||
static gboolean gimp_curves_tool_initialize (GimpTool *tool,
|
||||
GimpDisplay *display,
|
||||
GError **error);
|
||||
static void gimp_curves_tool_button_release (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GimpButtonReleaseType release_type,
|
||||
GimpDisplay *display);
|
||||
static gboolean gimp_curves_tool_key_press (GimpTool *tool,
|
||||
GdkEventKey *kevent,
|
||||
GimpDisplay *display);
|
||||
static void gimp_curves_tool_oper_update (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
GdkModifierType state,
|
||||
gboolean proximity,
|
||||
GimpDisplay *display);
|
||||
|
||||
static void gimp_curves_tool_color_picked (GimpColorTool *color_tool,
|
||||
GimpColorPickState pick_state,
|
||||
GimpImageType sample_type,
|
||||
GimpRGB *color,
|
||||
gint color_index);
|
||||
static void gimp_curves_tool_map (GimpImageMapTool *image_map_tool);
|
||||
static void gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool);
|
||||
static void gimp_curves_tool_reset (GimpImageMapTool *image_map_tool);
|
||||
static gboolean gimp_curves_tool_settings_load (GimpImageMapTool *image_map_tool,
|
||||
gpointer fp,
|
||||
GError **error);
|
||||
static gboolean gimp_curves_tool_settings_save (GimpImageMapTool *image_map_tool,
|
||||
gpointer fp);
|
||||
static void gimp_curves_tool_color_picked (GimpColorTool *color_tool,
|
||||
GimpColorPickState pick_state,
|
||||
GimpImageType sample_type,
|
||||
GimpRGB *color,
|
||||
gint color_index);
|
||||
static GeglNode * gimp_curves_tool_get_operation (GimpImageMapTool *image_map_tool);
|
||||
static void gimp_curves_tool_map (GimpImageMapTool *image_map_tool);
|
||||
static void gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool);
|
||||
static void gimp_curves_tool_reset (GimpImageMapTool *image_map_tool);
|
||||
static gboolean gimp_curves_tool_settings_load (GimpImageMapTool *image_map_tool,
|
||||
gpointer fp,
|
||||
GError **error);
|
||||
static gboolean gimp_curves_tool_settings_save (GimpImageMapTool *image_map_tool,
|
||||
gpointer fp);
|
||||
|
||||
static void curves_curve_callback (GimpCurve *curve,
|
||||
GimpCurvesTool *tool);
|
||||
static void curves_channel_callback (GtkWidget *widget,
|
||||
GimpCurvesTool *tool);
|
||||
static void curves_channel_reset_callback (GtkWidget *widget,
|
||||
GimpCurvesTool *tool);
|
||||
static void curves_curve_callback (GimpCurve *curve,
|
||||
GimpCurvesTool *tool);
|
||||
static void curves_channel_callback (GtkWidget *widget,
|
||||
GimpCurvesTool *tool);
|
||||
static void curves_channel_reset_callback (GtkWidget *widget,
|
||||
GimpCurvesTool *tool);
|
||||
|
||||
static gboolean curves_menu_sensitivity (gint value,
|
||||
gpointer data);
|
||||
static gboolean curves_menu_sensitivity (gint value,
|
||||
gpointer data);
|
||||
|
||||
static void curves_curve_type_callback (GtkWidget *widget,
|
||||
GimpCurvesTool *tool);
|
||||
static void curves_curve_type_callback (GtkWidget *widget,
|
||||
GimpCurvesTool *tool);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCurvesTool, gimp_curves_tool, GIMP_TYPE_IMAGE_MAP_TOOL)
|
||||
|
@ -161,6 +158,7 @@ gimp_curves_tool_class_init (GimpCurvesToolClass *klass)
|
|||
im_tool_class->save_dialog_title = _("Save Curves");
|
||||
im_tool_class->save_button_tip = _("Save curves settings to file");
|
||||
|
||||
im_tool_class->get_operation = gimp_curves_tool_get_operation;
|
||||
im_tool_class->map = gimp_curves_tool_map;
|
||||
im_tool_class->dialog = gimp_curves_tool_dialog;
|
||||
im_tool_class->reset = gimp_curves_tool_reset;
|
||||
|
@ -174,17 +172,7 @@ gimp_curves_tool_init (GimpCurvesTool *tool)
|
|||
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (tool->curve); i++)
|
||||
{
|
||||
tool->curve[i] = GIMP_CURVE (gimp_curve_new ("curves tool"));
|
||||
|
||||
g_signal_connect_object (tool->curve[i], "dirty",
|
||||
G_CALLBACK (curves_curve_callback),
|
||||
tool, 0);
|
||||
}
|
||||
|
||||
tool->lut = gimp_lut_new ();
|
||||
tool->channel = GIMP_HISTOGRAM_VALUE;
|
||||
tool->lut = gimp_lut_new ();
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (tool->col_value); i++)
|
||||
tool->col_value[i] = -1;
|
||||
|
@ -197,10 +185,12 @@ static void
|
|||
gimp_curves_tool_finalize (GObject *object)
|
||||
{
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (object);
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (tool->curve); i++)
|
||||
g_object_unref (tool->curve[i]);
|
||||
if (tool->config)
|
||||
{
|
||||
g_object_unref (tool->config);
|
||||
tool->config = NULL;
|
||||
}
|
||||
|
||||
gimp_lut_free (tool->lut);
|
||||
|
||||
|
@ -232,15 +222,14 @@ gimp_curves_tool_initialize (GimpTool *tool,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (c_tool->curve); i++)
|
||||
gimp_curve_reset (c_tool->curve[i], TRUE);
|
||||
for (i = 0; i < G_N_ELEMENTS (c_tool->config->curve); i++)
|
||||
gimp_curve_reset (c_tool->config->curve[i], TRUE);
|
||||
|
||||
if (! c_tool->hist)
|
||||
c_tool->hist = gimp_histogram_new ();
|
||||
|
||||
c_tool->channel = GIMP_HISTOGRAM_VALUE;
|
||||
c_tool->color = gimp_drawable_is_rgb (drawable);
|
||||
c_tool->alpha = gimp_drawable_has_alpha (drawable);
|
||||
c_tool->color = gimp_drawable_is_rgb (drawable);
|
||||
c_tool->alpha = gimp_drawable_has_alpha (drawable);
|
||||
|
||||
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
|
||||
|
||||
|
@ -252,17 +241,13 @@ gimp_curves_tool_initialize (GimpTool *tool,
|
|||
curves_menu_sensitivity, c_tool, NULL);
|
||||
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (c_tool->channel_menu),
|
||||
c_tool->channel);
|
||||
|
||||
/* FIXME: hack */
|
||||
if (! c_tool->color)
|
||||
c_tool->channel = (c_tool->channel == GIMP_HISTOGRAM_ALPHA) ? 1 : 0;
|
||||
c_tool->config->channel);
|
||||
|
||||
gimp_drawable_calculate_histogram (drawable, c_tool->hist);
|
||||
gimp_histogram_view_set_background (GIMP_HISTOGRAM_VIEW (c_tool->graph),
|
||||
c_tool->hist);
|
||||
gimp_curve_view_set_curve (GIMP_CURVE_VIEW (c_tool->graph),
|
||||
c_tool->curve[c_tool->channel]);
|
||||
c_tool->config->curve[c_tool->config->channel]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -275,24 +260,25 @@ gimp_curves_tool_button_release (GimpTool *tool,
|
|||
GimpButtonReleaseType release_type,
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool);
|
||||
GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool);
|
||||
GimpCurvesConfig *config = c_tool->config;
|
||||
|
||||
if (state & GDK_SHIFT_MASK)
|
||||
{
|
||||
GimpCurve *curve = c_tool->curve[c_tool->channel];
|
||||
GimpCurve *curve = config->curve[config->channel];
|
||||
gint closest;
|
||||
|
||||
closest =
|
||||
gimp_curve_get_closest_point (curve,
|
||||
c_tool->col_value[c_tool->channel]);
|
||||
c_tool->col_value[config->channel]);
|
||||
|
||||
gimp_curve_view_set_selected (GIMP_CURVE_VIEW (c_tool->graph),
|
||||
closest);
|
||||
|
||||
gimp_curve_set_point (curve,
|
||||
closest,
|
||||
c_tool->col_value[c_tool->channel],
|
||||
curve->curve[c_tool->col_value[c_tool->channel]]);
|
||||
c_tool->col_value[config->channel],
|
||||
curve->curve[c_tool->col_value[config->channel]]);
|
||||
}
|
||||
else if (state & GDK_CONTROL_MASK)
|
||||
{
|
||||
|
@ -300,7 +286,7 @@ gimp_curves_tool_button_release (GimpTool *tool,
|
|||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
GimpCurve *curve = c_tool->curve[i];
|
||||
GimpCurve *curve = config->curve[i];
|
||||
gint closest;
|
||||
|
||||
closest =
|
||||
|
@ -371,10 +357,9 @@ gimp_curves_tool_color_picked (GimpColorTool *color_tool,
|
|||
GimpRGB *color,
|
||||
gint color_index)
|
||||
{
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (color_tool);
|
||||
GimpDrawable *drawable;
|
||||
guchar r, g, b, a;
|
||||
GimpHistogramChannel channel;
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (color_tool);
|
||||
GimpDrawable *drawable;
|
||||
guchar r, g, b, a;
|
||||
|
||||
drawable = GIMP_IMAGE_MAP_TOOL (tool)->drawable;
|
||||
|
||||
|
@ -392,13 +377,35 @@ gimp_curves_tool_color_picked (GimpColorTool *color_tool,
|
|||
|
||||
tool->col_value[GIMP_HISTOGRAM_VALUE] = MAX (MAX (r, g), b);
|
||||
|
||||
if (tool->color)
|
||||
channel = tool->channel;
|
||||
else
|
||||
channel = (tool->channel == 1) ? GIMP_HISTOGRAM_ALPHA : GIMP_HISTOGRAM_VALUE;
|
||||
|
||||
gimp_curve_view_set_xpos (GIMP_CURVE_VIEW (tool->graph),
|
||||
tool->col_value[channel]);
|
||||
tool->col_value[tool->config->channel]);
|
||||
}
|
||||
|
||||
static GeglNode *
|
||||
gimp_curves_tool_get_operation (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
||||
GeglNode *node;
|
||||
gint i;
|
||||
|
||||
node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "gimp-curves",
|
||||
NULL);
|
||||
|
||||
tool->config = g_object_new (GIMP_TYPE_CURVES_CONFIG, NULL);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (tool->config->curve); i++)
|
||||
{
|
||||
g_signal_connect_object (tool->config->curve[i], "dirty",
|
||||
G_CALLBACK (curves_curve_callback),
|
||||
tool, 0);
|
||||
}
|
||||
|
||||
gegl_node_set (node,
|
||||
"config", tool->config,
|
||||
NULL);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -406,10 +413,8 @@ gimp_curves_tool_map (GimpImageMapTool *image_map_tool)
|
|||
{
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
||||
Curves curves;
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (tool->curve); i++)
|
||||
gimp_curve_get_uchar (tool->curve[i], curves.curve[i]);
|
||||
gimp_curves_config_to_cruft (tool->config, &curves, tool->color);
|
||||
|
||||
gimp_lut_setup (tool->lut,
|
||||
(GimpLutFunc) curves_lut_func,
|
||||
|
@ -600,15 +605,13 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
|
|||
static void
|
||||
gimp_curves_tool_reset (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
||||
GimpHistogramChannel channel;
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
||||
GimpHistogramChannel channel = tool->config->channel;
|
||||
|
||||
for (channel = GIMP_HISTOGRAM_VALUE;
|
||||
channel <= GIMP_HISTOGRAM_ALPHA;
|
||||
channel++)
|
||||
{
|
||||
gimp_curve_reset (tool->curve[channel], FALSE);
|
||||
}
|
||||
gimp_curves_config_reset (tool->config);
|
||||
g_object_set (tool->config,
|
||||
"channel", channel,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -617,55 +620,16 @@ gimp_curves_tool_settings_load (GimpImageMapTool *image_map_tool,
|
|||
GError **error)
|
||||
{
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
||||
FILE *file = fp;
|
||||
gint i, j;
|
||||
gint fields;
|
||||
gchar buf[50];
|
||||
gint index[5][GIMP_CURVE_NUM_POINTS];
|
||||
gint value[5][GIMP_CURVE_NUM_POINTS];
|
||||
|
||||
if (! fgets (buf, sizeof (buf), file) ||
|
||||
strcmp (buf, "# GIMP Curves File\n") != 0)
|
||||
if (gimp_curves_config_load_cruft (tool->config, fp, error))
|
||||
{
|
||||
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_PARSE,
|
||||
_("not a GIMP Curves file"));
|
||||
return FALSE;
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (tool->curve_type),
|
||||
GIMP_CURVE_SMOOTH);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
for (j = 0; j < GIMP_CURVE_NUM_POINTS; j++)
|
||||
{
|
||||
fields = fscanf (file, "%d %d ", &index[i][j], &value[i][j]);
|
||||
if (fields != 2)
|
||||
{
|
||||
/* FIXME: should have a helpful error message here */
|
||||
g_printerr ("fields != 2");
|
||||
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_PARSE,
|
||||
_("parse error"));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
GimpCurve *curve = tool->curve[i];
|
||||
|
||||
gimp_data_freeze (GIMP_DATA (curve));
|
||||
|
||||
gimp_curve_set_curve_type (curve, GIMP_CURVE_SMOOTH);
|
||||
|
||||
for (j = 0; j < GIMP_CURVE_NUM_POINTS; j++)
|
||||
gimp_curve_set_point (curve, j, index[i][j], value[i][j]);
|
||||
|
||||
gimp_data_thaw (GIMP_DATA (curve));
|
||||
}
|
||||
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (tool->curve_type),
|
||||
GIMP_CURVE_SMOOTH);
|
||||
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -673,76 +637,39 @@ gimp_curves_tool_settings_save (GimpImageMapTool *image_map_tool,
|
|||
gpointer fp)
|
||||
{
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
||||
FILE *file = fp;
|
||||
gint i, j;
|
||||
gint32 index;
|
||||
|
||||
fprintf (file, "# GIMP Curves File\n");
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
GimpCurve *curve = tool->curve[i];
|
||||
|
||||
if (curve->curve_type == GIMP_CURVE_FREE)
|
||||
{
|
||||
/* pick representative points from the curve and make them
|
||||
* control points
|
||||
*/
|
||||
for (j = 0; j <= 8; j++)
|
||||
{
|
||||
index = CLAMP0255 (j * 32);
|
||||
|
||||
curve->points[j * 2][0] = index;
|
||||
curve->points[j * 2][1] = curve->curve[index];
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < GIMP_CURVE_NUM_POINTS; j++)
|
||||
fprintf (file, "%d %d ",
|
||||
curve->points[j][0],
|
||||
curve->points[j][1]);
|
||||
|
||||
fprintf (file, "\n");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return gimp_curves_config_save_cruft (tool->config, fp);
|
||||
}
|
||||
|
||||
static void
|
||||
curves_curve_callback (GimpCurve *curve,
|
||||
GimpCurvesTool *tool)
|
||||
{
|
||||
if (curve != tool->curve[tool->channel])
|
||||
GimpCurvesConfig *config = tool->config;
|
||||
|
||||
if (curve != config->curve[config->channel])
|
||||
return;
|
||||
|
||||
if (tool->xrange)
|
||||
{
|
||||
GimpHistogramChannel channel;
|
||||
|
||||
if (tool->color)
|
||||
channel = tool->channel;
|
||||
else
|
||||
channel = ((tool->channel == 1) ?
|
||||
GIMP_HISTOGRAM_ALPHA : GIMP_HISTOGRAM_VALUE);
|
||||
|
||||
switch (channel)
|
||||
switch (config->channel)
|
||||
{
|
||||
case GIMP_HISTOGRAM_VALUE:
|
||||
case GIMP_HISTOGRAM_ALPHA:
|
||||
case GIMP_HISTOGRAM_RGB:
|
||||
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange),
|
||||
tool->curve[tool->channel]->curve,
|
||||
tool->curve[tool->channel]->curve,
|
||||
tool->curve[tool->channel]->curve);
|
||||
config->curve[config->channel]->curve,
|
||||
config->curve[config->channel]->curve,
|
||||
config->curve[config->channel]->curve);
|
||||
break;
|
||||
|
||||
case GIMP_HISTOGRAM_RED:
|
||||
case GIMP_HISTOGRAM_GREEN:
|
||||
case GIMP_HISTOGRAM_BLUE:
|
||||
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange),
|
||||
tool->curve[GIMP_HISTOGRAM_RED]->curve,
|
||||
tool->curve[GIMP_HISTOGRAM_GREEN]->curve,
|
||||
tool->curve[GIMP_HISTOGRAM_BLUE]->curve);
|
||||
config->curve[GIMP_HISTOGRAM_RED]->curve,
|
||||
config->curve[GIMP_HISTOGRAM_GREEN]->curve,
|
||||
config->curve[GIMP_HISTOGRAM_BLUE]->curve);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -759,25 +686,27 @@ curves_channel_callback (GtkWidget *widget,
|
|||
|
||||
if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value))
|
||||
{
|
||||
tool->channel = value;
|
||||
GimpCurvesConfig *config = tool->config;
|
||||
|
||||
g_object_set (config,
|
||||
"channel", value,
|
||||
NULL);
|
||||
|
||||
gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->graph),
|
||||
tool->channel);
|
||||
config->channel);
|
||||
gimp_curve_view_set_xpos (GIMP_CURVE_VIEW (tool->graph),
|
||||
tool->col_value[tool->channel]);
|
||||
tool->col_value[config->channel]);
|
||||
|
||||
gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->yrange), tool->channel);
|
||||
|
||||
/* FIXME: hack */
|
||||
if (! tool->color)
|
||||
tool->channel = (tool->channel == GIMP_HISTOGRAM_ALPHA) ? 1 : 0;
|
||||
gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->yrange),
|
||||
config->channel);
|
||||
|
||||
gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph),
|
||||
tool->curve[tool->channel]);
|
||||
config->curve[config->channel]);
|
||||
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (tool->curve_type),
|
||||
tool->curve[tool->channel]->curve_type);
|
||||
config->curve[config->channel]->curve_type);
|
||||
|
||||
curves_curve_callback (tool->curve[tool->channel], tool);
|
||||
curves_curve_callback (config->curve[config->channel], tool);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -785,7 +714,7 @@ static void
|
|||
curves_channel_reset_callback (GtkWidget *widget,
|
||||
GimpCurvesTool *tool)
|
||||
{
|
||||
gimp_curve_reset (tool->curve[tool->channel], FALSE);
|
||||
gimp_curves_config_reset_channel (tool->config, tool->config->channel);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -819,12 +748,13 @@ static void
|
|||
curves_curve_type_callback (GtkWidget *widget,
|
||||
GimpCurvesTool *tool)
|
||||
{
|
||||
GimpCurveType curve_type;
|
||||
GimpCurvesConfig *config = tool->config;
|
||||
GimpCurveType curve_type;
|
||||
|
||||
gimp_radio_button_update (widget, &curve_type);
|
||||
|
||||
if (tool->curve[tool->channel]->curve_type != curve_type)
|
||||
if (config->curve[config->channel]->curve_type != curve_type)
|
||||
{
|
||||
gimp_curve_set_curve_type (tool->curve[tool->channel], curve_type);
|
||||
gimp_curve_set_curve_type (config->curve[config->channel], curve_type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,13 +37,12 @@ struct _GimpCurvesTool
|
|||
{
|
||||
GimpImageMapTool parent_instance;
|
||||
|
||||
GimpCurve *curve[5];
|
||||
GimpCurvesConfig *config;
|
||||
GimpLut *lut;
|
||||
|
||||
/* dialog */
|
||||
gboolean color;
|
||||
gboolean alpha;
|
||||
GimpHistogramChannel channel;
|
||||
|
||||
gint col_value[5];
|
||||
|
||||
|
|
|
@ -21,16 +21,17 @@
|
|||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "tools-types.h"
|
||||
|
||||
#include "base/hue-saturation.h"
|
||||
|
||||
#include "gegl/gimphuesaturationconfig.h"
|
||||
#include "gegl/gimpoperationhuesaturation.h"
|
||||
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimagemap.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
|
||||
|
@ -60,21 +61,21 @@ static void gimp_hue_saturation_tool_map (GimpImageMapTool *im_t
|
|||
static void gimp_hue_saturation_tool_dialog (GimpImageMapTool *im_tool);
|
||||
static void gimp_hue_saturation_tool_reset (GimpImageMapTool *im_tool);
|
||||
|
||||
static void hue_saturation_update_sliders (GimpHueSaturationTool *hs_tool);
|
||||
static void hue_saturation_update_color_areas (GimpHueSaturationTool *hs_tool);
|
||||
static void hue_saturation_update_sliders (GimpHueSaturationTool *hs_tool);
|
||||
static void hue_saturation_update_color_areas (GimpHueSaturationTool *hs_tool);
|
||||
|
||||
static void hue_saturation_partition_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void hue_saturation_partition_reset_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void hue_saturation_hue_changed (GtkAdjustment *adj,
|
||||
gpointer data);
|
||||
static void hue_saturation_lightness_changed (GtkAdjustment *adj,
|
||||
gpointer data);
|
||||
static void hue_saturation_saturation_changed (GtkAdjustment *adj,
|
||||
gpointer data);
|
||||
static void hue_saturation_overlap_changed (GtkAdjustment *adj,
|
||||
gpointer data);
|
||||
static void hue_saturation_range_callback (GtkWidget *widget,
|
||||
GimpHueSaturationTool *hs_tool);
|
||||
static void hue_saturation_range_reset_callback (GtkWidget *widget,
|
||||
GimpHueSaturationTool *hs_tool);
|
||||
static void hue_saturation_hue_changed (GtkAdjustment *adjustment,
|
||||
GimpHueSaturationTool *hs_tool);
|
||||
static void hue_saturation_lightness_changed (GtkAdjustment *adjustment,
|
||||
GimpHueSaturationTool *hs_tool);
|
||||
static void hue_saturation_saturation_changed (GtkAdjustment *adjustment,
|
||||
GimpHueSaturationTool *hs_tool);
|
||||
static void hue_saturation_overlap_changed (GtkAdjustment *adjustment,
|
||||
GimpHueSaturationTool *hs_tool);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpHueSaturationTool, gimp_hue_saturation_tool,
|
||||
|
@ -82,16 +83,6 @@ G_DEFINE_TYPE (GimpHueSaturationTool, gimp_hue_saturation_tool,
|
|||
|
||||
#define parent_class gimp_hue_saturation_tool_parent_class
|
||||
|
||||
static gint default_colors[6][3] =
|
||||
{
|
||||
{ 255, 0, 0 },
|
||||
{ 255, 255, 0 },
|
||||
{ 0, 255, 0 },
|
||||
{ 0, 255, 255 },
|
||||
{ 0, 0, 255 },
|
||||
{ 255, 0, 255 }
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
gimp_hue_saturation_tool_register (GimpToolRegisterCallback callback,
|
||||
|
@ -134,7 +125,6 @@ gimp_hue_saturation_tool_init (GimpHueSaturationTool *hs_tool)
|
|||
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (hs_tool);
|
||||
|
||||
hs_tool->hue_saturation = g_slice_new0 (HueSaturation);
|
||||
hs_tool->hue_partition = GIMP_ALL_HUES;
|
||||
|
||||
hue_saturation_init (hs_tool->hue_saturation);
|
||||
|
||||
|
@ -147,6 +137,12 @@ gimp_hue_saturation_tool_finalize (GObject *object)
|
|||
{
|
||||
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (object);
|
||||
|
||||
if (hs_tool->config)
|
||||
{
|
||||
g_object_unref (hs_tool->config);
|
||||
hs_tool->config = NULL;
|
||||
}
|
||||
|
||||
g_slice_free (HueSaturation, hs_tool->hue_saturation);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
|
@ -172,11 +168,13 @@ gimp_hue_saturation_tool_initialize (GimpTool *tool,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
hue_saturation_init (hs_tool->hue_saturation);
|
||||
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
|
||||
gimp_hue_saturation_config_reset (hs_tool->config);
|
||||
|
||||
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
|
||||
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (hs_tool->range_radio),
|
||||
hs_tool->config->range);
|
||||
|
||||
hue_saturation_update_sliders (hs_tool);
|
||||
hue_saturation_update_color_areas (hs_tool);
|
||||
|
||||
|
@ -186,34 +184,28 @@ gimp_hue_saturation_tool_initialize (GimpTool *tool,
|
|||
static GeglNode *
|
||||
gimp_hue_saturation_tool_get_operation (GimpImageMapTool *im_tool)
|
||||
{
|
||||
return g_object_new (GEGL_TYPE_NODE,
|
||||
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (im_tool);
|
||||
GeglNode *node;
|
||||
|
||||
node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "gimp-hue-saturation",
|
||||
NULL);
|
||||
|
||||
hs_tool->config = g_object_new (GIMP_TYPE_HUE_SATURATION_CONFIG, NULL);
|
||||
|
||||
gegl_node_set (node,
|
||||
"config", hs_tool->config,
|
||||
NULL);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_hue_saturation_tool_map (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (image_map_tool);
|
||||
HueSaturation *hs = hs_tool->hue_saturation;
|
||||
GimpHueRange range;
|
||||
|
||||
for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++)
|
||||
{
|
||||
gegl_node_set (image_map_tool->operation,
|
||||
"range", range,
|
||||
NULL);
|
||||
|
||||
gegl_node_set (image_map_tool->operation,
|
||||
"hue", hs->hue[range] / 180.0,
|
||||
"saturation", hs->saturation[range] / 100.0,
|
||||
"lightness", hs->lightness[range] / 100.0,
|
||||
NULL);
|
||||
}
|
||||
|
||||
gegl_node_set (image_map_tool->operation,
|
||||
"overlap", hs->overlap / 100.0,
|
||||
NULL);
|
||||
gimp_hue_saturation_config_to_cruft (hs_tool->config, hs_tool->hue_saturation);
|
||||
}
|
||||
|
||||
|
||||
|
@ -247,7 +239,7 @@ gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool)
|
|||
gint frame_col;
|
||||
gint frame_row;
|
||||
}
|
||||
hue_partition_table[] =
|
||||
hue_range_table[] =
|
||||
{
|
||||
{ N_("M_aster"), N_("Adjust all colors"), 2, 3, 0, 0 },
|
||||
{ N_("_R"), N_("Red"), 2, 1, 2, 0 },
|
||||
|
@ -271,7 +263,7 @@ gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), abox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
/* The table containing hue partitions */
|
||||
/* The table containing hue ranges */
|
||||
table = gtk_table_new (7, 5, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 3, 4);
|
||||
|
@ -279,27 +271,31 @@ gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool)
|
|||
gtk_table_set_row_spacing (GTK_TABLE (table), 5, 2);
|
||||
gtk_container_add (GTK_CONTAINER (abox), table);
|
||||
|
||||
/* the radio buttons for hue partitions */
|
||||
for (i = 0; i < G_N_ELEMENTS (hue_partition_table); i++)
|
||||
/* the radio buttons for hue ranges */
|
||||
for (i = 0; i < G_N_ELEMENTS (hue_range_table); i++)
|
||||
{
|
||||
button = gtk_radio_button_new_with_mnemonic (group,
|
||||
gettext (hue_partition_table[i].label));
|
||||
gettext (hue_range_table[i].label));
|
||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
||||
g_object_set_data (G_OBJECT (button), "hue_partition",
|
||||
g_object_set_data (G_OBJECT (button), "gimp-item-data",
|
||||
GINT_TO_POINTER (i));
|
||||
|
||||
gimp_help_set_help_data (button,
|
||||
gettext (hue_partition_table[i].tooltip),
|
||||
gettext (hue_range_table[i].tooltip),
|
||||
NULL);
|
||||
|
||||
if (i == 0)
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
|
||||
{
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
|
||||
|
||||
hs_tool->range_radio = button;
|
||||
}
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), button,
|
||||
hue_partition_table[i].label_col,
|
||||
hue_partition_table[i].label_col + 1,
|
||||
hue_partition_table[i].label_row,
|
||||
hue_partition_table[i].label_row + 1,
|
||||
hue_range_table[i].label_col,
|
||||
hue_range_table[i].label_col + 1,
|
||||
hue_range_table[i].label_row,
|
||||
hue_range_table[i].label_row + 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
|
||||
if (i > 0)
|
||||
|
@ -309,25 +305,24 @@ gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool)
|
|||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_table_attach (GTK_TABLE (table), frame,
|
||||
hue_partition_table[i].frame_col,
|
||||
hue_partition_table[i].frame_col + 1,
|
||||
hue_partition_table[i].frame_row,
|
||||
hue_partition_table[i].frame_row + 1,
|
||||
hue_range_table[i].frame_col,
|
||||
hue_range_table[i].frame_col + 1,
|
||||
hue_range_table[i].frame_row,
|
||||
hue_range_table[i].frame_row + 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
hs_tool->hue_partition_da[i - 1] = gimp_color_area_new (&color,
|
||||
GIMP_COLOR_AREA_FLAT,
|
||||
0);
|
||||
gtk_widget_set_size_request (hs_tool->hue_partition_da[i - 1],
|
||||
hs_tool->hue_range_color_area[i - 1] =
|
||||
gimp_color_area_new (&color, GIMP_COLOR_AREA_FLAT, 0);
|
||||
gtk_widget_set_size_request (hs_tool->hue_range_color_area[i - 1],
|
||||
DA_WIDTH, DA_HEIGHT);
|
||||
gtk_container_add (GTK_CONTAINER (frame),
|
||||
hs_tool->hue_partition_da[i - 1]);
|
||||
gtk_widget_show (hs_tool->hue_partition_da[i - 1]);
|
||||
hs_tool->hue_range_color_area[i - 1]);
|
||||
gtk_widget_show (hs_tool->hue_range_color_area[i - 1]);
|
||||
}
|
||||
|
||||
g_signal_connect (button, "toggled",
|
||||
G_CALLBACK (hue_saturation_partition_callback),
|
||||
G_CALLBACK (hue_saturation_range_callback),
|
||||
hs_tool);
|
||||
|
||||
gtk_widget_show (button);
|
||||
|
@ -443,7 +438,7 @@ gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool)
|
|||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (hue_saturation_partition_reset_callback),
|
||||
G_CALLBACK (hue_saturation_range_reset_callback),
|
||||
hs_tool);
|
||||
}
|
||||
|
||||
|
@ -451,9 +446,12 @@ static void
|
|||
gimp_hue_saturation_tool_reset (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (image_map_tool);
|
||||
GimpHueRange range = hs_tool->config->range;
|
||||
|
||||
hue_saturation_init (hs_tool->hue_saturation);
|
||||
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
|
||||
gimp_hue_saturation_config_reset (hs_tool->config);
|
||||
g_object_set (hs_tool->config,
|
||||
"range", range,
|
||||
NULL);
|
||||
|
||||
hue_saturation_update_sliders (hs_tool);
|
||||
hue_saturation_update_color_areas (hs_tool);
|
||||
|
@ -462,72 +460,68 @@ gimp_hue_saturation_tool_reset (GimpImageMapTool *image_map_tool)
|
|||
static void
|
||||
hue_saturation_update_sliders (GimpHueSaturationTool *hs_tool)
|
||||
{
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->hue_data),
|
||||
hs_tool->hue_saturation->hue[hs_tool->hue_partition]);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->lightness_data),
|
||||
hs_tool->hue_saturation->lightness[hs_tool->hue_partition]);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->saturation_data),
|
||||
hs_tool->hue_saturation->saturation[hs_tool->hue_partition]);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->overlap_data),
|
||||
hs_tool->hue_saturation->overlap);
|
||||
GimpHueSaturationConfig *config = hs_tool->config;
|
||||
|
||||
gtk_adjustment_set_value (hs_tool->hue_data,
|
||||
config->hue[config->range] * 180.0);
|
||||
gtk_adjustment_set_value (hs_tool->lightness_data,
|
||||
config->lightness[config->range] * 100.0);
|
||||
gtk_adjustment_set_value (hs_tool->saturation_data,
|
||||
config->saturation[config->range] * 100.0);
|
||||
gtk_adjustment_set_value (hs_tool->overlap_data,
|
||||
config->overlap * 100.0);
|
||||
}
|
||||
|
||||
static void
|
||||
hue_saturation_update_color_areas (GimpHueSaturationTool *hs_tool)
|
||||
{
|
||||
gint rgb[3];
|
||||
GimpRGB color;
|
||||
gint i;
|
||||
static GimpRGB default_colors[6] =
|
||||
{
|
||||
{ 1.0, 0, 0, },
|
||||
{ 1.0, 1.0, 0, },
|
||||
{ 0, 1.0, 0, },
|
||||
{ 0, 1.0, 1.0, },
|
||||
{ 0, 0, 1.0, },
|
||||
{ 1.0, 0, 1.0, }
|
||||
};
|
||||
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
rgb[RED_PIX] = default_colors[i][RED_PIX];
|
||||
rgb[GREEN_PIX] = default_colors[i][GREEN_PIX];
|
||||
rgb[BLUE_PIX] = default_colors[i][BLUE_PIX];
|
||||
GimpRGB color = default_colors[i];
|
||||
|
||||
gimp_rgb_to_hsl_int (rgb, rgb + 1, rgb + 2);
|
||||
gimp_operation_hue_saturation_map (hs_tool->config, &color, i + 1,
|
||||
&color);
|
||||
|
||||
rgb[RED_PIX] = hs_tool->hue_saturation->hue_transfer[i][rgb[RED_PIX]];
|
||||
rgb[GREEN_PIX] = hs_tool->hue_saturation->saturation_transfer[i][rgb[GREEN_PIX]];
|
||||
rgb[BLUE_PIX] = hs_tool->hue_saturation->lightness_transfer[i][rgb[BLUE_PIX]];
|
||||
|
||||
gimp_hsl_to_rgb_int (rgb, rgb + 1, rgb + 2);
|
||||
|
||||
gimp_rgb_set_uchar (&color,
|
||||
(guchar) rgb[0], (guchar) rgb[1], (guchar) rgb[2]);
|
||||
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (hs_tool->hue_partition_da[i]),
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (hs_tool->hue_range_color_area[i]),
|
||||
&color);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
hue_saturation_partition_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
hue_saturation_range_callback (GtkWidget *widget,
|
||||
GimpHueSaturationTool *hs_tool)
|
||||
{
|
||||
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (data);
|
||||
GimpHueRange partition;
|
||||
|
||||
partition = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
||||
"hue_partition"));
|
||||
|
||||
if (hs_tool->hue_partition != partition)
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
||||
{
|
||||
hs_tool->hue_partition = partition;
|
||||
GimpHueRange range;
|
||||
|
||||
gimp_radio_button_update (widget, &range);
|
||||
g_object_set (hs_tool->config,
|
||||
"range", range,
|
||||
NULL);
|
||||
|
||||
hue_saturation_update_sliders (hs_tool);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
hue_saturation_partition_reset_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
hue_saturation_range_reset_callback (GtkWidget *widget,
|
||||
GimpHueSaturationTool *hs_tool)
|
||||
{
|
||||
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (data);
|
||||
|
||||
hue_saturation_partition_reset (hs_tool->hue_saturation,
|
||||
hs_tool->hue_partition);
|
||||
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
|
||||
gimp_hue_saturation_config_reset_range (hs_tool->config,
|
||||
hs_tool->config->range);
|
||||
|
||||
hue_saturation_update_sliders (hs_tool);
|
||||
hue_saturation_update_color_areas (hs_tool);
|
||||
|
@ -536,16 +530,17 @@ hue_saturation_partition_reset_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
hue_saturation_hue_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
hue_saturation_hue_changed (GtkAdjustment *adjustment,
|
||||
GimpHueSaturationTool *hs_tool)
|
||||
{
|
||||
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (data);
|
||||
GimpHueRange part = hs_tool->hue_partition;
|
||||
GimpHueSaturationConfig *config = hs_tool->config;
|
||||
gdouble value = adjustment->value / 180.0;
|
||||
|
||||
if (hs_tool->hue_saturation->hue[part] != adjustment->value)
|
||||
if (config->hue[config->range] != value)
|
||||
{
|
||||
hs_tool->hue_saturation->hue[part] = adjustment->value;
|
||||
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
|
||||
g_object_set (config,
|
||||
"hue", value,
|
||||
NULL);
|
||||
|
||||
hue_saturation_update_color_areas (hs_tool);
|
||||
|
||||
|
@ -554,16 +549,17 @@ hue_saturation_hue_changed (GtkAdjustment *adjustment,
|
|||
}
|
||||
|
||||
static void
|
||||
hue_saturation_lightness_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
hue_saturation_lightness_changed (GtkAdjustment *adjustment,
|
||||
GimpHueSaturationTool *hs_tool)
|
||||
{
|
||||
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (data);
|
||||
GimpHueRange part = hs_tool->hue_partition;
|
||||
GimpHueSaturationConfig *config = hs_tool->config;
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
|
||||
if (hs_tool->hue_saturation->lightness[part] != adjustment->value)
|
||||
if (config->lightness[config->range] != value)
|
||||
{
|
||||
hs_tool->hue_saturation->lightness[part] = adjustment->value;
|
||||
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
|
||||
g_object_set (config,
|
||||
"lightness", value,
|
||||
NULL);
|
||||
|
||||
hue_saturation_update_color_areas (hs_tool);
|
||||
|
||||
|
@ -572,16 +568,17 @@ hue_saturation_lightness_changed (GtkAdjustment *adjustment,
|
|||
}
|
||||
|
||||
static void
|
||||
hue_saturation_saturation_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
hue_saturation_saturation_changed (GtkAdjustment *adjustment,
|
||||
GimpHueSaturationTool *hs_tool)
|
||||
{
|
||||
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (data);
|
||||
GimpHueRange part = hs_tool->hue_partition;
|
||||
GimpHueSaturationConfig *config = hs_tool->config;
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
|
||||
if (hs_tool->hue_saturation->saturation[part] != adjustment->value)
|
||||
if (config->saturation[config->range] != value)
|
||||
{
|
||||
hs_tool->hue_saturation->saturation[part] = adjustment->value;
|
||||
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
|
||||
g_object_set (config,
|
||||
"saturation", value,
|
||||
NULL);
|
||||
|
||||
hue_saturation_update_color_areas (hs_tool);
|
||||
|
||||
|
@ -590,15 +587,17 @@ hue_saturation_saturation_changed (GtkAdjustment *adjustment,
|
|||
}
|
||||
|
||||
static void
|
||||
hue_saturation_overlap_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
hue_saturation_overlap_changed (GtkAdjustment *adjustment,
|
||||
GimpHueSaturationTool *hs_tool)
|
||||
{
|
||||
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (data);
|
||||
GimpHueSaturationConfig *config = hs_tool->config;
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
|
||||
if (hs_tool->hue_saturation->overlap != adjustment->value)
|
||||
if (config->overlap != value)
|
||||
{
|
||||
hs_tool->hue_saturation->overlap = adjustment->value;
|
||||
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
|
||||
g_object_set (config,
|
||||
"overlap", value,
|
||||
NULL);
|
||||
|
||||
hue_saturation_update_color_areas (hs_tool);
|
||||
|
||||
|
|
|
@ -36,17 +36,18 @@ typedef struct _GimpHueSaturationToolClass GimpHueSaturationToolClass;
|
|||
|
||||
struct _GimpHueSaturationTool
|
||||
{
|
||||
GimpImageMapTool parent_instance;
|
||||
GimpImageMapTool parent_instance;
|
||||
|
||||
HueSaturation *hue_saturation;
|
||||
GimpHueSaturationConfig *config;
|
||||
HueSaturation *hue_saturation;
|
||||
|
||||
/* dialog */
|
||||
GimpHueRange hue_partition;
|
||||
GtkWidget *hue_partition_da[6];
|
||||
GtkAdjustment *overlap_data;
|
||||
GtkAdjustment *hue_data;
|
||||
GtkAdjustment *lightness_data;
|
||||
GtkAdjustment *saturation_data;
|
||||
GtkWidget *range_radio;
|
||||
GtkWidget *hue_range_color_area[6];
|
||||
GtkAdjustment *overlap_data;
|
||||
GtkAdjustment *hue_data;
|
||||
GtkAdjustment *lightness_data;
|
||||
GtkAdjustment *saturation_data;
|
||||
};
|
||||
|
||||
struct _GimpHueSaturationToolClass
|
||||
|
|
|
@ -30,17 +30,12 @@
|
|||
|
||||
#include "tools-types.h"
|
||||
|
||||
/* temp */
|
||||
#include "config/gimpcoreconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-pick-color.h"
|
||||
#include "core/gimpimagemap.h"
|
||||
#include "core/gimppickable.h"
|
||||
#include "core/gimpprogress.h"
|
||||
#include "core/gimpprojection.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
|
@ -491,8 +486,8 @@ gimp_image_map_tool_reset (GimpImageMapTool *tool)
|
|||
static void
|
||||
gimp_image_map_tool_create_map (GimpImageMapTool *tool)
|
||||
{
|
||||
GimpCoreConfig *config = GIMP_TOOL (tool)->tool_info->gimp->config;
|
||||
gboolean use_gegl;
|
||||
Gimp *gimp = GIMP_TOOL (tool)->tool_info->gimp;
|
||||
gboolean use_gegl;
|
||||
|
||||
if (tool->image_map)
|
||||
{
|
||||
|
@ -502,7 +497,7 @@ gimp_image_map_tool_create_map (GimpImageMapTool *tool)
|
|||
|
||||
g_assert (tool->operation || tool->apply_func);
|
||||
|
||||
use_gegl = (config->use_gegl || ! tool->apply_func);
|
||||
use_gegl = gimp_use_gegl (gimp) || ! tool->apply_func;
|
||||
|
||||
tool->image_map = gimp_image_map_new (tool->drawable,
|
||||
GIMP_TOOL (tool)->tool_info->blurb,
|
||||
|
|
|
@ -19,12 +19,6 @@
|
|||
#ifndef __GIMP_IMAGE_MAP_TOOL_H__
|
||||
#define __GIMP_IMAGE_MAP_TOOL_H__
|
||||
|
||||
#ifndef __GEGL_H__
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: dont include gegl.h here
|
||||
#endif
|
||||
#include <gegl.h>
|
||||
#endif /* __GEGL_H__ */
|
||||
|
||||
#include "gimpcolortool.h"
|
||||
|
||||
|
|
|
@ -18,17 +18,10 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "tools-types.h"
|
||||
|
@ -38,11 +31,11 @@
|
|||
#include "base/levels.h"
|
||||
|
||||
#include "gegl/gimplevelsconfig.h"
|
||||
#include "gegl/gimpoperationlevels.h"
|
||||
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpdrawable-histogram.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimagemap.h"
|
||||
|
||||
#include "widgets/gimpcolorbar.h"
|
||||
#include "widgets/gimphandlebar.h"
|
||||
|
@ -53,7 +46,6 @@
|
|||
|
||||
#include "gimphistogramoptions.h"
|
||||
#include "gimplevelstool.h"
|
||||
#include "gimptoolcontrol.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
@ -64,8 +56,8 @@
|
|||
#define PICK_ALL_CHANNELS (1 << 8)
|
||||
|
||||
#define HISTOGRAM_WIDTH 256
|
||||
#define GRADIENT_HEIGHT 12
|
||||
#define CONTROL_HEIGHT 10
|
||||
#define GRADIENT_HEIGHT 12
|
||||
#define CONTROL_HEIGHT 10
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
@ -180,13 +172,9 @@ gimp_levels_tool_init (GimpLevelsTool *tool)
|
|||
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
|
||||
|
||||
tool->lut = gimp_lut_new ();
|
||||
tool->levels = g_slice_new0 (Levels);
|
||||
tool->hist = NULL;
|
||||
tool->channel = GIMP_HISTOGRAM_VALUE;
|
||||
tool->active_picker = NULL;
|
||||
|
||||
levels_init (tool->levels);
|
||||
|
||||
im_tool->apply_func = (GimpImageMapApplyFunc) gimp_lut_process;
|
||||
im_tool->apply_data = tool->lut;
|
||||
}
|
||||
|
@ -196,15 +184,14 @@ gimp_levels_tool_finalize (GObject *object)
|
|||
{
|
||||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (object);
|
||||
|
||||
gimp_lut_free (tool->lut);
|
||||
g_slice_free (Levels, tool->levels);
|
||||
|
||||
if (tool->config)
|
||||
{
|
||||
g_object_unref (tool->config);
|
||||
tool->config = NULL;
|
||||
}
|
||||
|
||||
gimp_lut_free (tool->lut);
|
||||
|
||||
if (tool->hist)
|
||||
{
|
||||
gimp_histogram_free (tool->hist);
|
||||
|
@ -237,9 +224,8 @@ gimp_levels_tool_initialize (GimpTool *tool,
|
|||
|
||||
gimp_levels_config_reset (l_tool->config);
|
||||
|
||||
l_tool->channel = l_tool->config->channel;
|
||||
l_tool->color = gimp_drawable_is_rgb (drawable);
|
||||
l_tool->alpha = gimp_drawable_has_alpha (drawable);
|
||||
l_tool->color = gimp_drawable_is_rgb (drawable);
|
||||
l_tool->alpha = gimp_drawable_has_alpha (drawable);
|
||||
|
||||
if (l_tool->active_picker)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (l_tool->active_picker),
|
||||
|
@ -251,7 +237,7 @@ gimp_levels_tool_initialize (GimpTool *tool,
|
|||
levels_menu_sensitivity, l_tool, NULL);
|
||||
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (l_tool->channel_menu),
|
||||
l_tool->channel);
|
||||
l_tool->config->channel);
|
||||
|
||||
levels_update_adjustments (l_tool);
|
||||
|
||||
|
@ -285,12 +271,13 @@ static void
|
|||
gimp_levels_tool_map (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
|
||||
Levels levels;
|
||||
|
||||
gimp_levels_config_to_levels_cruft (tool->config, tool->levels, tool->color);
|
||||
gimp_levels_config_to_cruft (tool->config, &levels, tool->color);
|
||||
|
||||
gimp_lut_setup (tool->lut,
|
||||
(GimpLutFunc) levels_lut_func,
|
||||
tool->levels,
|
||||
&levels,
|
||||
gimp_drawable_bytes (image_map_tool->drawable));
|
||||
}
|
||||
|
||||
|
@ -691,9 +678,14 @@ gimp_levels_tool_dialog_unmap (GtkWidget *dialog,
|
|||
static void
|
||||
gimp_levels_tool_reset (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
|
||||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
|
||||
GimpHistogramChannel channel = tool->config->channel;
|
||||
|
||||
gimp_levels_config_reset (tool->config);
|
||||
g_object_set (tool->config,
|
||||
"channel", channel,
|
||||
NULL);
|
||||
|
||||
levels_update_adjustments (tool);
|
||||
}
|
||||
|
||||
|
@ -703,70 +695,14 @@ gimp_levels_tool_settings_load (GimpImageMapTool *image_map_tool,
|
|||
GError **error)
|
||||
{
|
||||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
|
||||
FILE *file = fp;
|
||||
gint low_input[5];
|
||||
gint high_input[5];
|
||||
gint low_output[5];
|
||||
gint high_output[5];
|
||||
gdouble gamma[5];
|
||||
gint i, fields;
|
||||
gchar buf[50];
|
||||
gchar *nptr;
|
||||
|
||||
if (! fgets (buf, sizeof (buf), file) ||
|
||||
strcmp (buf, "# GIMP Levels File\n") != 0)
|
||||
if (gimp_levels_config_load_cruft (tool->config, fp, error))
|
||||
{
|
||||
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_PARSE,
|
||||
_("not a GIMP Levels file"));
|
||||
return FALSE;
|
||||
levels_update_adjustments (tool);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
fields = fscanf (file, "%d %d %d %d ",
|
||||
&low_input[i],
|
||||
&high_input[i],
|
||||
&low_output[i],
|
||||
&high_output[i]);
|
||||
|
||||
if (fields != 4)
|
||||
goto error;
|
||||
|
||||
if (! fgets (buf, 50, file))
|
||||
goto error;
|
||||
|
||||
gamma[i] = g_ascii_strtod (buf, &nptr);
|
||||
|
||||
if (buf == nptr || errno == ERANGE)
|
||||
goto error;
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
g_object_set (tool->config,
|
||||
"channel", i,
|
||||
NULL);
|
||||
|
||||
g_object_set (tool->config,
|
||||
"low-input", low_input[i] / 255.0,
|
||||
"high-input", high_input[i] / 255.0,
|
||||
"low-output", low_output[i] / 255.0,
|
||||
"high-output", high_output[i] / 255.0,
|
||||
"gamma", gamma[i],
|
||||
NULL);
|
||||
}
|
||||
|
||||
g_object_set (tool->config,
|
||||
"channel", tool->channel,
|
||||
NULL);
|
||||
|
||||
levels_update_adjustments (tool);
|
||||
|
||||
return TRUE;
|
||||
|
||||
error:
|
||||
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_PARSE,
|
||||
_("parse error"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -775,41 +711,26 @@ gimp_levels_tool_settings_save (GimpImageMapTool *image_map_tool,
|
|||
gpointer fp)
|
||||
{
|
||||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
|
||||
FILE *file = fp;
|
||||
gint i;
|
||||
|
||||
fprintf (file, "# GIMP Levels File\n");
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
|
||||
fprintf (file, "%d %d %d %d %s\n",
|
||||
(gint) (tool->config->low_input[i] * 255.999),
|
||||
(gint) (tool->config->high_input[i] * 255.999),
|
||||
(gint) (tool->config->low_output[i] * 255.999),
|
||||
(gint) (tool->config->high_output[i] * 255.999),
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
tool->config->gamma[i]));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return gimp_levels_config_save_cruft (tool->config, fp);
|
||||
}
|
||||
|
||||
static void
|
||||
levels_update_adjustments (GimpLevelsTool *tool)
|
||||
{
|
||||
GimpLevelsConfig *config = tool->config;
|
||||
|
||||
tool->low_input->upper = 255;
|
||||
tool->high_input->lower = 0;
|
||||
tool->gamma_linear->lower = 0;
|
||||
tool->gamma_linear->upper = 255;
|
||||
|
||||
gtk_adjustment_set_value (tool->low_input,
|
||||
tool->config->low_input[tool->channel] * 255.0);
|
||||
config->low_input[config->channel] * 255.0);
|
||||
gtk_adjustment_set_value (tool->gamma,
|
||||
tool->config->gamma[tool->channel]);
|
||||
config->gamma[config->channel]);
|
||||
gtk_adjustment_set_value (tool->high_input,
|
||||
tool->config->high_input[tool->channel] * 255.0);
|
||||
config->high_input[config->channel] * 255.0);
|
||||
|
||||
tool->low_input->upper = tool->high_input->value;
|
||||
tool->high_input->lower = tool->low_input->value;
|
||||
|
@ -820,9 +741,9 @@ levels_update_adjustments (GimpLevelsTool *tool)
|
|||
gtk_adjustment_changed (tool->gamma_linear);
|
||||
|
||||
gtk_adjustment_set_value (tool->low_output,
|
||||
tool->config->low_output[tool->channel] * 255.0);
|
||||
config->low_output[config->channel] * 255.0);
|
||||
gtk_adjustment_set_value (tool->high_output,
|
||||
tool->config->high_output[tool->channel] * 255.0);
|
||||
config->high_output[config->channel] * 255.0);
|
||||
|
||||
levels_update_input_bar (tool);
|
||||
}
|
||||
|
@ -830,28 +751,54 @@ levels_update_adjustments (GimpLevelsTool *tool)
|
|||
static void
|
||||
levels_update_input_bar (GimpLevelsTool *tool)
|
||||
{
|
||||
/* Recalculate the transfer arrays */
|
||||
gimp_levels_config_to_levels_cruft (tool->config, tool->levels, tool->color);
|
||||
levels_calculate_transfers (tool->levels);
|
||||
GimpLevelsConfig *config = tool->config;
|
||||
|
||||
switch (tool->channel)
|
||||
switch (config->channel)
|
||||
{
|
||||
case GIMP_HISTOGRAM_VALUE:
|
||||
case GIMP_HISTOGRAM_ALPHA:
|
||||
case GIMP_HISTOGRAM_RGB:
|
||||
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->input_bar),
|
||||
tool->levels->input[tool->channel],
|
||||
tool->levels->input[tool->channel],
|
||||
tool->levels->input[tool->channel]);
|
||||
{
|
||||
guchar v[256];
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
v[i] = gimp_operation_levels_map_input (config,
|
||||
config->channel,
|
||||
i / 255.0) * 255.999;
|
||||
}
|
||||
|
||||
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->input_bar),
|
||||
v, v, v);
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_HISTOGRAM_RED:
|
||||
case GIMP_HISTOGRAM_GREEN:
|
||||
case GIMP_HISTOGRAM_BLUE:
|
||||
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->input_bar),
|
||||
tool->levels->input[GIMP_HISTOGRAM_RED],
|
||||
tool->levels->input[GIMP_HISTOGRAM_GREEN],
|
||||
tool->levels->input[GIMP_HISTOGRAM_BLUE]);
|
||||
{
|
||||
guchar r[256];
|
||||
guchar g[256];
|
||||
guchar b[256];
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
r[i] = gimp_operation_levels_map_input (config,
|
||||
GIMP_HISTOGRAM_RED,
|
||||
i / 255.0) * 255.999;
|
||||
g[i] = gimp_operation_levels_map_input (config,
|
||||
GIMP_HISTOGRAM_GREEN,
|
||||
i / 255.0) * 255.999;
|
||||
b[i] = gimp_operation_levels_map_input (config,
|
||||
GIMP_HISTOGRAM_BLUE,
|
||||
i / 255.0) * 255.999;
|
||||
}
|
||||
|
||||
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->input_bar),
|
||||
r, g, b);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -864,16 +811,14 @@ levels_channel_callback (GtkWidget *widget,
|
|||
|
||||
if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value))
|
||||
{
|
||||
tool->channel = value;
|
||||
|
||||
g_object_set (tool->config,
|
||||
"channel", tool->channel,
|
||||
"channel", value,
|
||||
NULL);
|
||||
|
||||
gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->hist_view),
|
||||
tool->channel);
|
||||
tool->config->channel);
|
||||
gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->output_bar),
|
||||
tool->channel);
|
||||
tool->config->channel);
|
||||
|
||||
levels_update_adjustments (tool);
|
||||
}
|
||||
|
@ -883,7 +828,7 @@ static void
|
|||
levels_channel_reset_callback (GtkWidget *widget,
|
||||
GimpLevelsTool *tool)
|
||||
{
|
||||
gimp_levels_config_reset_channel (tool->config, tool->channel);
|
||||
gimp_levels_config_reset_channel (tool->config, tool->config->channel);
|
||||
levels_update_adjustments (tool);
|
||||
|
||||
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool));
|
||||
|
@ -933,7 +878,7 @@ levels_linear_gamma_update (GimpLevelsTool *tool)
|
|||
|
||||
delta = (tool->high_input->value - tool->low_input->value) / 2.0;
|
||||
mid = tool->low_input->value + delta;
|
||||
tmp = log10 (1.0 / tool->config->gamma[tool->channel]);
|
||||
tmp = log10 (1.0 / tool->config->gamma[tool->config->channel]);
|
||||
value = mid + delta * tmp;
|
||||
|
||||
gtk_adjustment_set_value (tool->gamma_linear, value);
|
||||
|
@ -964,16 +909,17 @@ static void
|
|||
levels_low_input_changed (GtkAdjustment *adjustment,
|
||||
GimpLevelsTool *tool)
|
||||
{
|
||||
gint value = ROUND (adjustment->value);
|
||||
GimpLevelsConfig *config = tool->config;
|
||||
gint value = ROUND (adjustment->value);
|
||||
|
||||
tool->high_input->lower = value;
|
||||
tool->gamma_linear->lower = value;
|
||||
gtk_adjustment_changed (tool->high_input);
|
||||
gtk_adjustment_changed (tool->gamma_linear);
|
||||
|
||||
if (tool->config->low_input[tool->channel] != value / 255.0)
|
||||
if (config->low_input[config->channel] != value / 255.0)
|
||||
{
|
||||
g_object_set (tool->config,
|
||||
g_object_set (config,
|
||||
"low-input", value / 255.0,
|
||||
NULL);
|
||||
levels_update_input_bar (tool);
|
||||
|
@ -988,9 +934,11 @@ static void
|
|||
levels_gamma_changed (GtkAdjustment *adjustment,
|
||||
GimpLevelsTool *tool)
|
||||
{
|
||||
if (tool->config->gamma[tool->channel] != adjustment->value)
|
||||
GimpLevelsConfig *config = tool->config;
|
||||
|
||||
if (config->gamma[config->channel] != adjustment->value)
|
||||
{
|
||||
g_object_set (tool->config,
|
||||
g_object_set (config,
|
||||
"gamma", adjustment->value,
|
||||
NULL);
|
||||
levels_update_input_bar (tool);
|
||||
|
@ -1005,16 +953,17 @@ static void
|
|||
levels_high_input_changed (GtkAdjustment *adjustment,
|
||||
GimpLevelsTool *tool)
|
||||
{
|
||||
gint value = ROUND (adjustment->value);
|
||||
GimpLevelsConfig *config = tool->config;
|
||||
gint value = ROUND (adjustment->value);
|
||||
|
||||
tool->low_input->upper = value;
|
||||
tool->gamma_linear->upper = value;
|
||||
gtk_adjustment_changed (tool->low_input);
|
||||
gtk_adjustment_changed (tool->gamma_linear);
|
||||
|
||||
if (tool->config->high_input[tool->channel] != value / 255.0)
|
||||
if (config->high_input[config->channel] != value / 255.0)
|
||||
{
|
||||
g_object_set (tool->config,
|
||||
g_object_set (config,
|
||||
"high-input", value / 255.0,
|
||||
NULL);
|
||||
levels_update_input_bar (tool);
|
||||
|
@ -1029,11 +978,12 @@ static void
|
|||
levels_low_output_changed (GtkAdjustment *adjustment,
|
||||
GimpLevelsTool *tool)
|
||||
{
|
||||
gint value = ROUND (adjustment->value);
|
||||
GimpLevelsConfig *config = tool->config;
|
||||
gint value = ROUND (adjustment->value);
|
||||
|
||||
if (tool->config->low_output[tool->channel] != value / 255.0)
|
||||
if (config->low_output[config->channel] != value / 255.0)
|
||||
{
|
||||
g_object_set (tool->config,
|
||||
g_object_set (config,
|
||||
"low-output", value / 255.0,
|
||||
NULL);
|
||||
|
||||
|
@ -1045,11 +995,12 @@ static void
|
|||
levels_high_output_changed (GtkAdjustment *adjustment,
|
||||
GimpLevelsTool *tool)
|
||||
{
|
||||
gint value = ROUND (adjustment->value);
|
||||
GimpLevelsConfig *config = tool->config;
|
||||
gint value = ROUND (adjustment->value);
|
||||
|
||||
if (tool->config->high_output[tool->channel] != value / 255.0)
|
||||
if (config->high_output[config->channel] != value / 255.0)
|
||||
{
|
||||
g_object_set (tool->config,
|
||||
g_object_set (config,
|
||||
"high-output", value / 255.0,
|
||||
NULL);
|
||||
|
||||
|
@ -1149,7 +1100,7 @@ gimp_levels_tool_color_picked (GimpColorTool *color_tool,
|
|||
else
|
||||
{
|
||||
levels_input_adjust_by_color (tool->config,
|
||||
value, tool->channel, color);
|
||||
value, tool->config->channel, color);
|
||||
}
|
||||
|
||||
levels_update_adjustments (tool);
|
||||
|
|
|
@ -40,12 +40,10 @@ struct _GimpLevelsTool
|
|||
|
||||
GimpLevelsConfig *config;
|
||||
GimpLut *lut;
|
||||
Levels *levels;
|
||||
|
||||
/* dialog */
|
||||
gboolean color;
|
||||
gboolean alpha;
|
||||
GimpHistogramChannel channel;
|
||||
|
||||
GimpHistogram *hist;
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimagemap.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
|
||||
|
@ -153,7 +152,7 @@ gimp_posterize_tool_initialize (GimpTool *tool,
|
|||
|
||||
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (posterize_tool->levels_data),
|
||||
gtk_adjustment_set_value (posterize_tool->levels_data,
|
||||
posterize_tool->levels);
|
||||
|
||||
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (posterize_tool));
|
||||
|
@ -225,7 +224,7 @@ gimp_posterize_tool_reset (GimpImageMapTool *image_map_tool)
|
|||
|
||||
posterize_tool->levels = POSTERIZE_DEFAULT_LEVELS;
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (posterize_tool->levels_data),
|
||||
gtk_adjustment_set_value (posterize_tool->levels_data,
|
||||
posterize_tool->levels);
|
||||
}
|
||||
|
||||
|
|
|
@ -779,6 +779,10 @@ gimp_rect_select_tool_execute (GimpRectangleTool *rectangle,
|
|||
gimp_rect_select_tool_update_option_defaults (rect_sel_tool,
|
||||
FALSE);
|
||||
|
||||
/* Reset the automatic undo/redo mechanism */
|
||||
priv->undo = NULL;
|
||||
priv->redo = NULL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -2881,6 +2881,8 @@ gimp_rectangle_tool_set_other_side_coord (GimpRectangleTool *rect_tool,
|
|||
*other_y = other_side_y;
|
||||
|
||||
gimp_rectangle_tool_check_function (rect_tool);
|
||||
|
||||
gimp_rectangle_tool_update_int_rect (rect_tool);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,10 +28,11 @@
|
|||
#include "base/gimphistogram.h"
|
||||
#include "base/threshold.h"
|
||||
|
||||
#include "gegl/gimpthresholdconfig.h"
|
||||
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpdrawable-histogram.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimagemap.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimphistogrambox.h"
|
||||
|
@ -116,9 +117,6 @@ gimp_threshold_tool_init (GimpThresholdTool *t_tool)
|
|||
t_tool->threshold = g_slice_new0 (Threshold);
|
||||
t_tool->hist = NULL;
|
||||
|
||||
t_tool->threshold->low_threshold = 127;
|
||||
t_tool->threshold->high_threshold = 255;
|
||||
|
||||
im_tool->apply_func = (GimpImageMapApplyFunc) threshold;
|
||||
im_tool->apply_data = t_tool->threshold;
|
||||
}
|
||||
|
@ -128,6 +126,12 @@ gimp_threshold_tool_finalize (GObject *object)
|
|||
{
|
||||
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (object);
|
||||
|
||||
if (t_tool->config)
|
||||
{
|
||||
g_object_unref (t_tool->config);
|
||||
t_tool->config = NULL;
|
||||
}
|
||||
|
||||
g_slice_free (Threshold, t_tool->threshold);
|
||||
|
||||
if (t_tool->hist)
|
||||
|
@ -160,9 +164,9 @@ gimp_threshold_tool_initialize (GimpTool *tool,
|
|||
if (! t_tool->hist)
|
||||
t_tool->hist = gimp_histogram_new ();
|
||||
|
||||
t_tool->threshold->color = gimp_drawable_is_rgb (drawable);
|
||||
t_tool->threshold->low_threshold = 127;
|
||||
t_tool->threshold->high_threshold = 255;
|
||||
gimp_threshold_config_reset (t_tool->config);
|
||||
|
||||
t_tool->threshold->color = gimp_drawable_is_rgb (drawable);
|
||||
|
||||
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
|
||||
|
||||
|
@ -174,8 +178,8 @@ gimp_threshold_tool_initialize (GimpTool *tool,
|
|||
gimp_histogram_view_set_histogram (t_tool->histogram_box->view,
|
||||
t_tool->hist);
|
||||
gimp_histogram_view_set_range (t_tool->histogram_box->view,
|
||||
t_tool->threshold->low_threshold,
|
||||
t_tool->threshold->high_threshold);
|
||||
t_tool->config->low * 255.999,
|
||||
t_tool->config->high * 255.999);
|
||||
g_signal_handlers_unblock_by_func (t_tool->histogram_box->view,
|
||||
gimp_threshold_tool_histogram_range,
|
||||
t_tool);
|
||||
|
@ -186,11 +190,22 @@ gimp_threshold_tool_initialize (GimpTool *tool,
|
|||
}
|
||||
|
||||
static GeglNode *
|
||||
gimp_threshold_tool_get_operation (GimpImageMapTool *im_tool)
|
||||
gimp_threshold_tool_get_operation (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
return g_object_new (GEGL_TYPE_NODE,
|
||||
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (image_map_tool);
|
||||
GeglNode *node;
|
||||
|
||||
node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "gimp-threshold",
|
||||
NULL);
|
||||
|
||||
t_tool->config = g_object_new (GIMP_TYPE_THRESHOLD_CONFIG, NULL);
|
||||
|
||||
gegl_node_set (node,
|
||||
"config", t_tool->config,
|
||||
NULL);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -198,10 +213,7 @@ gimp_threshold_tool_map (GimpImageMapTool *image_map_tool)
|
|||
{
|
||||
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (image_map_tool);
|
||||
|
||||
gegl_node_set (image_map_tool->operation,
|
||||
"low", t_tool->threshold->low_threshold / 255.0,
|
||||
"high", t_tool->threshold->high_threshold / 255.0,
|
||||
NULL);
|
||||
gimp_threshold_config_to_cruft (t_tool->config, t_tool->threshold);
|
||||
}
|
||||
|
||||
|
||||
|
@ -265,7 +277,11 @@ gimp_threshold_tool_reset (GimpImageMapTool *image_map_tool)
|
|||
{
|
||||
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (image_map_tool);
|
||||
|
||||
gimp_histogram_view_set_range (t_tool->histogram_box->view, 127.0, 255.0);
|
||||
gimp_threshold_config_reset (t_tool->config);
|
||||
|
||||
gimp_histogram_view_set_range (t_tool->histogram_box->view,
|
||||
t_tool->config->low * 255.999,
|
||||
t_tool->config->high * 255.999);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -274,11 +290,16 @@ gimp_threshold_tool_histogram_range (GimpHistogramView *widget,
|
|||
gint end,
|
||||
GimpThresholdTool *t_tool)
|
||||
{
|
||||
if (start != t_tool->threshold->low_threshold ||
|
||||
end != t_tool->threshold->high_threshold)
|
||||
gdouble low = start / 255.0;
|
||||
gdouble high = end / 255.0;
|
||||
|
||||
if (low != t_tool->config->low ||
|
||||
high != t_tool->config->high)
|
||||
{
|
||||
t_tool->threshold->low_threshold = start;
|
||||
t_tool->threshold->high_threshold = end;
|
||||
g_object_set (t_tool->config,
|
||||
"low", low,
|
||||
"high", high,
|
||||
NULL);
|
||||
|
||||
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (t_tool));
|
||||
}
|
||||
|
@ -288,14 +309,12 @@ static void
|
|||
gimp_threshold_tool_auto_clicked (GtkWidget *button,
|
||||
GimpThresholdTool *t_tool)
|
||||
{
|
||||
gdouble low_threshold;
|
||||
|
||||
low_threshold =
|
||||
gimp_histogram_get_threshold (t_tool->hist,
|
||||
(t_tool->threshold->color ?
|
||||
GIMP_HISTOGRAM_RGB : GIMP_HISTOGRAM_VALUE),
|
||||
0, 255);
|
||||
gdouble low = gimp_histogram_get_threshold (t_tool->hist,
|
||||
t_tool->threshold->color ?
|
||||
GIMP_HISTOGRAM_RGB :
|
||||
GIMP_HISTOGRAM_VALUE,
|
||||
0, 255);
|
||||
|
||||
gimp_histogram_view_set_range (t_tool->histogram_box->view,
|
||||
low_threshold, 255.0);
|
||||
low, 255.0);
|
||||
}
|
||||
|
|
|
@ -36,13 +36,14 @@ typedef struct _GimpThresholdToolClass GimpThresholdToolClass;
|
|||
|
||||
struct _GimpThresholdTool
|
||||
{
|
||||
GimpImageMapTool parent_instance;
|
||||
GimpImageMapTool parent_instance;
|
||||
|
||||
Threshold *threshold;
|
||||
GimpThresholdConfig *config;
|
||||
Threshold *threshold;
|
||||
|
||||
/* dialog */
|
||||
GimpHistogram *hist;
|
||||
GimpHistogramBox *histogram_box;
|
||||
GimpHistogram *hist;
|
||||
GimpHistogramBox *histogram_box;
|
||||
};
|
||||
|
||||
struct _GimpThresholdToolClass
|
||||
|
|
|
@ -504,7 +504,8 @@ gimp_colormap_editor_draw (GimpColormapEditor *editor)
|
|||
row[(j * cellsize + k) * 3 + b] = image->colormap[col * 3 + b];
|
||||
}
|
||||
|
||||
memset (row + j * cellsize * 3, 255, 3 * (width - j * cellsize));
|
||||
if (j * cellsize > width)
|
||||
memset (row + j * cellsize * 3, 255, 3 * (width - j * cellsize));
|
||||
|
||||
for (k = 0; k < cellsize; k++)
|
||||
{
|
||||
|
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
@ -477,6 +477,7 @@ gimp_stock_button_pixbufs[] =
|
|||
{ GIMP_STOCK_WARNING, stock_warning_24 },
|
||||
{ GIMP_TOILET_PAPER, stock_toilet_paper_24 },
|
||||
{ GIMP_STOCK_WEB, stock_web_24 },
|
||||
{ GIMP_STOCK_WILBER, stock_wilber_22 },
|
||||
{ GIMP_STOCK_VIDEO, stock_video_24 }
|
||||
};
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.0 KiB |
|
@ -381,7 +381,7 @@ load_image (const gchar *filename)
|
|||
g_message (_("Unsupported or invalid image height: %d"), height);
|
||||
return -1;
|
||||
}
|
||||
if (bytesperline < width)
|
||||
if (bytesperline < (width * pcx_header.bpp) / 8)
|
||||
{
|
||||
g_message (_("Invalid number of bytes per line in PCX header"));
|
||||
return -1;
|
||||
|
|
|
@ -40,7 +40,7 @@ do_about_dialog(void)
|
|||
|
||||
dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG,
|
||||
"transient-for", get_dialog(),
|
||||
"name", _("Image Map Plug-In"),
|
||||
"program-name", _("Image Map Plug-In"),
|
||||
"version", "2.3",
|
||||
"authors", authors,
|
||||
"copyright",
|
||||
|
|
|
@ -49,7 +49,7 @@ static MapInfo_t *_map_info;
|
|||
%union {
|
||||
int val;
|
||||
double value;
|
||||
char id[1024]; /* Large enough to hold all polygon points! */
|
||||
char id[4096]; /* Large enough to hold all polygon points! */
|
||||
}
|
||||
|
||||
%token<val> IMG SRC WIDTH HEIGHT BORDER USEMAP
|
||||
|
@ -136,7 +136,7 @@ description_line: DESCRIPTION STRING END_COMMENT
|
|||
{
|
||||
gchar *description;
|
||||
|
||||
description = g_strconcat(_map_info->description, $2, "\n",
|
||||
description = g_strconcat(_map_info->description, $2, "\n",
|
||||
NULL);
|
||||
g_strreplace(&_map_info->description, description);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ area : '<' AREA tag_list xhtml_close
|
|||
;
|
||||
|
||||
xhtml_close : '>'
|
||||
| '/' '>'
|
||||
| '/' '>'
|
||||
;
|
||||
|
||||
tag_list : /* Empty */
|
||||
|
@ -310,7 +310,7 @@ end_map : '<' END_MAP '>'
|
|||
|
||||
%%
|
||||
|
||||
static void
|
||||
static void
|
||||
csim_error(char* s)
|
||||
{
|
||||
extern FILE *csim_in;
|
||||
|
|
|
@ -207,7 +207,7 @@ typedef union YYSTYPE
|
|||
{
|
||||
int val;
|
||||
double value;
|
||||
char id[1024]; /* Large enough to hold all polygon points! */
|
||||
char id[4096]; /* Large enough to hold all polygon points! */
|
||||
}
|
||||
/* Line 187 of yacc.c. */
|
||||
#line 214 "y.tab.c"
|
||||
|
@ -1580,7 +1580,7 @@ yyreduce:
|
|||
{
|
||||
gchar *description;
|
||||
|
||||
description = g_strconcat(_map_info->description, (yyvsp[(2) - (3)].id), "\n",
|
||||
description = g_strconcat(_map_info->description, (yyvsp[(2) - (3)].id), "\n",
|
||||
NULL);
|
||||
g_strreplace(&_map_info->description, description);
|
||||
}
|
||||
|
@ -1955,7 +1955,7 @@ yyreturn:
|
|||
#line 311 "imap_csim.y"
|
||||
|
||||
|
||||
static void
|
||||
static void
|
||||
csim_error(char* s)
|
||||
{
|
||||
extern FILE *csim_in;
|
||||
|
|
|
@ -104,7 +104,7 @@ typedef union YYSTYPE
|
|||
{
|
||||
int val;
|
||||
double value;
|
||||
char id[1024]; /* Large enough to hold all polygon points! */
|
||||
char id[4096]; /* Large enough to hold all polygon points! */
|
||||
}
|
||||
/* Line 1489 of yacc.c. */
|
||||
#line 111 "y.tab.h"
|
||||
|
|
|
@ -42,14 +42,18 @@ void
|
|||
mru_destruct(MRU_t *mru)
|
||||
{
|
||||
g_list_foreach(mru->list, (GFunc) g_free, NULL);
|
||||
g_list_free (mru->list);
|
||||
g_free(mru);
|
||||
}
|
||||
|
||||
static void
|
||||
mru_remove_link(MRU_t *mru, GList *link)
|
||||
{
|
||||
g_free(link->data);
|
||||
mru->list = g_list_remove_link(mru->list, link);
|
||||
if (link)
|
||||
{
|
||||
g_free(link->data);
|
||||
mru->list = g_list_remove_link(mru->list, link);
|
||||
}
|
||||
}
|
||||
|
||||
static GList*
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2008-01-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* POTFILES.in: added files from the new PSD load plug-in.
|
||||
|
||||
2008-01-18 Alexandre Prokoudine <alexandre.prokoudine@gmail.com>
|
||||
|
||||
* ru.po: Updated Russian translation.
|
||||
|
|
|
@ -254,6 +254,11 @@ plug-ins/pagecurl/pagecurl.c
|
|||
plug-ins/print/print-draw-page.c
|
||||
plug-ins/print/print-page-layout.c
|
||||
plug-ins/print/print.c
|
||||
plug-ins/psd/psd-image-res-load.c
|
||||
plug-ins/psd/psd-load.c
|
||||
plug-ins/psd/psd-thumb-load.c
|
||||
plug-ins/psd/psd-util.c
|
||||
plug-ins/psd/psd.c
|
||||
plug-ins/rcm/rcm.c
|
||||
plug-ins/rcm/rcm_dialog.c
|
||||
plug-ins/rcm/rcm_stock.c
|
||||
|
|
|
@ -78,6 +78,8 @@ app/core/gimpbrushgenerated-save.c
|
|||
app/core/gimpbrushpipe-load.c
|
||||
app/core/gimpchannel-select.c
|
||||
app/core/gimpchannel.c
|
||||
app/core/gimpcurve-load.c
|
||||
app/core/gimpcurve-save.c
|
||||
app/core/gimpdata.c
|
||||
app/core/gimpdatafactory.c
|
||||
app/core/gimpdrawable-blend.c
|
||||
|
@ -202,6 +204,9 @@ app/pdb/color_cmds.c
|
|||
app/pdb/drawable_cmds.c
|
||||
app/pdb/drawable_transform_cmds.c
|
||||
app/pdb/edit_cmds.c
|
||||
app/pdb/floating_sel_cmds.c
|
||||
app/pdb/gimppdb-query.c
|
||||
app/pdb/gimppdb-utils.c
|
||||
app/pdb/gimppdb.c
|
||||
app/pdb/gimpprocedure.c
|
||||
app/pdb/image_cmds.c
|
||||
|
@ -213,6 +218,7 @@ app/pdb/transform_tools_cmds.c
|
|||
app/pdb/vectors_cmds.c
|
||||
app/plug-in/gimpenvirontable.c
|
||||
app/plug-in/gimpinterpreterdb.c
|
||||
app/plug-in/gimpplugin-message.c
|
||||
app/plug-in/gimpplugin.c
|
||||
app/plug-in/gimppluginmanager-restore.c
|
||||
app/plug-in/gimppluginmanager.c
|
||||
|
@ -439,5 +445,5 @@ plug-ins/script-fu/script-fu-interface.c
|
|||
plug-ins/script-fu/script-fu-scripts.c
|
||||
plug-ins/script-fu/script-fu-server.c
|
||||
plug-ins/script-fu/script-fu.c
|
||||
tools/gimp-remote.c
|
||||
tools/gimp-remote-x11.c
|
||||
tools/gimp-remote.c
|
||||
|
|
674
po/POTFILES.skip
674
po/POTFILES.skip
File diff suppressed because it is too large
Load Diff
|
@ -211,7 +211,8 @@ STOCK_BUTTON_IMAGES = \
|
|||
stock-video-24.png \
|
||||
stock-undo-history-24.png \
|
||||
stock-warning-24.png \
|
||||
stock-web-24.png
|
||||
stock-web-24.png \
|
||||
stock-wilber-22.png
|
||||
|
||||
STOCK_DND_IMAGES = \
|
||||
stock-channel-32.png \
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1001 B After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB |
|
@ -47,7 +47,7 @@ HELP
|
|||
|
||||
if (success)
|
||||
{
|
||||
if (gimp->config->use_gegl)
|
||||
if (gimp_use_gegl (gimp))
|
||||
{
|
||||
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "brightness-contrast",
|
||||
|
@ -245,7 +245,7 @@ HELP
|
|||
|
||||
if (success)
|
||||
{
|
||||
if (gimp->config->use_gegl)
|
||||
if (gimp_use_gegl (gimp))
|
||||
{
|
||||
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "gimp-posterize",
|
||||
|
@ -727,7 +727,7 @@ HELP
|
|||
|
||||
if (success)
|
||||
{
|
||||
if (gimp->config->use_gegl)
|
||||
if (gimp_use_gegl (gimp))
|
||||
{
|
||||
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "gimp-colorize",
|
||||
|
@ -966,7 +966,7 @@ HELP
|
|||
|
||||
if (success)
|
||||
{
|
||||
if (gimp->config->use_gegl)
|
||||
if (gimp_use_gegl (gimp))
|
||||
{
|
||||
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "gimp-threshold",
|
||||
|
@ -1021,7 +1021,6 @@ CODE
|
|||
"base/lut-funcs.h"
|
||||
"base/pixel-region.h"
|
||||
"base/pixel-processor.h"
|
||||
"config/gimpcoreconfig.h"
|
||||
"core/gimp.h"
|
||||
"core/gimpdrawable.h"
|
||||
"core/gimpdrawable-operation.h"
|
||||
|
|
Loading…
Reference in New Issue