mirror of https://github.com/GNOME/gimp.git
added GimpForegroundExtractMode in preparation for other implementations
2005-07-29 Sven Neumann <sven@gimp.org> * libgimpbase/gimpbaseenums.[ch]: added GimpForegroundExtractMode in preparation for other implementations to be added in the future. * libgimp/gimpenums.c.tail * tools/pdbgen/enums.pl: regenerated. * app/core/gimpdrawable-foreground-extract.[ch] * app/tools/gimpforegroundselecttool.c * tools/pdbgen/pdb/drawable.pdb: added the mode parameter. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated.
This commit is contained in:
parent
26b69166c7
commit
23666d8f19
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2005-07-29 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpbase/gimpbaseenums.[ch]: added GimpForegroundExtractMode
|
||||
in preparation for other implementations to be added in the future.
|
||||
|
||||
* libgimp/gimpenums.c.tail
|
||||
* tools/pdbgen/enums.pl: regenerated.
|
||||
|
||||
* app/core/gimpdrawable-foreground-extract.[ch]
|
||||
* app/tools/gimpforegroundselecttool.c
|
||||
* tools/pdbgen/pdb/drawable.pdb: added the mode parameter.
|
||||
|
||||
* app/pdb/drawable_cmds.c
|
||||
* libgimp/gimpdrawable_pdb.[ch]: regenerated.
|
||||
|
||||
2005-07-29 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpconfig/gimpconfig-utils.c (gimp_config_string_append_escaped):
|
||||
|
|
|
@ -36,12 +36,12 @@
|
|||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_drawable_foreground_extract (GimpDrawable *drawable,
|
||||
GimpDrawable *mask)
|
||||
gimp_drawable_foreground_extract (GimpDrawable *drawable,
|
||||
GimpForegroundExtractMode mode,
|
||||
GimpDrawable *mask)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
const guchar *colormap = NULL;
|
||||
const gfloat limits[SIOX_DIMS] = { 0.66, 1.25, 2.5 };
|
||||
gint x, y;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
|
@ -57,9 +57,20 @@ gimp_drawable_foreground_extract (GimpDrawable *drawable,
|
|||
|
||||
gimp_item_offsets (GIMP_ITEM (drawable), &x, &y);
|
||||
|
||||
siox_foreground_extract (gimp_drawable_data (drawable), colormap, x, y,
|
||||
gimp_drawable_data (mask),
|
||||
limits, 3);
|
||||
switch (mode)
|
||||
{
|
||||
case GIMP_FOREGROUND_EXTRACT_SIOX:
|
||||
{
|
||||
const gfloat limits[SIOX_DIMS] = { 0.66, 1.25, 2.5 };
|
||||
siox_foreground_extract (gimp_drawable_data (drawable), colormap, x, y,
|
||||
gimp_drawable_data (mask),
|
||||
limits, 3);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_return_if_reached ();
|
||||
}
|
||||
|
||||
gimp_drawable_update (mask,
|
||||
0, 0,
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
#define __GIMP_DRAWABLE_FOREGROUND_EXTRACT_H__
|
||||
|
||||
|
||||
void gimp_drawable_foreground_extract (GimpDrawable *drawable,
|
||||
GimpDrawable *mask);
|
||||
void gimp_drawable_foreground_extract (GimpDrawable *drawable,
|
||||
GimpForegroundExtractMode mode,
|
||||
GimpDrawable *mask);
|
||||
|
||||
|
||||
#endif /* __GIMP_DRAWABLE_FOREGROUND_EXTRACT_H__ */
|
||||
|
|
|
@ -2511,13 +2511,18 @@ drawable_foreground_extract_invoker (Gimp *gimp,
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
GimpDrawable *drawable;
|
||||
gint32 mode;
|
||||
GimpDrawable *mask;
|
||||
|
||||
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
|
||||
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
|
||||
success = FALSE;
|
||||
|
||||
mask = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
|
||||
mode = args[1].value.pdb_int;
|
||||
if (mode != GIMP_FOREGROUND_EXTRACT_SIOX)
|
||||
success = FALSE;
|
||||
|
||||
mask = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[2].value.pdb_int);
|
||||
if (! (GIMP_IS_DRAWABLE (mask) && ! gimp_item_is_removed (GIMP_ITEM (mask))))
|
||||
success = FALSE;
|
||||
|
||||
|
@ -2526,7 +2531,7 @@ drawable_foreground_extract_invoker (Gimp *gimp,
|
|||
success = gimp_item_is_attached (GIMP_ITEM (drawable));
|
||||
|
||||
if (success)
|
||||
gimp_drawable_foreground_extract (drawable, mask);
|
||||
gimp_drawable_foreground_extract (drawable, mode, mask);
|
||||
}
|
||||
|
||||
return procedural_db_return_args (&drawable_foreground_extract_proc, success);
|
||||
|
@ -2539,6 +2544,11 @@ static ProcArg drawable_foreground_extract_inargs[] =
|
|||
"drawable",
|
||||
"The drawable"
|
||||
},
|
||||
{
|
||||
GIMP_PDB_INT32,
|
||||
"mode",
|
||||
"The algorithm to use: GIMP_FOREGROUND_EXTRACT_SIOX (0)"
|
||||
},
|
||||
{
|
||||
GIMP_PDB_DRAWABLE,
|
||||
"mask",
|
||||
|
@ -2556,7 +2566,7 @@ static ProcRecord drawable_foreground_extract_proc =
|
|||
"2005",
|
||||
NULL,
|
||||
GIMP_INTERNAL,
|
||||
2,
|
||||
3,
|
||||
drawable_foreground_extract_inargs,
|
||||
0,
|
||||
NULL,
|
||||
|
|
|
@ -238,7 +238,9 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
|
|||
0, 0, 127);
|
||||
gimp_scan_convert_free (scan_convert);
|
||||
|
||||
gimp_drawable_foreground_extract (drawable, mask);
|
||||
gimp_drawable_foreground_extract (drawable,
|
||||
GIMP_FOREGROUND_EXTRACT_SIOX,
|
||||
GIMP_DRAWABLE (mask));
|
||||
|
||||
gimp_channel_select_channel (gimp_image_get_mask (gimage),
|
||||
tool->tool_info->blurb,
|
||||
|
|
|
@ -1302,6 +1302,7 @@ _gimp_drawable_sub_thumbnail (gint32 drawable_ID,
|
|||
/**
|
||||
* gimp_drawable_foreground_extract:
|
||||
* @drawable_ID: The drawable.
|
||||
* @mode: The algorithm to use.
|
||||
* @mask_ID: Tri-Map.
|
||||
*
|
||||
* Extract the foreground of a drawable using a given trimap.
|
||||
|
@ -1314,8 +1315,9 @@ _gimp_drawable_sub_thumbnail (gint32 drawable_ID,
|
|||
* Since: GIMP 2.4
|
||||
*/
|
||||
gboolean
|
||||
gimp_drawable_foreground_extract (gint32 drawable_ID,
|
||||
gint32 mask_ID)
|
||||
gimp_drawable_foreground_extract (gint32 drawable_ID,
|
||||
GimpForegroundExtractMode mode,
|
||||
gint32 mask_ID)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
|
@ -1324,6 +1326,7 @@ gimp_drawable_foreground_extract (gint32 drawable_ID,
|
|||
return_vals = gimp_run_procedure ("gimp_drawable_foreground_extract",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_DRAWABLE, drawable_ID,
|
||||
GIMP_PDB_INT32, mode,
|
||||
GIMP_PDB_DRAWABLE, mask_ID,
|
||||
GIMP_PDB_END);
|
||||
|
||||
|
|
|
@ -29,94 +29,95 @@ G_BEGIN_DECLS
|
|||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
gboolean gimp_drawable_delete (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_is_layer (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_is_layer_mask (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_is_channel (gint32 drawable_ID);
|
||||
GimpImageType gimp_drawable_type (gint32 drawable_ID);
|
||||
GimpImageType gimp_drawable_type_with_alpha (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_has_alpha (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_is_rgb (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_is_gray (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_is_indexed (gint32 drawable_ID);
|
||||
gint gimp_drawable_bpp (gint32 drawable_ID);
|
||||
gint gimp_drawable_width (gint32 drawable_ID);
|
||||
gint gimp_drawable_height (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_offsets (gint32 drawable_ID,
|
||||
gint *offset_x,
|
||||
gint *offset_y);
|
||||
gint32 gimp_drawable_get_image (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_delete (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_is_layer (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_is_layer_mask (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_is_channel (gint32 drawable_ID);
|
||||
GimpImageType gimp_drawable_type (gint32 drawable_ID);
|
||||
GimpImageType gimp_drawable_type_with_alpha (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_has_alpha (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_is_rgb (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_is_gray (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_is_indexed (gint32 drawable_ID);
|
||||
gint gimp_drawable_bpp (gint32 drawable_ID);
|
||||
gint gimp_drawable_width (gint32 drawable_ID);
|
||||
gint gimp_drawable_height (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_offsets (gint32 drawable_ID,
|
||||
gint *offset_x,
|
||||
gint *offset_y);
|
||||
gint32 gimp_drawable_get_image (gint32 drawable_ID);
|
||||
#ifndef GIMP_DISABLE_DEPRECATED
|
||||
gboolean gimp_drawable_set_image (gint32 drawable_ID,
|
||||
gint32 image_ID);
|
||||
gboolean gimp_drawable_set_image (gint32 drawable_ID,
|
||||
gint32 image_ID);
|
||||
#endif /* GIMP_DISABLE_DEPRECATED */
|
||||
gchar* gimp_drawable_get_name (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_set_name (gint32 drawable_ID,
|
||||
const gchar *name);
|
||||
gboolean gimp_drawable_get_visible (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_set_visible (gint32 drawable_ID,
|
||||
gboolean visible);
|
||||
gboolean gimp_drawable_get_linked (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_set_linked (gint32 drawable_ID,
|
||||
gboolean linked);
|
||||
gint gimp_drawable_get_tattoo (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_set_tattoo (gint32 drawable_ID,
|
||||
gint tattoo);
|
||||
gboolean gimp_drawable_mask_bounds (gint32 drawable_ID,
|
||||
gint *x1,
|
||||
gint *y1,
|
||||
gint *x2,
|
||||
gint *y2);
|
||||
gboolean gimp_drawable_mask_intersect (gint32 drawable_ID,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height);
|
||||
gboolean gimp_drawable_merge_shadow (gint32 drawable_ID,
|
||||
gboolean undo);
|
||||
gboolean gimp_drawable_update (gint32 drawable_ID,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
guint8* gimp_drawable_get_pixel (gint32 drawable_ID,
|
||||
gint x_coord,
|
||||
gint y_coord,
|
||||
gint *num_channels);
|
||||
gboolean gimp_drawable_set_pixel (gint32 drawable_ID,
|
||||
gint x_coord,
|
||||
gint y_coord,
|
||||
gint num_channels,
|
||||
const guint8 *pixel);
|
||||
gboolean gimp_drawable_fill (gint32 drawable_ID,
|
||||
GimpFillType fill_type);
|
||||
gboolean gimp_drawable_offset (gint32 drawable_ID,
|
||||
gboolean wrap_around,
|
||||
GimpOffsetType fill_type,
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
gboolean _gimp_drawable_thumbnail (gint32 drawable_ID,
|
||||
gint width,
|
||||
gint height,
|
||||
gint *ret_width,
|
||||
gint *ret_height,
|
||||
gint *bpp,
|
||||
gint *thumbnail_data_count,
|
||||
guint8 **thumbnail_data);
|
||||
gboolean _gimp_drawable_sub_thumbnail (gint32 drawable_ID,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint src_width,
|
||||
gint src_height,
|
||||
gint dest_width,
|
||||
gint dest_height,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *bpp,
|
||||
gint *thumbnail_data_count,
|
||||
guint8 **thumbnail_data);
|
||||
gboolean gimp_drawable_foreground_extract (gint32 drawable_ID,
|
||||
gint32 mask_ID);
|
||||
gchar* gimp_drawable_get_name (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_set_name (gint32 drawable_ID,
|
||||
const gchar *name);
|
||||
gboolean gimp_drawable_get_visible (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_set_visible (gint32 drawable_ID,
|
||||
gboolean visible);
|
||||
gboolean gimp_drawable_get_linked (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_set_linked (gint32 drawable_ID,
|
||||
gboolean linked);
|
||||
gint gimp_drawable_get_tattoo (gint32 drawable_ID);
|
||||
gboolean gimp_drawable_set_tattoo (gint32 drawable_ID,
|
||||
gint tattoo);
|
||||
gboolean gimp_drawable_mask_bounds (gint32 drawable_ID,
|
||||
gint *x1,
|
||||
gint *y1,
|
||||
gint *x2,
|
||||
gint *y2);
|
||||
gboolean gimp_drawable_mask_intersect (gint32 drawable_ID,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height);
|
||||
gboolean gimp_drawable_merge_shadow (gint32 drawable_ID,
|
||||
gboolean undo);
|
||||
gboolean gimp_drawable_update (gint32 drawable_ID,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
guint8* gimp_drawable_get_pixel (gint32 drawable_ID,
|
||||
gint x_coord,
|
||||
gint y_coord,
|
||||
gint *num_channels);
|
||||
gboolean gimp_drawable_set_pixel (gint32 drawable_ID,
|
||||
gint x_coord,
|
||||
gint y_coord,
|
||||
gint num_channels,
|
||||
const guint8 *pixel);
|
||||
gboolean gimp_drawable_fill (gint32 drawable_ID,
|
||||
GimpFillType fill_type);
|
||||
gboolean gimp_drawable_offset (gint32 drawable_ID,
|
||||
gboolean wrap_around,
|
||||
GimpOffsetType fill_type,
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
gboolean _gimp_drawable_thumbnail (gint32 drawable_ID,
|
||||
gint width,
|
||||
gint height,
|
||||
gint *ret_width,
|
||||
gint *ret_height,
|
||||
gint *bpp,
|
||||
gint *thumbnail_data_count,
|
||||
guint8 **thumbnail_data);
|
||||
gboolean _gimp_drawable_sub_thumbnail (gint32 drawable_ID,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint src_width,
|
||||
gint src_height,
|
||||
gint dest_width,
|
||||
gint dest_height,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *bpp,
|
||||
gint *thumbnail_data_count,
|
||||
guint8 **thumbnail_data);
|
||||
gboolean gimp_drawable_foreground_extract (gint32 drawable_ID,
|
||||
GimpForegroundExtractMode mode,
|
||||
gint32 mask_ID);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -17,6 +17,7 @@ static const GimpGetTypeFunc get_type_funcs[] =
|
|||
gimp_desaturate_mode_get_type,
|
||||
gimp_dodge_burn_type_get_type,
|
||||
gimp_fill_type_get_type,
|
||||
gimp_foreground_extract_mode_get_type,
|
||||
gimp_gradient_segment_color_get_type,
|
||||
gimp_gradient_segment_type_get_type,
|
||||
gimp_gradient_type_get_type,
|
||||
|
@ -62,6 +63,7 @@ static const gchar *type_names[] =
|
|||
"GimpDesaturateMode",
|
||||
"GimpDodgeBurnType",
|
||||
"GimpFillType",
|
||||
"GimpForegroundExtractMode",
|
||||
"GimpGradientSegmentColor",
|
||||
"GimpGradientSegmentType",
|
||||
"GimpGradientType",
|
||||
|
|
|
@ -335,6 +335,33 @@ gimp_dodge_burn_type_get_type (void)
|
|||
return type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_foreground_extract_mode_get_type (void)
|
||||
{
|
||||
static const GEnumValue values[] =
|
||||
{
|
||||
{ GIMP_FOREGROUND_EXTRACT_SIOX, "GIMP_FOREGROUND_EXTRACT_SIOX", "siox" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static const GimpEnumDesc descs[] =
|
||||
{
|
||||
{ GIMP_FOREGROUND_EXTRACT_SIOX, "GIMP_FOREGROUND_EXTRACT_SIOX", NULL },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static GType type = 0;
|
||||
|
||||
if (! type)
|
||||
{
|
||||
type = g_enum_register_static ("GimpForegroundExtractMode", values);
|
||||
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
|
||||
gimp_enum_set_value_descriptions (type, descs);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_gradient_type_get_type (void)
|
||||
{
|
||||
|
|
|
@ -155,6 +155,16 @@ typedef enum
|
|||
} GimpDodgeBurnType;
|
||||
|
||||
|
||||
#define GIMP_TYPE_FOEEGROUND_EXTRACT_MODE (gimp_foreground_extract_mode_get_type ())
|
||||
|
||||
GType gimp_foreground_extract_mode_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_FOREGROUND_EXTRACT_SIOX
|
||||
} GimpForegroundExtractMode;
|
||||
|
||||
|
||||
#define GIMP_TYPE_GRADIENT_TYPE (gimp_gradient_type_get_type ())
|
||||
|
||||
GType gimp_gradient_type_get_type (void) G_GNUC_CONST;
|
||||
|
|
|
@ -98,6 +98,12 @@ package Gimp::CodeGen::enums;
|
|||
mapping => { GIMP_DODGE => '0',
|
||||
GIMP_BURN => '1' }
|
||||
},
|
||||
GimpForegroundExtractMode =>
|
||||
{ contig => 1,
|
||||
header => 'libgimpbase/gimpbaseenums.h',
|
||||
symbols => [ qw(GIMP_FOREGROUND_EXTRACT_SIOX) ],
|
||||
mapping => { GIMP_FOREGROUND_EXTRACT_SIOX => '0' }
|
||||
},
|
||||
GimpGradientType =>
|
||||
{ contig => 1,
|
||||
header => 'libgimpbase/gimpbaseenums.h',
|
||||
|
|
|
@ -852,6 +852,8 @@ HELP
|
|||
|
||||
@inargs = (
|
||||
&drawable_arg,
|
||||
{ name => 'mode', type => 'enum GimpForegroundExtractMode',
|
||||
desc => 'The algorithm to use: %%desc%%' },
|
||||
{ name => 'mask', type => 'drawable', desc => 'Tri-Map' }
|
||||
);
|
||||
|
||||
|
@ -861,7 +863,7 @@ HELP
|
|||
success = gimp_item_is_attached (GIMP_ITEM (drawable));
|
||||
|
||||
if (success)
|
||||
gimp_drawable_foreground_extract (drawable, mask);
|
||||
gimp_drawable_foreground_extract (drawable, mode, mask);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue