app: add gimp_fill_options_fill_buffer()
... which is similar to gimp_fill_options_create_buffer(), however,
it fills an existing buffer, instead of creating a new buffer.
Implement gimp_fill_options_create_buffer() in terms of the new
function.
(cherry picked from commit 45fc4cb4f9
)
This commit is contained in:
@ -411,7 +411,7 @@ gimp_fill_options_create_buffer (GimpFillOptions *options,
|
||||
gint pattern_offset_x,
|
||||
gint pattern_offset_y)
|
||||
{
|
||||
GeglBuffer *buffer;
|
||||
GeglBuffer *buffer;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_FILL_OPTIONS (options), NULL);
|
||||
g_return_val_if_fail (gimp_fill_options_get_style (options) !=
|
||||
@ -424,6 +424,26 @@ gimp_fill_options_create_buffer (GimpFillOptions *options,
|
||||
buffer = gegl_buffer_new (rect,
|
||||
gimp_drawable_get_format_with_alpha (drawable));
|
||||
|
||||
gimp_fill_options_fill_buffer (options, drawable, buffer,
|
||||
pattern_offset_x, pattern_offset_y);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_fill_options_fill_buffer (GimpFillOptions *options,
|
||||
GimpDrawable *drawable,
|
||||
GeglBuffer *buffer,
|
||||
gint pattern_offset_x,
|
||||
gint pattern_offset_y)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_FILL_OPTIONS (options));
|
||||
g_return_if_fail (gimp_fill_options_get_style (options) !=
|
||||
GIMP_FILL_STYLE_PATTERN ||
|
||||
gimp_context_get_pattern (GIMP_CONTEXT (options)) != NULL);
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (GEGL_IS_BUFFER (buffer));
|
||||
|
||||
switch (gimp_fill_options_get_style (options))
|
||||
{
|
||||
case GIMP_FILL_STYLE_SOLID:
|
||||
@ -451,6 +471,4 @@ gimp_fill_options_create_buffer (GimpFillOptions *options,
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
@ -76,6 +76,11 @@ GeglBuffer * gimp_fill_options_create_buffer (GimpFillOptions *optio
|
||||
const GeglRectangle *rect,
|
||||
gint pattern_offset_x,
|
||||
gint pattern_offset_y);
|
||||
void gimp_fill_options_fill_buffer (GimpFillOptions *options,
|
||||
GimpDrawable *drawable,
|
||||
GeglBuffer *buffer,
|
||||
gint pattern_offset_x,
|
||||
gint pattern_offset_y);
|
||||
|
||||
|
||||
#endif /* __GIMP_FILL_OPTIONS_H__ */
|
||||
|
Reference in New Issue
Block a user