~ubuntu-branches/ubuntu/karmic/gimp/karmic-security

« back to all changes in this revision

Viewing changes to app/core/gimpdrawable-hue-saturation.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-06 13:30:41 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20081006133041-axco233xt49jobn7
Tags: 2.6.0-1ubuntu1
* Sync on debian and new version (lp: #276839)
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch:
  - updated some strings for ubuntu
* debian/rules:
  - updated translation templates

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GIMP - The GNU Image Manipulation Program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
#include "config.h"
 
20
 
 
21
#include <gegl.h>
 
22
 
 
23
#include "core-types.h"
 
24
 
 
25
#include "base/hue-saturation.h"
 
26
 
 
27
#include "gegl/gimphuesaturationconfig.h"
 
28
 
 
29
/* temp */
 
30
#include "gimp.h"
 
31
#include "gimpimage.h"
 
32
 
 
33
#include "gimpdrawable.h"
 
34
#include "gimpdrawable-hue-saturation.h"
 
35
#include "gimpdrawable-operation.h"
 
36
#include "gimpdrawable-process.h"
 
37
 
 
38
#include "gimp-intl.h"
 
39
 
 
40
 
 
41
/*  public functions  */
 
42
 
 
43
void
 
44
gimp_drawable_hue_saturation (GimpDrawable *drawable,
 
45
                              GimpProgress *progress,
 
46
                              GimpHueRange  range,
 
47
                              gdouble       hue,
 
48
                              gdouble       saturation,
 
49
                              gdouble       lightness)
 
50
{
 
51
  GimpHueSaturationConfig *config;
 
52
 
 
53
  g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
 
54
  g_return_if_fail (! gimp_drawable_is_indexed (drawable));
 
55
  g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
 
56
 
 
57
  config = g_object_new (GIMP_TYPE_HUE_SATURATION_CONFIG,
 
58
                         "range", range,
 
59
                         NULL);
 
60
 
 
61
  g_object_set (config,
 
62
                "hue",        hue        / 100.0,
 
63
                "saturation", saturation / 100.0,
 
64
                "lightness",  lightness  / 100.0,
 
65
                NULL);
 
66
 
 
67
  if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
 
68
    {
 
69
      GeglNode *node;
 
70
 
 
71
      node = g_object_new (GEGL_TYPE_NODE,
 
72
                           "operation", "gimp-hue-saturation",
 
73
                           NULL);
 
74
      gegl_node_set (node,
 
75
                     "config", config,
 
76
                     NULL);
 
77
 
 
78
      gimp_drawable_apply_operation (drawable, progress, _("Hue-Saturation"),
 
79
                                     node, TRUE);
 
80
      g_object_unref (node);
 
81
    }
 
82
  else
 
83
    {
 
84
      HueSaturation cruft;
 
85
 
 
86
      gimp_hue_saturation_config_to_cruft (config, &cruft);
 
87
 
 
88
      gimp_drawable_process (drawable, progress, _("Hue_Saturation"),
 
89
                             (PixelProcessorFunc) hue_saturation, &cruft);
 
90
    }
 
91
 
 
92
  g_object_unref (config);
 
93
}