app: add gimp_selection_extract_buffer ()

This commit is contained in:
Michael Natterer
2012-03-21 14:27:07 +01:00
parent 91ec2feb49
commit 7b88ab6a46
2 changed files with 41 additions and 0 deletions

View File

@ -614,6 +614,38 @@ gimp_selection_save (GimpSelection *selection)
return new_channel;
}
GeglBuffer *
gimp_selection_extract_buffer (GimpSelection *selection,
GimpPickable *pickable,
GimpContext *context,
gboolean cut_image,
gboolean keep_indexed,
gboolean add_alpha,
gint *offset_x,
gint *offset_y,
GError **error)
{
TileManager *tiles;
const Babl *format;
tiles = gimp_selection_extract (selection, pickable, context,
cut_image, keep_indexed, add_alpha,
&format,
offset_x, offset_y, error);
if (tiles)
{
GeglBuffer *buffer;
buffer = gimp_tile_manager_create_buffer (tiles, format);
tile_manager_unref (tiles);
return buffer;
}
return NULL;
}
TileManager *
gimp_selection_extract (GimpSelection *selection,
GimpPickable *pickable,

View File

@ -58,6 +58,15 @@ void gimp_selection_load (GimpSelection *selection,
GimpChannel *channel);
GimpChannel * gimp_selection_save (GimpSelection *selection);
GeglBuffer * gimp_selection_extract_buffer(GimpSelection *selection,
GimpPickable *pickable,
GimpContext *context,
gboolean cut_image,
gboolean keep_indexed,
gboolean add_alpha,
gint *offset_x,
gint *offset_y,
GError **error);
TileManager * gimp_selection_extract (GimpSelection *selection,
GimpPickable *pickable,
GimpContext *context,