app: remove gimp_selection_extract_buffer() again
This commit is contained in:
@ -585,7 +585,7 @@ gimp_edit_extract (GimpImage *image,
|
|||||||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_CUT, C_("undo-type", "Cut"));
|
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_CUT, C_("undo-type", "Cut"));
|
||||||
|
|
||||||
/* Cut/copy the mask portion from the image */
|
/* Cut/copy the mask portion from the image */
|
||||||
buffer = gimp_selection_extract_buffer (GIMP_SELECTION (gimp_image_get_mask (image)),
|
buffer = gimp_selection_extract (GIMP_SELECTION (gimp_image_get_mask (image)),
|
||||||
pickable, context,
|
pickable, context,
|
||||||
cut_pixels, FALSE, FALSE,
|
cut_pixels, FALSE, FALSE,
|
||||||
&offset_x, &offset_y, error);
|
&offset_x, &offset_y, error);
|
||||||
|
@ -956,7 +956,7 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
|
|||||||
*/
|
*/
|
||||||
if (gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &w, &h))
|
if (gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &w, &h))
|
||||||
{
|
{
|
||||||
buffer = gimp_selection_extract_buffer (GIMP_SELECTION (gimp_image_get_mask (image)),
|
buffer = gimp_selection_extract (GIMP_SELECTION (gimp_image_get_mask (image)),
|
||||||
GIMP_PICKABLE (drawable),
|
GIMP_PICKABLE (drawable),
|
||||||
context,
|
context,
|
||||||
TRUE, FALSE, TRUE,
|
TRUE, FALSE, TRUE,
|
||||||
@ -975,7 +975,7 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
|
|||||||
}
|
}
|
||||||
else /* otherwise, just copy the layer */
|
else /* otherwise, just copy the layer */
|
||||||
{
|
{
|
||||||
buffer = gimp_selection_extract_buffer (GIMP_SELECTION (gimp_image_get_mask (image)),
|
buffer = gimp_selection_extract (GIMP_SELECTION (gimp_image_get_mask (image)),
|
||||||
GIMP_PICKABLE (drawable),
|
GIMP_PICKABLE (drawable),
|
||||||
context,
|
context,
|
||||||
FALSE, TRUE, GIMP_IS_LAYER (drawable),
|
FALSE, TRUE, GIMP_IS_LAYER (drawable),
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
#include "core-types.h"
|
#include "core-types.h"
|
||||||
|
|
||||||
#include "base/tile-manager.h"
|
|
||||||
|
|
||||||
#include "gegl/gimp-gegl-nodes.h"
|
#include "gegl/gimp-gegl-nodes.h"
|
||||||
#include "gegl/gimp-gegl-utils.h"
|
#include "gegl/gimp-gegl-utils.h"
|
||||||
|
|
||||||
@ -615,53 +613,20 @@ gimp_selection_save (GimpSelection *selection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GeglBuffer *
|
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,
|
gimp_selection_extract (GimpSelection *selection,
|
||||||
GimpPickable *pickable,
|
GimpPickable *pickable,
|
||||||
GimpContext *context,
|
GimpContext *context,
|
||||||
gboolean cut_image,
|
gboolean cut_image,
|
||||||
gboolean keep_indexed,
|
gboolean keep_indexed,
|
||||||
gboolean add_alpha,
|
gboolean add_alpha,
|
||||||
const Babl **format,
|
|
||||||
gint *offset_x,
|
gint *offset_x,
|
||||||
gint *offset_y,
|
gint *offset_y,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
TileManager *tiles;
|
|
||||||
GeglBuffer *src_buffer;
|
GeglBuffer *src_buffer;
|
||||||
GeglBuffer *dest_buffer;
|
GeglBuffer *dest_buffer;
|
||||||
|
const Babl *format;
|
||||||
gint x1, y1, x2, y2;
|
gint x1, y1, x2, y2;
|
||||||
gboolean non_empty;
|
gboolean non_empty;
|
||||||
gint off_x, off_y;
|
gint off_x, off_y;
|
||||||
@ -671,7 +636,6 @@ gimp_selection_extract (GimpSelection *selection,
|
|||||||
if (GIMP_IS_ITEM (pickable))
|
if (GIMP_IS_ITEM (pickable))
|
||||||
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (pickable)), NULL);
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (pickable)), NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
||||||
g_return_val_if_fail (format != NULL, NULL);
|
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
image = gimp_pickable_get_image (pickable);
|
image = gimp_pickable_get_image (pickable);
|
||||||
@ -709,26 +673,26 @@ gimp_selection_extract (GimpSelection *selection,
|
|||||||
case GIMP_RGB:
|
case GIMP_RGB:
|
||||||
case GIMP_GRAY:
|
case GIMP_GRAY:
|
||||||
if (add_alpha)
|
if (add_alpha)
|
||||||
*format = gimp_pickable_get_format_with_alpha (pickable);
|
format = gimp_pickable_get_format_with_alpha (pickable);
|
||||||
else
|
else
|
||||||
*format = gimp_pickable_get_format (pickable);
|
format = gimp_pickable_get_format (pickable);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_INDEXED:
|
case GIMP_INDEXED:
|
||||||
if (keep_indexed)
|
if (keep_indexed)
|
||||||
{
|
{
|
||||||
if (add_alpha)
|
if (add_alpha)
|
||||||
*format = gimp_pickable_get_format_with_alpha (pickable);
|
format = gimp_pickable_get_format_with_alpha (pickable);
|
||||||
else
|
else
|
||||||
*format = gimp_pickable_get_format (pickable);
|
format = gimp_pickable_get_format (pickable);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (add_alpha ||
|
if (add_alpha ||
|
||||||
GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_pickable_get_image_type (pickable)))
|
GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_pickable_get_image_type (pickable)))
|
||||||
*format = babl_format ("RGBA u8");
|
format = babl_format ("RGBA u8");
|
||||||
else
|
else
|
||||||
*format = babl_format ("RGB u8");
|
format = babl_format ("RGB u8");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -751,13 +715,12 @@ gimp_selection_extract (GimpSelection *selection,
|
|||||||
src_buffer = gimp_pickable_get_buffer (pickable);
|
src_buffer = gimp_pickable_get_buffer (pickable);
|
||||||
|
|
||||||
/* Allocate the temp buffer */
|
/* Allocate the temp buffer */
|
||||||
tiles = tile_manager_new (x2 - x1, y2 - y1,
|
dest_buffer = gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0, x2 - x1, y2 - y1),
|
||||||
babl_format_get_bytes_per_pixel (*format));
|
format);
|
||||||
dest_buffer = gimp_tile_manager_create_buffer (tiles, *format);
|
|
||||||
|
|
||||||
/* First, copy the pixels, possibly doing INDEXED->RGB and adding alpha */
|
/* First, copy the pixels, possibly doing INDEXED->RGB and adding alpha */
|
||||||
gegl_buffer_copy (src_buffer, GIMP_GEGL_RECT (x1, y1, x2 - x1, y2 - y1),
|
gegl_buffer_copy (src_buffer, GIMP_GEGL_RECT (x1, y1, x2 - x1, y2 - y1),
|
||||||
dest_buffer, GIMP_GEGL_RECT (0,0,0,0));
|
dest_buffer, GIMP_GEGL_RECT (0, 0,0 ,0 ));
|
||||||
|
|
||||||
if (non_empty)
|
if (non_empty)
|
||||||
{
|
{
|
||||||
@ -808,12 +771,10 @@ gimp_selection_extract (GimpSelection *selection,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (dest_buffer);
|
|
||||||
|
|
||||||
*offset_x = x1 + off_x;
|
*offset_x = x1 + off_x;
|
||||||
*offset_y = y1 + off_y;
|
*offset_y = y1 + off_y;
|
||||||
|
|
||||||
return tiles;
|
return dest_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpLayer *
|
GimpLayer *
|
||||||
@ -854,7 +815,7 @@ gimp_selection_float (GimpSelection *selection,
|
|||||||
C_("undo-type", "Float Selection"));
|
C_("undo-type", "Float Selection"));
|
||||||
|
|
||||||
/* Cut or copy the selected region */
|
/* Cut or copy the selected region */
|
||||||
buffer = gimp_selection_extract_buffer (selection, GIMP_PICKABLE (drawable), context,
|
buffer = gimp_selection_extract (selection, GIMP_PICKABLE (drawable), context,
|
||||||
cut_image, FALSE, TRUE,
|
cut_image, FALSE, TRUE,
|
||||||
&x1, &y1, NULL);
|
&x1, &y1, NULL);
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ void gimp_selection_load (GimpSelection *selection,
|
|||||||
GimpChannel *channel);
|
GimpChannel *channel);
|
||||||
GimpChannel * gimp_selection_save (GimpSelection *selection);
|
GimpChannel * gimp_selection_save (GimpSelection *selection);
|
||||||
|
|
||||||
GeglBuffer * gimp_selection_extract_buffer(GimpSelection *selection,
|
GeglBuffer * gimp_selection_extract (GimpSelection *selection,
|
||||||
GimpPickable *pickable,
|
GimpPickable *pickable,
|
||||||
GimpContext *context,
|
GimpContext *context,
|
||||||
gboolean cut_image,
|
gboolean cut_image,
|
||||||
@ -67,16 +67,6 @@ GeglBuffer * gimp_selection_extract_buffer(GimpSelection *selection,
|
|||||||
gint *offset_x,
|
gint *offset_x,
|
||||||
gint *offset_y,
|
gint *offset_y,
|
||||||
GError **error);
|
GError **error);
|
||||||
TileManager * gimp_selection_extract (GimpSelection *selection,
|
|
||||||
GimpPickable *pickable,
|
|
||||||
GimpContext *context,
|
|
||||||
gboolean cut_image,
|
|
||||||
gboolean keep_indexed,
|
|
||||||
gboolean add_alpha,
|
|
||||||
const Babl **format,
|
|
||||||
gint *offset_x,
|
|
||||||
gint *offset_y,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
GimpLayer * gimp_selection_float (GimpSelection *selection,
|
GimpLayer * gimp_selection_float (GimpSelection *selection,
|
||||||
GimpDrawable *drawable,
|
GimpDrawable *drawable,
|
||||||
|
Reference in New Issue
Block a user