1
/* The GIMP -- an image manipulation program
1
/* GIMP - The GNU Image Manipulation Program
2
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
4
* This program is free software; you can redistribute it and/or modify
50
50
gdouble feather_radius_x,
51
gdouble feather_radius_y)
51
gdouble feather_radius_y,
53
54
g_return_if_fail (GIMP_IS_CHANNEL (channel));
54
55
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
56
gimp_channel_push_undo (channel, _("Rect Select"));
58
gimp_channel_push_undo (channel, Q_("command|Rectangle Select"));
58
60
/* if applicable, replace the current selection */
59
61
if (op == GIMP_CHANNEL_OP_REPLACE)
65
67
if (feather || op == GIMP_CHANNEL_OP_INTERSECT)
69
GimpItem *item = GIMP_ITEM (channel);
68
70
GimpChannel *add_on;
70
item = GIMP_ITEM (channel);
72
72
add_on = gimp_channel_new_mask (gimp_item_get_image (item),
73
73
gimp_item_width (item),
74
74
gimp_item_height (item));
99
99
gboolean antialias,
100
100
gboolean feather,
101
101
gdouble feather_radius_x,
102
gdouble feather_radius_y)
102
gdouble feather_radius_y,
104
105
g_return_if_fail (GIMP_IS_CHANNEL (channel));
105
106
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
107
gimp_channel_push_undo (channel, _("Ellipse Select"));
109
gimp_channel_push_undo (channel, Q_("command|Ellipse Select"));
109
111
/* if applicable, replace the current selection */
110
112
if (op == GIMP_CHANNEL_OP_REPLACE)
116
118
if (feather || op == GIMP_CHANNEL_OP_INTERSECT)
120
GimpItem *item = GIMP_ITEM (channel);
119
121
GimpChannel *add_on;
121
item = GIMP_ITEM (channel);
123
123
add_on = gimp_channel_new_mask (gimp_item_get_image (item),
124
124
gimp_item_width (item),
125
125
gimp_item_height (item));
145
gimp_channel_select_round_rect (GimpChannel *channel,
150
gdouble corner_radius_x,
151
gdouble corner_radius_y,
155
gdouble feather_radius_x,
156
gdouble feather_radius_y,
159
g_return_if_fail (GIMP_IS_CHANNEL (channel));
160
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
163
gimp_channel_push_undo (channel, Q_("command|Rounded Rectangle Select"));
165
/* if applicable, replace the current selection */
166
if (op == GIMP_CHANNEL_OP_REPLACE)
167
gimp_channel_clear (channel, NULL, FALSE);
169
/* if feathering for rect, make a new mask with the
170
* rectangle and feather that with the old mask
172
if (feather || op == GIMP_CHANNEL_OP_INTERSECT)
174
GimpItem *item = GIMP_ITEM (channel);
177
add_on = gimp_channel_new_mask (gimp_item_get_image (item),
178
gimp_item_width (item),
179
gimp_item_height (item));
180
gimp_channel_combine_ellipse_rect (add_on, GIMP_CHANNEL_OP_ADD,
182
corner_radius_x, corner_radius_y,
186
gimp_channel_feather (add_on,
189
FALSE /* no undo */);
191
gimp_channel_combine_mask (channel, add_on, op, 0, 0);
192
g_object_unref (add_on);
196
gimp_channel_combine_ellipse_rect (channel, op, x, y, w, h,
197
corner_radius_x, corner_radius_y,
145
202
/* select by GimpScanConvert functions */
164
222
g_return_if_fail (undo_desc != NULL);
165
223
g_return_if_fail (scan_convert != NULL);
167
gimp_channel_push_undo (channel, undo_desc);
226
gimp_channel_push_undo (channel, undo_desc);
169
228
/* if applicable, replace the current selection */
170
229
if (op == GIMP_CHANNEL_OP_REPLACE)
176
235
gimp_item_width (item),
177
236
gimp_item_height (item));
178
237
gimp_scan_convert_render (scan_convert,
179
gimp_drawable_data (GIMP_DRAWABLE (add_on)),
238
gimp_drawable_get_tiles (GIMP_DRAWABLE (add_on)),
180
239
offset_x, offset_y, antialias);
198
257
gboolean antialias,
199
258
gboolean feather,
200
259
gdouble feather_radius_x,
201
gdouble feather_radius_y)
260
gdouble feather_radius_y,
203
263
GimpScanConvert *scan_convert;
213
273
gimp_channel_select_scan_convert (channel, undo_desc, scan_convert, 0, 0,
214
274
op, antialias, feather,
215
feather_radius_x, feather_radius_y);
275
feather_radius_x, feather_radius_y,
217
278
gimp_scan_convert_free (scan_convert);
225
286
gboolean antialias,
226
287
gboolean feather,
227
288
gdouble feather_radius_x,
228
gdouble feather_radius_y)
289
gdouble feather_radius_y,
230
292
GimpScanConvert *scan_convert;
273
335
if (coords_added)
274
336
gimp_channel_select_scan_convert (channel, undo_desc, scan_convert, 0, 0,
275
337
op, antialias, feather,
276
feather_radius_x, feather_radius_y);
338
feather_radius_x, feather_radius_y,
278
341
gimp_scan_convert_free (scan_convert);
351
414
if (gimp_drawable_has_alpha (drawable))
355
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);
357
416
add_on = gimp_channel_new_from_alpha (gimp_item_get_image (item),
358
drawable, NULL, &color);
417
drawable, NULL, NULL);
390
449
GimpChannel *add_on;
392
450
const gchar *desc;
393
451
gchar *undo_desc;
395
453
g_return_if_fail (GIMP_IS_CHANNEL (channel));
396
454
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
398
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);
400
456
item = GIMP_ITEM (channel);
402
458
add_on = gimp_channel_new_from_component (gimp_item_get_image (item),
403
component, NULL, &color);
459
component, NULL, NULL);
406
462
gimp_channel_feather (add_on,
425
gimp_channel_select_fuzzy (GimpChannel *channel,
426
GimpDrawable *drawable,
427
gboolean sample_merged,
431
gboolean select_transparent,
435
gdouble feather_radius_x,
436
gdouble feather_radius_y)
481
gimp_channel_select_fuzzy (GimpChannel *channel,
482
GimpDrawable *drawable,
483
gboolean sample_merged,
487
gboolean select_transparent,
488
GimpSelectCriterion select_criterion,
492
gdouble feather_radius_x,
493
gdouble feather_radius_y)
439
496
GimpChannel *add_on;
454
511
select_transparent,
457
515
if (! sample_merged)
458
516
gimp_item_offsets (GIMP_ITEM (drawable), &add_on_x, &add_on_y);
460
gimp_channel_select_channel (channel, _("Fuzzy Select"),
518
gimp_channel_select_channel (channel, Q_("command|Fuzzy Select"),
461
519
add_on, add_on_x, add_on_y,
470
gimp_channel_select_by_color (GimpChannel *channel,
471
GimpDrawable *drawable,
472
gboolean sample_merged,
473
const GimpRGB *color,
475
gboolean select_transparent,
479
gdouble feather_radius_x,
480
gdouble feather_radius_y)
528
gimp_channel_select_by_color (GimpChannel *channel,
529
GimpDrawable *drawable,
530
gboolean sample_merged,
531
const GimpRGB *color,
533
gboolean select_transparent,
534
GimpSelectCriterion select_criterion,
538
gdouble feather_radius_x,
539
gdouble feather_radius_y)
483
542
GimpChannel *add_on;
499
558
select_transparent,
502
562
if (! sample_merged)
503
563
gimp_item_offsets (GIMP_ITEM (drawable), &add_on_x, &add_on_y);
505
gimp_channel_select_channel (channel, _("Select by Color"),
565
gimp_channel_select_channel (channel, Q_("command|Select by Color"),
506
566
add_on, add_on_x, add_on_y,