~ubuntu-branches/ubuntu/vivid/gimp/vivid

« back to all changes in this revision

Viewing changes to app/tools/gimpbycolorselecttool.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-05-08 18:50:03 UTC
  • mto: (1.1.26) (0.5.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 71.
  • Revision ID: package-import@ubuntu.com-20120508185003-tltkvbaysf8d2426
ImportĀ upstreamĀ versionĀ 2.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *
4
4
 * gimpbycolorselecttool.c
5
5
 *
6
 
 * This program is free software; you can redistribute it and/or modify
 
6
 * This program is free software: you can redistribute it and/or modify
7
7
 * it under the terms of the GNU General Public License as published by
8
 
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * the Free Software Foundation; either version 3 of the License, or
9
9
 * (at your option) any later version.
10
10
 *
11
11
 * This program is distributed in the hope that it will be useful,
14
14
 * GNU General Public License for more details.
15
15
 *
16
16
 * You should have received a copy of the GNU General Public License
17
 
 * along with this program; if not, write to the Free Software
18
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
18
 */
20
19
 
21
20
#include "config.h"
22
21
 
23
22
#include <string.h>
24
23
 
 
24
#include <gegl.h>
25
25
#include <gtk/gtk.h>
26
26
 
27
27
#include "libgimpcolor/gimpcolor.h"
98
98
  GimpTool                *tool        = GIMP_TOOL (region_select);
99
99
  GimpSelectionOptions    *sel_options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
100
100
  GimpRegionSelectOptions *options     = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
101
 
  GimpDrawable            *drawable;
 
101
  GimpImage               *image       = gimp_display_get_image (display);
 
102
  GimpDrawable            *drawable    = gimp_image_get_active_drawable (image);
102
103
  GimpPickable            *pickable;
103
104
  GimpRGB                  color;
104
105
  gint                     x, y;
105
106
 
106
 
  drawable = gimp_image_get_active_drawable (display->image);
107
 
 
108
107
  x = region_select->x;
109
108
  y = region_select->y;
110
109
 
112
111
    {
113
112
      gint off_x, off_y;
114
113
 
115
 
      gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
 
114
      gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
116
115
 
117
116
      x -= off_x;
118
117
      y -= off_y;
121
120
    }
122
121
  else
123
122
    {
124
 
      pickable = GIMP_PICKABLE (gimp_image_get_projection (display->image));
 
123
      pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
125
124
    }
126
125
 
127
126
  gimp_pickable_flush (pickable);
128
127
 
129
128
  if (gimp_pickable_get_color_at (pickable, x, y, &color))
130
 
    return gimp_image_contiguous_region_by_color (display->image, drawable,
 
129
    return gimp_image_contiguous_region_by_color (image, drawable,
131
130
                                                  options->sample_merged,
132
131
                                                  sel_options->antialias,
133
132
                                                  options->threshold,
134
133
                                                  options->select_transparent,
135
134
                                                  options->select_criterion,
136
135
                                                  &color);
137
 
  else
138
 
    return NULL;
 
136
 
 
137
  return NULL;
139
138
}