app: add gimp_fill_options_set_by_fill_mode()

which takes a context and a GimpBucketFillMode and configures the
GimpFillOptions accordingly.
This commit is contained in:
Michael Natterer 2016-03-11 19:48:26 +01:00
parent 9ef2428fcb
commit 00932b57af
2 changed files with 48 additions and 12 deletions

View File

@ -308,6 +308,38 @@ gimp_fill_options_set_by_fill_type (GimpFillOptions *options,
return TRUE;
}
gboolean
gimp_fill_options_set_by_fill_mode (GimpFillOptions *options,
GimpContext *context,
GimpBucketFillMode fill_mode,
GError **error)
{
GimpFillType fill_type;
g_return_val_if_fail (GIMP_IS_FILL_OPTIONS (options), FALSE);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
switch (fill_mode)
{
default:
case GIMP_BUCKET_FILL_FG:
fill_type = GIMP_FILL_FOREGROUND;
break;
case GIMP_BUCKET_FILL_BG:
fill_type = GIMP_FILL_BACKGROUND;
break;
case GIMP_BUCKET_FILL_PATTERN:
fill_type = GIMP_FILL_PATTERN;
break;
}
return gimp_fill_options_set_by_fill_type (options, context,
fill_type, error);
}
const gchar *
gimp_fill_options_get_undo_desc (GimpFillOptions *options)
{

View File

@ -48,22 +48,26 @@ struct _GimpFillOptionsClass
GType gimp_fill_options_get_type (void) G_GNUC_CONST;
GimpFillOptions * gimp_fill_options_new (Gimp *gimp);
GimpFillOptions * gimp_fill_options_new (Gimp *gimp);
GimpFillStyle gimp_fill_options_get_style (GimpFillOptions *options);
void gimp_fill_options_set_style (GimpFillOptions *options,
GimpFillStyle style);
GimpFillStyle gimp_fill_options_get_style (GimpFillOptions *options);
void gimp_fill_options_set_style (GimpFillOptions *options,
GimpFillStyle style);
gboolean gimp_fill_options_get_antialias (GimpFillOptions *options);
void gimp_fill_options_set_antialias (GimpFillOptions *options,
gboolean antialias);
gboolean gimp_fill_options_get_antialias (GimpFillOptions *options);
void gimp_fill_options_set_antialias (GimpFillOptions *options,
gboolean antialias);
gboolean gimp_fill_options_set_by_fill_type (GimpFillOptions *options,
GimpContext *context,
GimpFillType fill_type,
GError **error);
gboolean gimp_fill_options_set_by_fill_type (GimpFillOptions *options,
GimpContext *context,
GimpFillType fill_type,
GError **error);
gboolean gimp_fill_options_set_by_fill_mode (GimpFillOptions *options,
GimpContext *context,
GimpBucketFillMode fill_mode,
GError **error);
const gchar * gimp_fill_options_get_undo_desc (GimpFillOptions *options);
const gchar * gimp_fill_options_get_undo_desc (GimpFillOptions *options);
#endif /* __GIMP_FILL_OPTIONS_H__ */