libgimp, pdb: add GimpItem > GimpDrawable > GimpLayer classes.

Only class and subclasses creation and PDB generation for this first
step.
I'll later do other types of items.
This commit is contained in:
Jehan 2019-08-13 13:59:33 +02:00
parent 793cba6675
commit 79b319cf9d
43 changed files with 10469 additions and 1080 deletions

View file

@ -119,6 +119,7 @@ libgimp_introspectable_headers = \
../libgimp/gimpimage.h \
../libgimp/gimpimagecolorprofile.h \
../libgimp/gimpimageprocedure.h \
../libgimp/gimpitem.h \
../libgimp/gimplayer.h \
../libgimp/gimploadprocedure.h \
../libgimp/gimppaletteselect.h \
@ -147,6 +148,7 @@ libgimp_introspectable = \
../libgimp/gimpimage.c \
../libgimp/gimpimagecolorprofile.c \
../libgimp/gimpimageprocedure.c \
../libgimp/gimpitem.c \
../libgimp/gimplayer.c \
../libgimp/gimploadprocedure.c \
../libgimp/gimppaletteselect.c \

View file

@ -44,6 +44,7 @@
#include <libgimp/gimpimage.h>
#include <libgimp/gimpimagecolorprofile.h>
#include <libgimp/gimpimageprocedure.h>
#include <libgimp/gimpitem.h>
#include <libgimp/gimplayer.h>
#include <libgimp/gimploadprocedure.h>
#include <libgimp/gimplegacy.h>

View file

@ -26,6 +26,24 @@
#include "gimptilebackendplugin.h"
G_DEFINE_ABSTRACT_TYPE (GimpDrawable, gimp_drawable, GIMP_TYPE_ITEM)
#define parent_class gimp_drawable_parent_class
static void
gimp_drawable_class_init (GimpDrawableClass *klass)
{
}
static void
gimp_drawable_init (GimpDrawable *drawable)
{
}
/* Public API. */
guchar *
gimp_drawable_get_thumbnail_data (gint32 drawable_ID,
gint *width,

View file

@ -29,6 +29,40 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#include <libgimp/gimpitem.h>
#define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ())
#define GIMP_DRAWABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable))
#define GIMP_DRAWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DRAWABLE, GimpDrawableClass))
#define GIMP_IS_DRAWABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DRAWABLE))
#define GIMP_IS_DRAWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DRAWABLE))
#define GIMP_DRAWABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DRAWABLE, GimpDrawableClass))
typedef struct _GimpDrawableClass GimpDrawableClass;
struct _GimpDrawable
{
GimpItem parent_instance;
};
struct _GimpDrawableClass
{
GimpItemClass parent_class;
/* Padding for future expansion */
void (*_gimp_reserved1) (void);
void (*_gimp_reserved2) (void);
void (*_gimp_reserved3) (void);
void (*_gimp_reserved4) (void);
void (*_gimp_reserved5) (void);
void (*_gimp_reserved6) (void);
void (*_gimp_reserved7) (void);
void (*_gimp_reserved8) (void);
void (*_gimp_reserved9) (void);
};
GType gimp_drawable_get_type (void) G_GNUC_CONST;
GeglBuffer * gimp_drawable_get_buffer (gint32 drawable_ID);
GeglBuffer * gimp_drawable_get_shadow_buffer (gint32 drawable_ID);

File diff suppressed because it is too large Load diff

View file

@ -32,55 +32,59 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
G_GNUC_INTERNAL gchar* _gimp_drawable_get_format (gint32 drawable_ID);
G_GNUC_INTERNAL gchar* _gimp_drawable_get_thumbnail_format (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,
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
G_GNUC_INTERNAL gchar* _gimp_drawable_get_format (GimpDrawable *drawable);
G_GNUC_INTERNAL gchar* _gimp_drawable_get_thumbnail_format (GimpDrawable *drawable);
GimpImageType gimp_drawable_type (GimpDrawable *drawable);
GimpImageType gimp_drawable_type_with_alpha (GimpDrawable *drawable);
gboolean gimp_drawable_has_alpha (GimpDrawable *drawable);
gboolean gimp_drawable_is_rgb (GimpDrawable *drawable);
gboolean gimp_drawable_is_gray (GimpDrawable *drawable);
gboolean gimp_drawable_is_indexed (GimpDrawable *drawable);
gint gimp_drawable_bpp (GimpDrawable *drawable);
gint gimp_drawable_width (GimpDrawable *drawable);
gint gimp_drawable_height (GimpDrawable *drawable);
gboolean gimp_drawable_offsets (GimpDrawable *drawable,
gint *offset_x,
gint *offset_y);
gboolean gimp_drawable_mask_bounds (gint32 drawable_ID,
gboolean gimp_drawable_mask_bounds (GimpDrawable *drawable,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gboolean gimp_drawable_mask_intersect (gint32 drawable_ID,
gboolean gimp_drawable_mask_intersect (GimpDrawable *drawable,
gint *x,
gint *y,
gint *width,
gint *height);
gboolean gimp_drawable_merge_shadow (gint32 drawable_ID,
gboolean gimp_drawable_merge_shadow (GimpDrawable *drawable,
gboolean undo);
gboolean gimp_drawable_free_shadow (gint32 drawable_ID);
gboolean gimp_drawable_update (gint32 drawable_ID,
gboolean gimp_drawable_free_shadow (GimpDrawable *drawable);
gboolean gimp_drawable_update (GimpDrawable *drawable,
gint x,
gint y,
gint width,
gint height);
guint8* gimp_drawable_get_pixel (gint32 drawable_ID,
guint8* gimp_drawable_get_pixel (GimpDrawable *drawable,
gint x_coord,
gint y_coord,
gint *num_channels);
gboolean gimp_drawable_set_pixel (gint32 drawable_ID,
gboolean gimp_drawable_set_pixel (GimpDrawable *drawable,
gint x_coord,
gint y_coord,
gint num_channels,
const guint8 *pixel);
gboolean gimp_drawable_fill (gint32 drawable_ID,
gboolean gimp_drawable_fill (GimpDrawable *drawable,
GimpFillType fill_type);
gboolean gimp_drawable_offset (gint32 drawable_ID,
gboolean gimp_drawable_offset (GimpDrawable *drawable,
gboolean wrap_around,
GimpOffsetType fill_type,
gint offset_x,
gint offset_y);
G_GNUC_INTERNAL gboolean _gimp_drawable_thumbnail (gint32 drawable_ID,
G_GNUC_INTERNAL gboolean _gimp_drawable_thumbnail (GimpDrawable *drawable,
gint width,
gint height,
gint *actual_width,
@ -88,7 +92,7 @@ G_GNUC_INTERNAL gboolean _gimp_drawable_thumbnail (gint32
gint *bpp,
gint *thumbnail_data_count,
guint8 **thumbnail_data);
G_GNUC_INTERNAL gboolean _gimp_drawable_sub_thumbnail (gint32 drawable_ID,
G_GNUC_INTERNAL gboolean _gimp_drawable_sub_thumbnail (GimpDrawable *drawable,
gint src_x,
gint src_y,
gint src_width,
@ -100,16 +104,36 @@ G_GNUC_INTERNAL gboolean _gimp_drawable_sub_thumbnail (gint32
gint *bpp,
gint *thumbnail_data_count,
guint8 **thumbnail_data);
gboolean gimp_drawable_foreground_extract (gint32 drawable_ID,
gboolean gimp_drawable_foreground_extract (GimpDrawable *drawable,
GimpForegroundExtractMode mode,
gint32 mask_ID);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
GimpDrawable *mask);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define _gimp_drawable_get_format __gimp_drawable_get_format
#define _gimp_drawable_get_thumbnail_format __gimp_drawable_get_thumbnail_format
#define gimp_drawable_type _gimp_drawable_type
#define gimp_drawable_type_with_alpha _gimp_drawable_type_with_alpha
#define gimp_drawable_has_alpha _gimp_drawable_has_alpha
#define gimp_drawable_is_rgb _gimp_drawable_is_rgb
#define gimp_drawable_is_gray _gimp_drawable_is_gray
#define gimp_drawable_is_indexed _gimp_drawable_is_indexed
#define gimp_drawable_bpp _gimp_drawable_bpp
#define gimp_drawable_width _gimp_drawable_width
#define gimp_drawable_height _gimp_drawable_height
#define gimp_drawable_offsets _gimp_drawable_offsets
#define gimp_drawable_mask_bounds _gimp_drawable_mask_bounds
#define gimp_drawable_mask_intersect _gimp_drawable_mask_intersect
#define gimp_drawable_merge_shadow _gimp_drawable_merge_shadow
#define gimp_drawable_free_shadow _gimp_drawable_free_shadow
#define gimp_drawable_update _gimp_drawable_update
#define gimp_drawable_get_pixel _gimp_drawable_get_pixel
#define gimp_drawable_set_pixel _gimp_drawable_set_pixel
#define gimp_drawable_fill _gimp_drawable_fill
#define gimp_drawable_offset _gimp_drawable_offset
#define _gimp_drawable_thumbnail __gimp_drawable_thumbnail
#define _gimp_drawable_sub_thumbnail __gimp_drawable_sub_thumbnail
#define gimp_drawable_foreground_extract _gimp_drawable_foreground_extract
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -118,7 +142,77 @@ gboolean gimp_drawable_foreground_extract (gint32
* They are not marked internal as a trick to keep the old API alive for now.
*/
gchar* __gimp_drawable_get_format (gint32 drawable_ID);
gchar* __gimp_drawable_get_thumbnail_format (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);
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_free_shadow (gint32 drawable_ID);
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 *actual_width,
gint *actual_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

File diff suppressed because it is too large Load diff

View file

@ -32,32 +32,36 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_drawable_brightness_contrast (gint32 drawable_ID,
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
gboolean gimp_drawable_brightness_contrast (GimpDrawable *drawable,
gdouble brightness,
gdouble contrast);
gboolean gimp_drawable_color_balance (gint32 drawable_ID,
gboolean gimp_drawable_color_balance (GimpDrawable *drawable,
GimpTransferMode transfer_mode,
gboolean preserve_lum,
gdouble cyan_red,
gdouble magenta_green,
gdouble yellow_blue);
gboolean gimp_drawable_colorize_hsl (gint32 drawable_ID,
gboolean gimp_drawable_colorize_hsl (GimpDrawable *drawable,
gdouble hue,
gdouble saturation,
gdouble lightness);
gboolean gimp_drawable_curves_explicit (gint32 drawable_ID,
gboolean gimp_drawable_curves_explicit (GimpDrawable *drawable,
GimpHistogramChannel channel,
gint num_values,
const gdouble *values);
gboolean gimp_drawable_curves_spline (gint32 drawable_ID,
gboolean gimp_drawable_curves_spline (GimpDrawable *drawable,
GimpHistogramChannel channel,
gint num_points,
const gdouble *points);
gboolean gimp_drawable_desaturate (gint32 drawable_ID,
gboolean gimp_drawable_desaturate (GimpDrawable *drawable,
GimpDesaturateMode desaturate_mode);
gboolean gimp_drawable_equalize (gint32 drawable_ID,
gboolean gimp_drawable_equalize (GimpDrawable *drawable,
gboolean mask_only);
gboolean gimp_drawable_histogram (gint32 drawable_ID,
gboolean gimp_drawable_histogram (GimpDrawable *drawable,
GimpHistogramChannel channel,
gdouble start_range,
gdouble end_range,
@ -67,15 +71,15 @@ gboolean gimp_drawable_histogram (gint32 drawable_ID,
gdouble *pixels,
gdouble *count,
gdouble *percentile);
gboolean gimp_drawable_hue_saturation (gint32 drawable_ID,
gboolean gimp_drawable_hue_saturation (GimpDrawable *drawable,
GimpHueRange hue_range,
gdouble hue_offset,
gdouble lightness,
gdouble saturation,
gdouble overlap);
gboolean gimp_drawable_invert (gint32 drawable_ID,
gboolean gimp_drawable_invert (GimpDrawable *drawable,
gboolean linear);
gboolean gimp_drawable_levels (gint32 drawable_ID,
gboolean gimp_drawable_levels (GimpDrawable *drawable,
GimpHistogramChannel channel,
gdouble low_input,
gdouble high_input,
@ -84,20 +88,30 @@ gboolean gimp_drawable_levels (gint32 drawable_ID,
gdouble low_output,
gdouble high_output,
gboolean clamp_output);
gboolean gimp_drawable_levels_stretch (gint32 drawable_ID);
gboolean gimp_drawable_posterize (gint32 drawable_ID,
gboolean gimp_drawable_levels_stretch (GimpDrawable *drawable);
gboolean gimp_drawable_posterize (GimpDrawable *drawable,
gint levels);
gboolean gimp_drawable_threshold (gint32 drawable_ID,
gboolean gimp_drawable_threshold (GimpDrawable *drawable,
GimpHistogramChannel channel,
gdouble low_threshold,
gdouble high_threshold);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define gimp_drawable_brightness_contrast _gimp_drawable_brightness_contrast
#define gimp_drawable_color_balance _gimp_drawable_color_balance
#define gimp_drawable_colorize_hsl _gimp_drawable_colorize_hsl
#define gimp_drawable_curves_explicit _gimp_drawable_curves_explicit
#define gimp_drawable_curves_spline _gimp_drawable_curves_spline
#define gimp_drawable_desaturate _gimp_drawable_desaturate
#define gimp_drawable_equalize _gimp_drawable_equalize
#define gimp_drawable_histogram _gimp_drawable_histogram
#define gimp_drawable_hue_saturation _gimp_drawable_hue_saturation
#define gimp_drawable_invert _gimp_drawable_invert
#define gimp_drawable_levels _gimp_drawable_levels
#define gimp_drawable_levels_stretch _gimp_drawable_levels_stretch
#define gimp_drawable_posterize _gimp_drawable_posterize
#define gimp_drawable_threshold _gimp_drawable_threshold
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -106,7 +120,65 @@ gboolean gimp_drawable_threshold (gint32 drawable_ID,
* They are not marked internal as a trick to keep the old API alive for now.
*/
gboolean _gimp_drawable_brightness_contrast (gint32 drawable_ID,
gdouble brightness,
gdouble contrast);
gboolean _gimp_drawable_color_balance (gint32 drawable_ID,
GimpTransferMode transfer_mode,
gboolean preserve_lum,
gdouble cyan_red,
gdouble magenta_green,
gdouble yellow_blue);
gboolean _gimp_drawable_colorize_hsl (gint32 drawable_ID,
gdouble hue,
gdouble saturation,
gdouble lightness);
gboolean _gimp_drawable_curves_explicit (gint32 drawable_ID,
GimpHistogramChannel channel,
gint num_values,
const gdouble *values);
gboolean _gimp_drawable_curves_spline (gint32 drawable_ID,
GimpHistogramChannel channel,
gint num_points,
const gdouble *points);
gboolean _gimp_drawable_desaturate (gint32 drawable_ID,
GimpDesaturateMode desaturate_mode);
gboolean _gimp_drawable_equalize (gint32 drawable_ID,
gboolean mask_only);
gboolean _gimp_drawable_histogram (gint32 drawable_ID,
GimpHistogramChannel channel,
gdouble start_range,
gdouble end_range,
gdouble *mean,
gdouble *std_dev,
gdouble *median,
gdouble *pixels,
gdouble *count,
gdouble *percentile);
gboolean _gimp_drawable_hue_saturation (gint32 drawable_ID,
GimpHueRange hue_range,
gdouble hue_offset,
gdouble lightness,
gdouble saturation,
gdouble overlap);
gboolean _gimp_drawable_invert (gint32 drawable_ID,
gboolean linear);
gboolean _gimp_drawable_levels (gint32 drawable_ID,
GimpHistogramChannel channel,
gdouble low_input,
gdouble high_input,
gboolean clamp_input,
gdouble gamma,
gdouble low_output,
gdouble high_output,
gboolean clamp_output);
gboolean _gimp_drawable_levels_stretch (gint32 drawable_ID);
gboolean _gimp_drawable_posterize (gint32 drawable_ID,
gint levels);
gboolean _gimp_drawable_threshold (gint32 drawable_ID,
GimpHistogramChannel channel,
gdouble low_threshold,
gdouble high_threshold);
G_END_DECLS

View file

@ -36,6 +36,51 @@
/**
* gimp_drawable_edit_clear:
* @drawable: The drawable to clear from.
*
* Clear selected area of drawable.
*
* This procedure clears the specified drawable. If the drawable has an
* alpha channel, the cleared pixels will become transparent. If the
* drawable does not have an alpha channel, cleared pixels will be set
* to the background color. This procedure only affects regions within
* a selection if there is a selection active.
*
* This procedure is affected by the following context setters:
* gimp_context_set_background().
*
* Returns: TRUE on success.
**/
gboolean
gimp_drawable_edit_clear (GimpDrawable *drawable)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-drawable-edit-clear",
args);
else
return_vals = gimp_run_procedure_array ("gimp-drawable-edit-clear",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
/**
* _gimp_drawable_edit_clear: (skip)
* @drawable_ID: The drawable to clear from.
*
* Clear selected area of drawable.
@ -52,7 +97,7 @@
* Returns: TRUE on success.
**/
gboolean
gimp_drawable_edit_clear (gint32 drawable_ID)
_gimp_drawable_edit_clear (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -81,6 +126,55 @@ gimp_drawable_edit_clear (gint32 drawable_ID)
/**
* gimp_drawable_edit_fill:
* @drawable: The drawable to fill to.
* @fill_type: The type of fill.
*
* Fill selected area of drawable.
*
* This procedure fills the specified drawable according to fill mode.
* This procedure only affects regions within a selection if there is a
* selection active. If you want to fill the whole drawable, regardless
* of the selection, use gimp_drawable_fill().
*
* This procedure is affected by the following context setters:
* gimp_context_set_opacity(), gimp_context_set_paint_mode(),
* gimp_context_set_foreground(), gimp_context_set_background(),
* gimp_context_set_pattern().
*
* Returns: TRUE on success.
**/
gboolean
gimp_drawable_edit_fill (GimpDrawable *drawable,
GimpFillType fill_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
GIMP_TYPE_FILL_TYPE, fill_type,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-drawable-edit-fill",
args);
else
return_vals = gimp_run_procedure_array ("gimp-drawable-edit-fill",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
/**
* _gimp_drawable_edit_fill: (skip)
* @drawable_ID: The drawable to fill to.
* @fill_type: The type of fill.
*
@ -99,8 +193,8 @@ gimp_drawable_edit_clear (gint32 drawable_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_drawable_edit_fill (gint32 drawable_ID,
GimpFillType fill_type)
_gimp_drawable_edit_fill (gint32 drawable_ID,
GimpFillType fill_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -130,6 +224,67 @@ gimp_drawable_edit_fill (gint32 drawable_ID,
/**
* gimp_drawable_edit_bucket_fill:
* @drawable: The affected drawable.
* @fill_type: The type of fill.
* @x: The x coordinate of this bucket fill's application.
* @y: The y coordinate of this bucket fill's application.
*
* Fill the area by a seed fill starting at the specified coordinates.
*
* This procedure does a seed fill at the specified coordinates, using
* various parameters from the current context.
* In the case of merged sampling, the x and y coordinates are relative
* to the image's origin; otherwise, they are relative to the
* drawable's origin.
*
* This procedure is affected by the following context setters:
* gimp_context_set_opacity(), gimp_context_set_paint_mode(),
* gimp_context_set_foreground(), gimp_context_set_background(),
* gimp_context_set_pattern(), gimp_context_set_sample_threshold(),
* gimp_context_set_sample_merged(),
* gimp_context_set_sample_criterion(),
* gimp_context_set_diagonal_neighbors(), gimp_context_set_antialias().
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_drawable_edit_bucket_fill (GimpDrawable *drawable,
GimpFillType fill_type,
gdouble x,
gdouble y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
GIMP_TYPE_FILL_TYPE, fill_type,
G_TYPE_DOUBLE, x,
G_TYPE_DOUBLE, y,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-drawable-edit-bucket-fill",
args);
else
return_vals = gimp_run_procedure_array ("gimp-drawable-edit-bucket-fill",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
/**
* _gimp_drawable_edit_bucket_fill: (skip)
* @drawable_ID: The affected drawable.
* @fill_type: The type of fill.
* @x: The x coordinate of this bucket fill's application.
@ -156,10 +311,10 @@ gimp_drawable_edit_fill (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
GimpFillType fill_type,
gdouble x,
gdouble y)
_gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
GimpFillType fill_type,
gdouble x,
gdouble y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -191,6 +346,87 @@ gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
/**
* gimp_drawable_edit_gradient_fill:
* @drawable: The affected drawable.
* @gradient_type: The type of gradient.
* @offset: Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.
* @supersample: Do adaptive supersampling.
* @supersample_max_depth: Maximum recursion levels for supersampling.
* @supersample_threshold: Supersampling threshold.
* @dither: Use dithering to reduce banding.
* @x1: The x coordinate of this gradient's starting point.
* @y1: The y coordinate of this gradient's starting point.
* @x2: The x coordinate of this gradient's ending point.
* @y2: The y coordinate of this gradient's ending point.
*
* Draw a gradient between the starting and ending coordinates with the
* specified gradient type.
*
* This tool requires information on the gradient type. It creates the
* specified variety of gradient using the starting and ending
* coordinates as defined for each gradient type. For shapeburst
* gradient types, the context's distance metric is also relevant and
* can be updated with gimp_context_set_distance_metric().
*
* This procedure is affected by the following context setters:
* gimp_context_set_opacity(), gimp_context_set_paint_mode(),
* gimp_context_set_foreground(), gimp_context_set_background(),
* gimp_context_set_gradient() and all gradient property settings,
* gimp_context_set_distance_metric().
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_drawable_edit_gradient_fill (GimpDrawable *drawable,
GimpGradientType gradient_type,
gdouble offset,
gboolean supersample,
gint supersample_max_depth,
gdouble supersample_threshold,
gboolean dither,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
GIMP_TYPE_GRADIENT_TYPE, gradient_type,
G_TYPE_DOUBLE, offset,
G_TYPE_BOOLEAN, supersample,
G_TYPE_INT, supersample_max_depth,
G_TYPE_DOUBLE, supersample_threshold,
G_TYPE_BOOLEAN, dither,
G_TYPE_DOUBLE, x1,
G_TYPE_DOUBLE, y1,
G_TYPE_DOUBLE, x2,
G_TYPE_DOUBLE, y2,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-drawable-edit-gradient-fill",
args);
else
return_vals = gimp_run_procedure_array ("gimp-drawable-edit-gradient-fill",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
/**
* _gimp_drawable_edit_gradient_fill: (skip)
* @drawable_ID: The affected drawable.
* @gradient_type: The type of gradient.
* @offset: Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.
@ -223,17 +459,17 @@ gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
GimpGradientType gradient_type,
gdouble offset,
gboolean supersample,
gint supersample_max_depth,
gdouble supersample_threshold,
gboolean dither,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2)
_gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
GimpGradientType gradient_type,
gdouble offset,
gboolean supersample,
gint supersample_max_depth,
gdouble supersample_threshold,
gboolean dither,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -272,6 +508,55 @@ gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
/**
* gimp_drawable_edit_stroke_selection:
* @drawable: The drawable to stroke to.
*
* Stroke the current selection
*
* This procedure strokes the current selection, painting along the
* selection boundary with the active paint method and brush, or using
* a plain line with configurable properties. The paint is applied to
* the specified drawable regardless of the active selection.
*
* This procedure is affected by the following context setters:
* gimp_context_set_opacity(), gimp_context_set_paint_mode(),
* gimp_context_set_paint_method(), gimp_context_set_stroke_method(),
* gimp_context_set_foreground(), gimp_context_set_brush() and all
* brush property settings, gimp_context_set_gradient() and all
* gradient property settings, gimp_context_set_line_width() and all
* line property settings, gimp_context_set_antialias().
*
* Returns: TRUE on success.
**/
gboolean
gimp_drawable_edit_stroke_selection (GimpDrawable *drawable)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-drawable-edit-stroke-selection",
args);
else
return_vals = gimp_run_procedure_array ("gimp-drawable-edit-stroke-selection",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
/**
* _gimp_drawable_edit_stroke_selection: (skip)
* @drawable_ID: The drawable to stroke to.
*
* Stroke the current selection
@ -292,7 +577,7 @@ gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
* Returns: TRUE on success.
**/
gboolean
gimp_drawable_edit_stroke_selection (gint32 drawable_ID)
_gimp_drawable_edit_stroke_selection (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -321,6 +606,60 @@ gimp_drawable_edit_stroke_selection (gint32 drawable_ID)
/**
* gimp_drawable_edit_stroke_item:
* @drawable: The drawable to stroke to.
* @item: The item to stroke.
*
* Stroke the specified item
*
* This procedure strokes the specified item, painting along its
* outline (e.g. along a path, or along a channel's boundary), with the
* active paint method and brush, or using a plain line with
* configurable properties.
*
* This procedure is affected by the following context setters:
* gimp_context_set_opacity(), gimp_context_set_paint_mode(),
* gimp_context_set_paint_method(), gimp_context_set_stroke_method(),
* gimp_context_set_foreground(), gimp_context_set_brush() and all
* brush property settings, gimp_context_set_gradient() and all
* gradient property settings, gimp_context_set_line_width() and all
* line property settings, gimp_context_set_antialias().
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_drawable_edit_stroke_item (GimpDrawable *drawable,
GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-drawable-edit-stroke-item",
args);
else
return_vals = gimp_run_procedure_array ("gimp-drawable-edit-stroke-item",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
/**
* _gimp_drawable_edit_stroke_item: (skip)
* @drawable_ID: The drawable to stroke to.
* @item_ID: The item to stroke.
*
@ -344,8 +683,8 @@ gimp_drawable_edit_stroke_selection (gint32 drawable_ID)
* Since: 2.10
**/
gboolean
gimp_drawable_edit_stroke_item (gint32 drawable_ID,
gint32 item_ID)
_gimp_drawable_edit_stroke_item (gint32 drawable_ID,
gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;

View file

@ -32,34 +32,40 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_drawable_edit_clear (gint32 drawable_ID);
gboolean gimp_drawable_edit_fill (gint32 drawable_ID,
GimpFillType fill_type);
gboolean gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
GimpFillType fill_type,
gdouble x,
gdouble y);
gboolean gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
GimpGradientType gradient_type,
gdouble offset,
gboolean supersample,
gint supersample_max_depth,
gdouble supersample_threshold,
gboolean dither,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
gboolean gimp_drawable_edit_stroke_selection (gint32 drawable_ID);
gboolean gimp_drawable_edit_stroke_item (gint32 drawable_ID,
gint32 item_ID);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
gboolean gimp_drawable_edit_clear (GimpDrawable *drawable);
gboolean gimp_drawable_edit_fill (GimpDrawable *drawable,
GimpFillType fill_type);
gboolean gimp_drawable_edit_bucket_fill (GimpDrawable *drawable,
GimpFillType fill_type,
gdouble x,
gdouble y);
gboolean gimp_drawable_edit_gradient_fill (GimpDrawable *drawable,
GimpGradientType gradient_type,
gdouble offset,
gboolean supersample,
gint supersample_max_depth,
gdouble supersample_threshold,
gboolean dither,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
gboolean gimp_drawable_edit_stroke_selection (GimpDrawable *drawable);
gboolean gimp_drawable_edit_stroke_item (GimpDrawable *drawable,
GimpItem *item);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define gimp_drawable_edit_clear _gimp_drawable_edit_clear
#define gimp_drawable_edit_fill _gimp_drawable_edit_fill
#define gimp_drawable_edit_bucket_fill _gimp_drawable_edit_bucket_fill
#define gimp_drawable_edit_gradient_fill _gimp_drawable_edit_gradient_fill
#define gimp_drawable_edit_stroke_selection _gimp_drawable_edit_stroke_selection
#define gimp_drawable_edit_stroke_item _gimp_drawable_edit_stroke_item
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -68,7 +74,27 @@ gboolean gimp_drawable_edit_stroke_item (gint32 drawable_ID,
* They are not marked internal as a trick to keep the old API alive for now.
*/
gboolean _gimp_drawable_edit_clear (gint32 drawable_ID);
gboolean _gimp_drawable_edit_fill (gint32 drawable_ID,
GimpFillType fill_type);
gboolean _gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
GimpFillType fill_type,
gdouble x,
gdouble y);
gboolean _gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
GimpGradientType gradient_type,
gdouble offset,
gboolean supersample,
gint supersample_max_depth,
gdouble supersample_threshold,
gboolean dither,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
gboolean _gimp_drawable_edit_stroke_selection (gint32 drawable_ID);
gboolean _gimp_drawable_edit_stroke_item (gint32 drawable_ID,
gint32 item_ID);
G_END_DECLS

View file

@ -36,6 +36,52 @@
/**
* gimp_edit_cut:
* @drawable: The drawable to cut from.
*
* Cut from the specified drawable.
*
* If there is a selection in the image, then the area specified by the
* selection is cut from the specified drawable and placed in an
* internal GIMP edit buffer. It can subsequently be retrieved using
* the gimp_edit_paste() command. If there is no selection, then the
* specified drawable will be removed and its contents stored in the
* internal GIMP edit buffer. This procedure will fail if the selected
* area lies completely outside the bounds of the current drawable and
* there is nothing to copy from.
*
* Returns: TRUE if the cut was successful, FALSE if there was nothing to copy from.
**/
gboolean
gimp_edit_cut (GimpDrawable *drawable)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean non_empty = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-edit-cut",
args);
else
return_vals = gimp_run_procedure_array ("gimp-edit-cut",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return non_empty;
}
/**
* _gimp_edit_cut: (skip)
* @drawable_ID: The drawable to cut from.
*
* Cut from the specified drawable.
@ -52,7 +98,7 @@
* Returns: TRUE if the cut was successful, FALSE if there was nothing to copy from.
**/
gboolean
gimp_edit_cut (gint32 drawable_ID)
_gimp_edit_cut (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -82,6 +128,52 @@ gimp_edit_cut (gint32 drawable_ID)
/**
* gimp_edit_copy:
* @drawable: The drawable to copy from.
*
* Copy from the specified drawable.
*
* If there is a selection in the image, then the area specified by the
* selection is copied from the specified drawable and placed in an
* internal GIMP edit buffer. It can subsequently be retrieved using
* the gimp_edit_paste() command. If there is no selection, then the
* specified drawable's contents will be stored in the internal GIMP
* edit buffer. This procedure will fail if the selected area lies
* completely outside the bounds of the current drawable and there is
* nothing to copy from.
*
* Returns: TRUE if the cut was successful, FALSE if there was nothing to copy from.
**/
gboolean
gimp_edit_copy (GimpDrawable *drawable)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean non_empty = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-edit-copy",
args);
else
return_vals = gimp_run_procedure_array ("gimp-edit-copy",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return non_empty;
}
/**
* _gimp_edit_copy: (skip)
* @drawable_ID: The drawable to copy from.
*
* Copy from the specified drawable.
@ -98,7 +190,7 @@ gimp_edit_cut (gint32 drawable_ID)
* Returns: TRUE if the cut was successful, FALSE if there was nothing to copy from.
**/
gboolean
gimp_edit_copy (gint32 drawable_ID)
_gimp_edit_copy (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -220,6 +312,62 @@ _gimp_edit_copy_visible (gint32 image_ID)
/**
* gimp_edit_paste:
* @drawable: The drawable to paste to.
* @paste_into: Clear selection, or paste behind it?
*
* Paste buffer to the specified drawable.
*
* This procedure pastes a copy of the internal GIMP edit buffer to the
* specified drawable. The GIMP edit buffer will be empty unless a call
* was previously made to either gimp_edit_cut() or gimp_edit_copy().
* The \"paste_into\" option specifies whether to clear the current
* image selection, or to paste the buffer \"behind\" the selection.
* This allows the selection to act as a mask for the pasted buffer.
* Anywhere that the selection mask is non-zero, the pasted buffer will
* show through. The pasted buffer will be a new layer in the image
* which is designated as the image floating selection. If the image
* has a floating selection at the time of pasting, the old floating
* selection will be anchored to its drawable before the new floating
* selection is added. This procedure returns the new floating layer.
* The resulting floating selection will already be attached to the
* specified drawable, and a subsequent call to floating_sel_attach is
* not needed.
*
* Returns: (transfer full): The new floating selection.
**/
GimpLayer *
gimp_edit_paste (GimpDrawable *drawable,
gboolean paste_into)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpLayer *floating_sel = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_BOOLEAN, paste_into,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-edit-paste",
args);
else
return_vals = gimp_run_procedure_array ("gimp-edit-paste",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
floating_sel = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return floating_sel;
}
/**
* _gimp_edit_paste: (skip)
* @drawable_ID: The drawable to paste to.
* @paste_into: Clear selection, or paste behind it?
*
@ -244,8 +392,8 @@ _gimp_edit_copy_visible (gint32 image_ID)
* Returns: The new floating selection.
**/
gint32
gimp_edit_paste (gint32 drawable_ID,
gboolean paste_into)
_gimp_edit_paste (gint32 drawable_ID,
gboolean paste_into)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -360,7 +508,7 @@ _gimp_edit_paste_as_new_image (void)
/**
* gimp_edit_named_cut:
* @drawable_ID: The drawable to cut from.
* @drawable: The drawable to cut from.
* @buffer_name: The name of the buffer to create.
*
* Cut into a named buffer.
@ -377,8 +525,56 @@ _gimp_edit_paste_as_new_image (void)
* Since: 2.4
**/
gchar *
gimp_edit_named_cut (gint32 drawable_ID,
const gchar *buffer_name)
gimp_edit_named_cut (GimpDrawable *drawable,
const gchar *buffer_name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gchar *real_name = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_STRING, buffer_name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-edit-named-cut",
args);
else
return_vals = gimp_run_procedure_array ("gimp-edit-named-cut",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
real_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return real_name;
}
/**
* _gimp_edit_named_cut: (skip)
* @drawable_ID: The drawable to cut from.
* @buffer_name: The name of the buffer to create.
*
* Cut into a named buffer.
*
* This procedure works like gimp_edit_cut(), but additionally stores
* the cut buffer into a named buffer that will stay available for
* later pasting, regardless of any intermediate copy or cut
* operations.
*
* Returns: The real name given to the buffer, or NULL if the cut failed.
* The returned value must be freed with g_free().
*
* Since: 2.4
**/
gchar *
_gimp_edit_named_cut (gint32 drawable_ID,
const gchar *buffer_name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -409,7 +605,7 @@ gimp_edit_named_cut (gint32 drawable_ID,
/**
* gimp_edit_named_copy:
* @drawable_ID: The drawable to copy from.
* @drawable: The drawable to copy from.
* @buffer_name: The name of the buffer to create.
*
* Copy into a named buffer.
@ -426,8 +622,56 @@ gimp_edit_named_cut (gint32 drawable_ID,
* Since: 2.4
**/
gchar *
gimp_edit_named_copy (gint32 drawable_ID,
const gchar *buffer_name)
gimp_edit_named_copy (GimpDrawable *drawable,
const gchar *buffer_name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gchar *real_name = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_STRING, buffer_name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-edit-named-copy",
args);
else
return_vals = gimp_run_procedure_array ("gimp-edit-named-copy",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
real_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return real_name;
}
/**
* _gimp_edit_named_copy: (skip)
* @drawable_ID: The drawable to copy from.
* @buffer_name: The name of the buffer to create.
*
* Copy into a named buffer.
*
* This procedure works like gimp_edit_copy(), but additionally stores
* the copied buffer into a named buffer that will stay available for
* later pasting, regardless of any intermediate copy or cut
* operations.
*
* Returns: The real name given to the buffer, or NULL if the copy failed.
* The returned value must be freed with g_free().
*
* Since: 2.4
**/
gchar *
_gimp_edit_named_copy (gint32 drawable_ID,
const gchar *buffer_name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -555,6 +799,54 @@ _gimp_edit_named_copy_visible (gint32 image_ID,
/**
* gimp_edit_named_paste:
* @drawable: The drawable to paste to.
* @buffer_name: The name of the buffer to paste.
* @paste_into: Clear selection, or paste behind it?
*
* Paste named buffer to the specified drawable.
*
* This procedure works like gimp_edit_paste() but pastes a named
* buffer instead of the global buffer.
*
* Returns: (transfer full): The new floating selection.
*
* Since: 2.4
**/
GimpLayer *
gimp_edit_named_paste (GimpDrawable *drawable,
const gchar *buffer_name,
gboolean paste_into)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpLayer *floating_sel = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_STRING, buffer_name,
G_TYPE_BOOLEAN, paste_into,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-edit-named-paste",
args);
else
return_vals = gimp_run_procedure_array ("gimp-edit-named-paste",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
floating_sel = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return floating_sel;
}
/**
* _gimp_edit_named_paste: (skip)
* @drawable_ID: The drawable to paste to.
* @buffer_name: The name of the buffer to paste.
* @paste_into: Clear selection, or paste behind it?
@ -569,9 +861,9 @@ _gimp_edit_named_copy_visible (gint32 image_ID,
* Since: 2.4
**/
gint32
gimp_edit_named_paste (gint32 drawable_ID,
const gchar *buffer_name,
gboolean paste_into)
_gimp_edit_named_paste (gint32 drawable_ID,
const gchar *buffer_name,
gboolean paste_into)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;

View file

@ -32,31 +32,38 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_edit_cut (gint32 drawable_ID);
gboolean gimp_edit_copy (gint32 drawable_ID);
gint32 gimp_edit_paste (gint32 drawable_ID,
gboolean paste_into);
gchar* gimp_edit_named_cut (gint32 drawable_ID,
const gchar *buffer_name);
gchar* gimp_edit_named_copy (gint32 drawable_ID,
const gchar *buffer_name);
gint32 gimp_edit_named_paste (gint32 drawable_ID,
const gchar *buffer_name,
gboolean paste_into);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
gboolean gimp_edit_copy_visible (GimpImage *image);
gboolean gimp_edit_cut (GimpDrawable *drawable);
gboolean gimp_edit_copy (GimpDrawable *drawable);
gboolean gimp_edit_copy_visible (GimpImage *image);
GimpLayer* gimp_edit_paste (GimpDrawable *drawable,
gboolean paste_into);
GimpImage* gimp_edit_paste_as_new_image (void);
gchar* gimp_edit_named_copy_visible (GimpImage *image,
const gchar *buffer_name);
GimpImage* gimp_edit_named_paste_as_new_image (const gchar *buffer_name);
gchar* gimp_edit_named_cut (GimpDrawable *drawable,
const gchar *buffer_name);
gchar* gimp_edit_named_copy (GimpDrawable *drawable,
const gchar *buffer_name);
gchar* gimp_edit_named_copy_visible (GimpImage *image,
const gchar *buffer_name);
GimpLayer* gimp_edit_named_paste (GimpDrawable *drawable,
const gchar *buffer_name,
gboolean paste_into);
GimpImage* gimp_edit_named_paste_as_new_image (const gchar *buffer_name);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define gimp_edit_cut _gimp_edit_cut
#define gimp_edit_copy _gimp_edit_copy
#define gimp_edit_copy_visible _gimp_edit_copy_visible
#define gimp_edit_paste _gimp_edit_paste
#define gimp_edit_paste_as_new_image _gimp_edit_paste_as_new_image
#define gimp_edit_named_cut _gimp_edit_named_cut
#define gimp_edit_named_copy _gimp_edit_named_copy
#define gimp_edit_named_copy_visible _gimp_edit_named_copy_visible
#define gimp_edit_named_paste _gimp_edit_named_paste
#define gimp_edit_named_paste_as_new_image _gimp_edit_named_paste_as_new_image
@ -66,10 +73,21 @@ GimpImage* gimp_edit_named_paste_as_new_image (const gchar *buffer_name);
* They are not marked internal as a trick to keep the old API alive for now.
*/
gboolean _gimp_edit_cut (gint32 drawable_ID);
gboolean _gimp_edit_copy (gint32 drawable_ID);
gboolean _gimp_edit_copy_visible (gint32 image_ID);
gint32 _gimp_edit_paste (gint32 drawable_ID,
gboolean paste_into);
gint32 _gimp_edit_paste_as_new_image (void);
gchar* _gimp_edit_named_cut (gint32 drawable_ID,
const gchar *buffer_name);
gchar* _gimp_edit_named_copy (gint32 drawable_ID,
const gchar *buffer_name);
gchar* _gimp_edit_named_copy_visible (gint32 image_ID,
const gchar *buffer_name);
gint32 _gimp_edit_named_paste (gint32 drawable_ID,
const gchar *buffer_name,
gboolean paste_into);
gint32 _gimp_edit_named_paste_as_new_image (const gchar *buffer_name);

View file

@ -149,11 +149,11 @@ _gimp_file_load (GimpRunMode run_mode,
* needs to be added to the existing image with
* gimp_image_insert_layer().
*
* Returns: The layer created when loading the image file.
* Returns: (transfer full): The layer created when loading the image file.
*
* Since: 2.4
**/
gint32
GimpLayer *
gimp_file_load_layer (GimpRunMode run_mode,
GimpImage *image,
const gchar *filename)
@ -161,7 +161,7 @@ gimp_file_load_layer (GimpRunMode run_mode,
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_ID = -1;
GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_RUN_MODE, run_mode,
@ -179,11 +179,11 @@ gimp_file_load_layer (GimpRunMode run_mode,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return layer_ID;
return layer;
}
/**
@ -357,7 +357,7 @@ _gimp_file_load_layers (GimpRunMode run_mode,
* gimp_file_save:
* @run_mode: The run mode.
* @image: Input image.
* @drawable_ID: Drawable to save.
* @drawable: Drawable to save.
* @filename: The name of the file to save the image in.
* @raw_filename: The name as entered by the user.
*
@ -374,11 +374,11 @@ _gimp_file_load_layers (GimpRunMode run_mode,
* Returns: TRUE on success.
**/
gboolean
gimp_file_save (GimpRunMode run_mode,
GimpImage *image,
gint32 drawable_ID,
const gchar *filename,
const gchar *raw_filename)
gimp_file_save (GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
const gchar *filename,
const gchar *raw_filename)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -388,7 +388,7 @@ gimp_file_save (GimpRunMode run_mode,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_RUN_MODE, run_mode,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_STRING, filename,
G_TYPE_STRING, raw_filename,
G_TYPE_NONE);

View file

@ -53,23 +53,23 @@ G_GNUC_INTERNAL gboolean _gimp_register_thumbnail_loader (const gchar *load
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
GimpImage* gimp_file_load (GimpRunMode run_mode,
const gchar *filename,
const gchar *raw_filename);
gint32 gimp_file_load_layer (GimpRunMode run_mode,
GimpImage *image,
const gchar *filename);
gint* gimp_file_load_layers (GimpRunMode run_mode,
GimpImage *image,
const gchar *filename,
gint *num_layers);
gboolean gimp_file_save (GimpRunMode run_mode,
GimpImage *image,
gint32 drawable_ID,
const gchar *filename,
const gchar *raw_filename);
gboolean gimp_file_save_thumbnail (GimpImage *image,
const gchar *filename);
GimpImage* gimp_file_load (GimpRunMode run_mode,
const gchar *filename,
const gchar *raw_filename);
GimpLayer* gimp_file_load_layer (GimpRunMode run_mode,
GimpImage *image,
const gchar *filename);
gint* gimp_file_load_layers (GimpRunMode run_mode,
GimpImage *image,
const gchar *filename,
gint *num_layers);
gboolean gimp_file_save (GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
const gchar *filename,
const gchar *raw_filename);
gboolean gimp_file_save_thumbnail (GimpImage *image,
const gchar *filename);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */

View file

@ -36,6 +36,46 @@
/**
* gimp_floating_sel_remove:
* @floating_sel: The floating selection.
*
* Remove the specified floating selection from its associated
* drawable.
*
* This procedure removes the floating selection completely, without
* any side effects. The associated drawable is then set to active.
*
* Returns: TRUE on success.
**/
gboolean
gimp_floating_sel_remove (GimpLayer *floating_sel)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (floating_sel)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-floating-sel-remove",
args);
else
return_vals = gimp_run_procedure_array ("gimp-floating-sel-remove",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
/**
* _gimp_floating_sel_remove: (skip)
* @floating_sel_ID: The floating selection.
*
* Remove the specified floating selection from its associated
@ -47,7 +87,7 @@
* Returns: TRUE on success.
**/
gboolean
gimp_floating_sel_remove (gint32 floating_sel_ID)
_gimp_floating_sel_remove (gint32 floating_sel_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -76,6 +116,47 @@ gimp_floating_sel_remove (gint32 floating_sel_ID)
/**
* gimp_floating_sel_anchor:
* @floating_sel: The floating selection.
*
* Anchor the specified floating selection to its associated drawable.
*
* This procedure anchors the floating selection to its associated
* drawable. This is similar to merging with a merge type of
* ClipToBottomLayer. The floating selection layer is no longer valid
* after this operation.
*
* Returns: TRUE on success.
**/
gboolean
gimp_floating_sel_anchor (GimpLayer *floating_sel)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (floating_sel)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-floating-sel-anchor",
args);
else
return_vals = gimp_run_procedure_array ("gimp-floating-sel-anchor",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
/**
* _gimp_floating_sel_anchor: (skip)
* @floating_sel_ID: The floating selection.
*
* Anchor the specified floating selection to its associated drawable.
@ -88,7 +169,7 @@ gimp_floating_sel_remove (gint32 floating_sel_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_floating_sel_anchor (gint32 floating_sel_ID)
_gimp_floating_sel_anchor (gint32 floating_sel_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -117,6 +198,51 @@ gimp_floating_sel_anchor (gint32 floating_sel_ID)
/**
* gimp_floating_sel_to_layer:
* @floating_sel: The floating selection.
*
* Transforms the specified floating selection into a layer.
*
* This procedure transforms the specified floating selection into a
* layer with the same offsets and extents. The composited image will
* look precisely the same, but the floating selection layer will no
* longer be clipped to the extents of the drawable it was attached to.
* The floating selection will become the active layer. This procedure
* will not work if the floating selection has a different base type
* from the underlying image. This might be the case if the floating
* selection is above an auxiliary channel or a layer mask.
*
* Returns: TRUE on success.
**/
gboolean
gimp_floating_sel_to_layer (GimpLayer *floating_sel)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (floating_sel)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-floating-sel-to-layer",
args);
else
return_vals = gimp_run_procedure_array ("gimp-floating-sel-to-layer",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
/**
* _gimp_floating_sel_to_layer: (skip)
* @floating_sel_ID: The floating selection.
*
* Transforms the specified floating selection into a layer.
@ -133,7 +259,7 @@ gimp_floating_sel_anchor (gint32 floating_sel_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_floating_sel_to_layer (gint32 floating_sel_ID)
_gimp_floating_sel_to_layer (gint32 floating_sel_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -162,6 +288,48 @@ gimp_floating_sel_to_layer (gint32 floating_sel_ID)
/**
* gimp_floating_sel_attach:
* @layer: The layer (is attached as floating selection).
* @drawable: The drawable (where to attach the floating selection).
*
* Attach the specified layer as floating to the specified drawable.
*
* This procedure attaches the layer as floating selection to the
* drawable.
*
* Returns: TRUE on success.
**/
gboolean
gimp_floating_sel_attach (GimpLayer *layer,
GimpDrawable *drawable)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-floating-sel-attach",
args);
else
return_vals = gimp_run_procedure_array ("gimp-floating-sel-attach",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
/**
* _gimp_floating_sel_attach: (skip)
* @layer_ID: The layer (is attached as floating selection).
* @drawable_ID: The drawable (where to attach the floating selection).
*
@ -173,8 +341,8 @@ gimp_floating_sel_to_layer (gint32 floating_sel_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_floating_sel_attach (gint32 layer_ID,
gint32 drawable_ID)
_gimp_floating_sel_attach (gint32 layer_ID,
gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;

View file

@ -32,18 +32,22 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_floating_sel_remove (gint32 floating_sel_ID);
gboolean gimp_floating_sel_anchor (gint32 floating_sel_ID);
gboolean gimp_floating_sel_to_layer (gint32 floating_sel_ID);
gboolean gimp_floating_sel_attach (gint32 layer_ID,
gint32 drawable_ID);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
gboolean gimp_floating_sel_remove (GimpLayer *floating_sel);
gboolean gimp_floating_sel_anchor (GimpLayer *floating_sel);
gboolean gimp_floating_sel_to_layer (GimpLayer *floating_sel);
gboolean gimp_floating_sel_attach (GimpLayer *layer,
GimpDrawable *drawable);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define gimp_floating_sel_remove _gimp_floating_sel_remove
#define gimp_floating_sel_anchor _gimp_floating_sel_anchor
#define gimp_floating_sel_to_layer _gimp_floating_sel_to_layer
#define gimp_floating_sel_attach _gimp_floating_sel_attach
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -52,7 +56,11 @@ gboolean gimp_floating_sel_attach (gint32 layer_ID,
* They are not marked internal as a trick to keep the old API alive for now.
*/
gboolean _gimp_floating_sel_remove (gint32 floating_sel_ID);
gboolean _gimp_floating_sel_anchor (gint32 floating_sel_ID);
gboolean _gimp_floating_sel_to_layer (gint32 floating_sel_ID);
gboolean _gimp_floating_sel_attach (gint32 layer_ID,
gint32 drawable_ID);
G_END_DECLS

View file

@ -1267,15 +1267,15 @@ _gimp_image_get_vectors (gint32 image_ID,
* layer mask and the layer mask is in edit mode, then the layer mask
* is the active drawable.
*
* Returns: The active drawable.
* Returns: (transfer full): The active drawable.
**/
gint32
GimpDrawable *
gimp_image_get_active_drawable (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 drawable_ID = -1;
GimpDrawable *drawable = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -1291,11 +1291,11 @@ gimp_image_get_active_drawable (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
drawable_ID = gimp_value_get_drawable_id (gimp_value_array_index (return_vals, 1));
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (gimp_value_get_drawable_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return drawable_ID;
return drawable;
}
/**
@ -1433,15 +1433,15 @@ _gimp_image_unset_active_channel (gint32 image_ID)
* This procedure returns the image's floating selection, if it exists.
* If it doesn't exist, -1 is returned as the layer ID.
*
* Returns: The image's floating selection.
* Returns: (transfer full): The image's floating selection.
**/
gint32
GimpLayer *
gimp_image_get_floating_sel (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 floating_sel_ID = -1;
GimpLayer *floating_sel = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -1457,11 +1457,11 @@ gimp_image_get_floating_sel (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
floating_sel_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
floating_sel = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return floating_sel_ID;
return floating_sel;
}
/**
@ -1514,15 +1514,16 @@ _gimp_image_get_floating_sel (gint32 image_ID)
* is attached to, if it exists. If it doesn't exist, -1 is returned as
* the drawable ID.
*
* Returns: The drawable the floating selection is attached to.
* Returns: (transfer full):
* The drawable the floating selection is attached to.
**/
gint32
GimpDrawable *
gimp_image_floating_sel_attached_to (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 drawable_ID = -1;
GimpDrawable *drawable = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -1538,11 +1539,11 @@ gimp_image_floating_sel_attached_to (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
drawable_ID = gimp_value_get_drawable_id (gimp_value_array_index (return_vals, 1));
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (gimp_value_get_drawable_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return drawable_ID;
return drawable;
}
/**
@ -1589,7 +1590,7 @@ _gimp_image_floating_sel_attached_to (gint32 image_ID)
/**
* gimp_image_pick_color:
* @image: The image.
* @drawable_ID: The drawable to pick from.
* @drawable: The drawable to pick from.
* @x: x coordinate of upper-left corner of rectangle.
* @y: y coordinate of upper-left corner of rectangle.
* @sample_merged: Use the composite image, not the drawable.
@ -1614,14 +1615,14 @@ _gimp_image_floating_sel_attached_to (gint32 image_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_image_pick_color (GimpImage *image,
gint32 drawable_ID,
gdouble x,
gdouble y,
gboolean sample_merged,
gboolean sample_average,
gdouble average_radius,
GimpRGB *color)
gimp_image_pick_color (GimpImage *image,
GimpDrawable *drawable,
gdouble x,
gdouble y,
gboolean sample_merged,
gboolean sample_average,
gdouble average_radius,
GimpRGB *color)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -1630,7 +1631,7 @@ gimp_image_pick_color (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_DOUBLE, x,
G_TYPE_DOUBLE, y,
G_TYPE_BOOLEAN, sample_merged,
@ -1742,9 +1743,9 @@ _gimp_image_pick_color (gint32 image_ID,
* at the specified coordinates. This procedure will return -1 if no
* layer is found.
*
* Returns: The layer found at the specified coordinates.
* Returns: (transfer full): The layer found at the specified coordinates.
**/
gint32
GimpLayer *
gimp_image_pick_correlate_layer (GimpImage *image,
gint x,
gint y)
@ -1752,7 +1753,7 @@ gimp_image_pick_correlate_layer (GimpImage *image,
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_ID = -1;
GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -1770,11 +1771,11 @@ gimp_image_pick_correlate_layer (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return layer_ID;
return layer;
}
/**
@ -1829,8 +1830,8 @@ _gimp_image_pick_correlate_layer (gint32 image_ID,
/**
* gimp_image_insert_layer:
* @image: The image.
* @layer_ID: The layer.
* @parent_ID: The parent layer.
* @layer: The layer.
* @parent: The parent layer.
* @position: The layer position.
*
* Add the specified layer to the image.
@ -1851,8 +1852,8 @@ _gimp_image_pick_correlate_layer (gint32 image_ID,
**/
gboolean
gimp_image_insert_layer (GimpImage *image,
gint32 layer_ID,
gint32 parent_ID,
GimpLayer *layer,
GimpLayer *parent,
gint position)
{
GimpPDB *pdb = gimp_get_pdb ();
@ -1862,8 +1863,8 @@ gimp_image_insert_layer (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_LAYER_ID, layer_ID,
GIMP_TYPE_LAYER_ID, parent_ID,
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (parent)),
G_TYPE_INT, position,
G_TYPE_NONE);
@ -1943,7 +1944,7 @@ _gimp_image_insert_layer (gint32 image_ID,
/**
* gimp_image_remove_layer:
* @image: The image.
* @layer_ID: The layer.
* @layer: The layer.
*
* Remove the specified layer from the image.
*
@ -1957,7 +1958,7 @@ _gimp_image_insert_layer (gint32 image_ID,
**/
gboolean
gimp_image_remove_layer (GimpImage *image,
gint32 layer_ID)
GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -1966,7 +1967,7 @@ gimp_image_remove_layer (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_LAYER_ID, layer_ID,
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
@ -2957,7 +2958,7 @@ _gimp_image_thaw_vectors (gint32 image_ID)
/**
* gimp_image_get_item_position:
* @image: The image.
* @item_ID: The item.
* @item: The item.
*
* Returns the position of the item in its level of its item tree.
*
@ -2972,7 +2973,7 @@ _gimp_image_thaw_vectors (gint32 image_ID)
**/
gint
gimp_image_get_item_position (GimpImage *image,
gint32 item_ID)
GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -2981,7 +2982,7 @@ gimp_image_get_item_position (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_ITEM_ID, item_ID,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
@ -3051,7 +3052,7 @@ _gimp_image_get_item_position (gint32 image_ID,
/**
* gimp_image_raise_item:
* @image: The image.
* @item_ID: The item to raise.
* @item: The item to raise.
*
* Raise the specified item in its level in its item tree
*
@ -3064,7 +3065,7 @@ _gimp_image_get_item_position (gint32 image_ID,
**/
gboolean
gimp_image_raise_item (GimpImage *image,
gint32 item_ID)
GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -3073,7 +3074,7 @@ gimp_image_raise_item (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_ITEM_ID, item_ID,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
@ -3139,7 +3140,7 @@ _gimp_image_raise_item (gint32 image_ID,
/**
* gimp_image_lower_item:
* @image: The image.
* @item_ID: The item to lower.
* @item: The item to lower.
*
* Lower the specified item in its level in its item tree
*
@ -3152,7 +3153,7 @@ _gimp_image_raise_item (gint32 image_ID,
**/
gboolean
gimp_image_lower_item (GimpImage *image,
gint32 item_ID)
GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -3161,7 +3162,7 @@ gimp_image_lower_item (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_ITEM_ID, item_ID,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
@ -3227,7 +3228,7 @@ _gimp_image_lower_item (gint32 image_ID,
/**
* gimp_image_raise_item_to_top:
* @image: The image.
* @item_ID: The item to raise to top.
* @item: The item to raise to top.
*
* Raise the specified item to the top of its level in its item tree
*
@ -3240,7 +3241,7 @@ _gimp_image_lower_item (gint32 image_ID,
**/
gboolean
gimp_image_raise_item_to_top (GimpImage *image,
gint32 item_ID)
GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -3249,7 +3250,7 @@ gimp_image_raise_item_to_top (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_ITEM_ID, item_ID,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
@ -3315,7 +3316,7 @@ _gimp_image_raise_item_to_top (gint32 image_ID,
/**
* gimp_image_lower_item_to_bottom:
* @image: The image.
* @item_ID: The item to lower to bottom.
* @item: The item to lower to bottom.
*
* Lower the specified item to the bottom of its level in its item tree
*
@ -3329,7 +3330,7 @@ _gimp_image_raise_item_to_top (gint32 image_ID,
**/
gboolean
gimp_image_lower_item_to_bottom (GimpImage *image,
gint32 item_ID)
GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -3338,7 +3339,7 @@ gimp_image_lower_item_to_bottom (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_ITEM_ID, item_ID,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
@ -3405,8 +3406,8 @@ _gimp_image_lower_item_to_bottom (gint32 image_ID,
/**
* gimp_image_reorder_item:
* @image: The image.
* @item_ID: The item to reorder.
* @parent_ID: The new parent item.
* @item: The item to reorder.
* @parent: The new parent item.
* @position: The new position of the item.
*
* Reorder the specified item within its item tree
@ -3419,8 +3420,8 @@ _gimp_image_lower_item_to_bottom (gint32 image_ID,
**/
gboolean
gimp_image_reorder_item (GimpImage *image,
gint32 item_ID,
gint32 parent_ID,
GimpItem *item,
GimpItem *parent,
gint position)
{
GimpPDB *pdb = gimp_get_pdb ();
@ -3430,8 +3431,8 @@ gimp_image_reorder_item (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_ITEM_ID, item_ID,
GIMP_TYPE_ITEM_ID, parent_ID,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (parent)),
G_TYPE_INT, position,
G_TYPE_NONE);
@ -3511,15 +3512,15 @@ _gimp_image_reorder_item (gint32 image_ID,
* merging with the CLIP_TO_IMAGE merge type. Non-visible layers are
* discarded, and the resulting image is stripped of its alpha channel.
*
* Returns: The resulting layer.
* Returns: (transfer full): The resulting layer.
**/
gint32
GimpLayer *
gimp_image_flatten (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_ID = -1;
GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -3535,11 +3536,11 @@ gimp_image_flatten (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return layer_ID;
return layer;
}
/**
@ -3598,16 +3599,16 @@ _gimp_image_flatten (gint32 image_ID)
* extents of the image. A merge type of CLIP_TO_BOTTOM_LAYER clips the
* final layer to the size of the bottommost layer.
*
* Returns: The resulting layer.
* Returns: (transfer full): The resulting layer.
**/
gint32
GimpLayer *
gimp_image_merge_visible_layers (GimpImage *image,
GimpMergeType merge_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_ID = -1;
GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -3624,11 +3625,11 @@ gimp_image_merge_visible_layers (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return layer_ID;
return layer;
}
/**
@ -3681,7 +3682,7 @@ _gimp_image_merge_visible_layers (gint32 image_ID,
/**
* gimp_image_merge_down:
* @image: The image.
* @merge_layer_ID: The layer to merge down from.
* @merge_layer: The layer to merge down from.
* @merge_type: The type of merge.
*
* Merge the layer passed and the first visible layer below.
@ -3694,21 +3695,21 @@ _gimp_image_merge_visible_layers (gint32 image_ID,
* CLIP_TO_BOTTOM_LAYER clips the final layer to the size of the
* bottommost layer.
*
* Returns: The resulting layer.
* Returns: (transfer full): The resulting layer.
**/
gint32
GimpLayer *
gimp_image_merge_down (GimpImage *image,
gint32 merge_layer_ID,
GimpLayer *merge_layer,
GimpMergeType merge_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_ID = -1;
GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_LAYER_ID, merge_layer_ID,
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (merge_layer)),
GIMP_TYPE_MERGE_TYPE, merge_type,
G_TYPE_NONE);
@ -3722,11 +3723,11 @@ gimp_image_merge_down (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return layer_ID;
return layer;
}
/**
@ -4467,15 +4468,15 @@ __gimp_image_thumbnail (gint32 image_ID,
* If a channel is currently active, then no layer will be. If a layer
* mask is active, then this will return the associated layer.
*
* Returns: The active layer.
* Returns: (transfer full): The active layer.
**/
gint32
GimpLayer *
gimp_image_get_active_layer (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 active_layer_ID = -1;
GimpLayer *active_layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -4491,11 +4492,11 @@ gimp_image_get_active_layer (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
active_layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
active_layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return active_layer_ID;
return active_layer;
}
/**
@ -4542,7 +4543,7 @@ _gimp_image_get_active_layer (gint32 image_ID)
/**
* gimp_image_set_active_layer:
* @image: The image.
* @active_layer_ID: The new image active layer.
* @active_layer: The new image active layer.
*
* Sets the specified image's active layer.
*
@ -4555,7 +4556,7 @@ _gimp_image_get_active_layer (gint32 image_ID)
**/
gboolean
gimp_image_set_active_layer (GimpImage *image,
gint32 active_layer_ID)
GimpLayer *active_layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -4564,7 +4565,7 @@ gimp_image_set_active_layer (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_LAYER_ID, active_layer_ID,
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (active_layer)),
G_TYPE_NONE);
if (pdb)
@ -6595,16 +6596,16 @@ _gimp_image_set_tattoo_state (gint32 image_ID,
* This procedure returns the layer with the given tattoo in the
* specified image.
*
* Returns: The layer with the specified tattoo.
* Returns: (transfer full): The layer with the specified tattoo.
**/
gint32
GimpLayer *
gimp_image_get_layer_by_tattoo (GimpImage *image,
guint tattoo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_ID = -1;
GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -6621,11 +6622,11 @@ gimp_image_get_layer_by_tattoo (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return layer_ID;
return layer;
}
/**
@ -6857,18 +6858,18 @@ _gimp_image_get_vectors_by_tattoo (gint32 image_ID,
* This procedure returns the layer with the given name in the
* specified image.
*
* Returns: The layer with the specified name.
* Returns: (transfer full): The layer with the specified name.
*
* Since: 2.8
**/
gint32
GimpLayer *
gimp_image_get_layer_by_name (GimpImage *image,
const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_ID = -1;
GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -6885,11 +6886,11 @@ gimp_image_get_layer_by_name (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return layer_ID;
return layer;
}
/**

View file

@ -57,27 +57,27 @@ gint* gimp_image_get_channels (GimpImage
gint *num_channels);
gint* gimp_image_get_vectors (GimpImage *image,
gint *num_vectors);
gint32 gimp_image_get_active_drawable (GimpImage *image);
GimpDrawable* gimp_image_get_active_drawable (GimpImage *image);
gboolean gimp_image_unset_active_channel (GimpImage *image);
gint32 gimp_image_get_floating_sel (GimpImage *image);
gint32 gimp_image_floating_sel_attached_to (GimpImage *image);
GimpLayer* gimp_image_get_floating_sel (GimpImage *image);
GimpDrawable* gimp_image_floating_sel_attached_to (GimpImage *image);
gboolean gimp_image_pick_color (GimpImage *image,
gint32 drawable_ID,
GimpDrawable *drawable,
gdouble x,
gdouble y,
gboolean sample_merged,
gboolean sample_average,
gdouble average_radius,
GimpRGB *color);
gint32 gimp_image_pick_correlate_layer (GimpImage *image,
GimpLayer* gimp_image_pick_correlate_layer (GimpImage *image,
gint x,
gint y);
gboolean gimp_image_insert_layer (GimpImage *image,
gint32 layer_ID,
gint32 parent_ID,
GimpLayer *layer,
GimpLayer *parent,
gint position);
gboolean gimp_image_remove_layer (GimpImage *image,
gint32 layer_ID);
GimpLayer *layer);
gboolean gimp_image_freeze_layers (GimpImage *image);
gboolean gimp_image_thaw_layers (GimpImage *image);
gboolean gimp_image_insert_channel (GimpImage *image,
@ -97,24 +97,24 @@ gboolean gimp_image_remove_vectors (GimpImage
gboolean gimp_image_freeze_vectors (GimpImage *image);
gboolean gimp_image_thaw_vectors (GimpImage *image);
gint gimp_image_get_item_position (GimpImage *image,
gint32 item_ID);
GimpItem *item);
gboolean gimp_image_raise_item (GimpImage *image,
gint32 item_ID);
GimpItem *item);
gboolean gimp_image_lower_item (GimpImage *image,
gint32 item_ID);
GimpItem *item);
gboolean gimp_image_raise_item_to_top (GimpImage *image,
gint32 item_ID);
GimpItem *item);
gboolean gimp_image_lower_item_to_bottom (GimpImage *image,
gint32 item_ID);
GimpItem *item);
gboolean gimp_image_reorder_item (GimpImage *image,
gint32 item_ID,
gint32 parent_ID,
GimpItem *item,
GimpItem *parent,
gint position);
gint32 gimp_image_flatten (GimpImage *image);
gint32 gimp_image_merge_visible_layers (GimpImage *image,
GimpLayer* gimp_image_flatten (GimpImage *image);
GimpLayer* gimp_image_merge_visible_layers (GimpImage *image,
GimpMergeType merge_type);
gint32 gimp_image_merge_down (GimpImage *image,
gint32 merge_layer_ID,
GimpLayer* gimp_image_merge_down (GimpImage *image,
GimpLayer *merge_layer,
GimpMergeType merge_type);
G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (GimpImage *image,
gint *num_bytes);
@ -134,9 +134,9 @@ G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (GimpImage
gint *bpp,
gint *thumbnail_data_count,
guint8 **thumbnail_data);
gint32 gimp_image_get_active_layer (GimpImage *image);
GimpLayer* gimp_image_get_active_layer (GimpImage *image);
gboolean gimp_image_set_active_layer (GimpImage *image,
gint32 active_layer_ID);
GimpLayer *active_layer);
gint32 gimp_image_get_active_channel (GimpImage *image);
gboolean gimp_image_set_active_channel (GimpImage *image,
gint32 active_channel_ID);
@ -174,13 +174,13 @@ gboolean gimp_image_set_unit (GimpImage
guint gimp_image_get_tattoo_state (GimpImage *image);
gboolean gimp_image_set_tattoo_state (GimpImage *image,
guint tattoo_state);
gint32 gimp_image_get_layer_by_tattoo (GimpImage *image,
GimpLayer* gimp_image_get_layer_by_tattoo (GimpImage *image,
guint tattoo);
gint32 gimp_image_get_channel_by_tattoo (GimpImage *image,
guint tattoo);
gint32 gimp_image_get_vectors_by_tattoo (GimpImage *image,
guint tattoo);
gint32 gimp_image_get_layer_by_name (GimpImage *image,
GimpLayer* gimp_image_get_layer_by_name (GimpImage *image,
const gchar *name);
gint32 gimp_image_get_channel_by_name (GimpImage *image,
const gchar *name);

View file

@ -38,7 +38,7 @@
* gimp_image_select_color:
* @image: The affected image.
* @operation: The selection operation.
* @drawable_ID: The affected drawable.
* @drawable: The affected drawable.
* @color: The color to select.
*
* Create a selection by selecting all pixels (in the specified
@ -68,7 +68,7 @@
gboolean
gimp_image_select_color (GimpImage *image,
GimpChannelOps operation,
gint32 drawable_ID,
GimpDrawable *drawable,
const GimpRGB *color)
{
GimpPDB *pdb = gimp_get_pdb ();
@ -79,7 +79,7 @@ gimp_image_select_color (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_CHANNEL_OPS, operation,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
GIMP_TYPE_RGB, color,
G_TYPE_NONE);
@ -168,7 +168,7 @@ _gimp_image_select_color (gint32 image_ID,
* gimp_image_select_contiguous_color:
* @image: The affected image.
* @operation: The selection operation.
* @drawable_ID: The affected drawable.
* @drawable: The affected drawable.
* @x: x coordinate of initial seed fill point: (image coordinates).
* @y: y coordinate of initial seed fill point: (image coordinates).
*
@ -208,7 +208,7 @@ _gimp_image_select_color (gint32 image_ID,
gboolean
gimp_image_select_contiguous_color (GimpImage *image,
GimpChannelOps operation,
gint32 drawable_ID,
GimpDrawable *drawable,
gdouble x,
gdouble y)
{
@ -220,7 +220,7 @@ gimp_image_select_contiguous_color (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_CHANNEL_OPS, operation,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_DOUBLE, x,
G_TYPE_DOUBLE, y,
G_TYPE_NONE);
@ -824,7 +824,7 @@ _gimp_image_select_polygon (gint32 image_ID,
* gimp_image_select_item:
* @image: The image.
* @operation: The desired operation with current selection.
* @item_ID: The item to render to the selection.
* @item: The item to render to the selection.
*
* Transforms the specified item into a selection
*
@ -844,7 +844,7 @@ _gimp_image_select_polygon (gint32 image_ID,
gboolean
gimp_image_select_item (GimpImage *image,
GimpChannelOps operation,
gint32 item_ID)
GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -854,7 +854,7 @@ gimp_image_select_item (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_CHANNEL_OPS, operation,
GIMP_TYPE_ITEM_ID, item_ID,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)

View file

@ -38,11 +38,11 @@ G_BEGIN_DECLS
gboolean gimp_image_select_color (GimpImage *image,
GimpChannelOps operation,
gint32 drawable_ID,
GimpDrawable *drawable,
const GimpRGB *color);
gboolean gimp_image_select_contiguous_color (GimpImage *image,
GimpChannelOps operation,
gint32 drawable_ID,
GimpDrawable *drawable,
gdouble x,
gdouble y);
gboolean gimp_image_select_rectangle (GimpImage *image,
@ -71,7 +71,7 @@ gboolean gimp_image_select_polygon (GimpImage *image,
const gdouble *segs);
gboolean gimp_image_select_item (GimpImage *image,
GimpChannelOps operation,
gint32 item_ID);
GimpItem *item);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */

165
libgimp/gimpitem.c Normal file
View file

@ -0,0 +1,165 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpitem.c
* Copyright (C) Jehan
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gimp.h"
#include "gimppixbuf.h"
enum
{
PROP_0,
PROP_ID,
N_PROPS
};
struct _GimpItemPrivate
{
gint id;
};
static void gimp_item_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_item_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GimpItem, gimp_item, G_TYPE_OBJECT)
#define parent_class gimp_item_parent_class
static GParamSpec *props[N_PROPS] = { NULL, };
static void
gimp_item_class_init (GimpItemClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_item_set_property;
object_class->get_property = gimp_item_get_property;
props[PROP_ID] =
g_param_spec_int ("id",
"The item id",
"The item id for internal use",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class, N_PROPS, props);
}
static void
gimp_item_init (GimpItem *item)
{
item->priv = gimp_item_get_instance_private (item);
}
static void
gimp_item_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpItem *item = GIMP_ITEM (object);
switch (property_id)
{
case PROP_ID:
item->priv->id = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_item_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpItem *item = GIMP_ITEM (object);
switch (property_id)
{
case PROP_ID:
g_value_set_int (value, item->priv->id);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
/* Public API. */
/**
* gimp_item_get_id:
* @item: The item.
*
* Returns: the item ID.
*
* Since: 3.0
**/
gint32
gimp_item_get_id (GimpItem *item)
{
return item ? item->priv->id : -1;
}
/**
* gimp_item_new_by_id:
* @item_id: The item id.
*
* Creates a #GimpItem representing @item_id. Since #GimpItem is an
* abstract class, the object real type will actually be the proper
* subclass.
*
* Returns: (nullable) (transfer full): a #GimpItem for @item_id or
* %NULL if @item_id does not represent a valid item.
*
* Since: 3.0
**/
GimpItem *
gimp_item_new_by_id (gint32 item_id)
{
GimpItem *item = NULL;
if (_gimp_item_is_valid (item_id))
{
if (_gimp_item_is_layer (item_id))
item = g_object_new (GIMP_TYPE_LAYER,
"id", item_id,
NULL);
}
return item;
}

75
libgimp/gimpitem.h Normal file
View file

@ -0,0 +1,75 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpitem.h
* Copyright (C) Jehan
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only <libgimp/gimp.h> can be included directly."
#endif
#ifndef __GIMP_ITEM_H__
#define __GIMP_ITEM_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_ITEM (gimp_item_get_type ())
#define GIMP_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ITEM, GimpItem))
#define GIMP_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ITEM, GimpItemClass))
#define GIMP_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ITEM))
#define GIMP_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ITEM))
#define GIMP_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ITEM, GimpItemClass))
typedef struct _GimpItemClass GimpItemClass;
typedef struct _GimpItemPrivate GimpItemPrivate;
struct _GimpItem
{
GObject parent_instance;
GimpItemPrivate *priv;
};
struct _GimpItemClass
{
GObjectClass parent_class;
/* Padding for future expansion */
void (*_gimp_reserved1) (void);
void (*_gimp_reserved2) (void);
void (*_gimp_reserved3) (void);
void (*_gimp_reserved4) (void);
void (*_gimp_reserved5) (void);
void (*_gimp_reserved6) (void);
void (*_gimp_reserved7) (void);
void (*_gimp_reserved8) (void);
void (*_gimp_reserved9) (void);
};
GType gimp_item_get_type (void) G_GNUC_CONST;
gint32 gimp_item_get_id (GimpItem *item);
GimpItem * gimp_item_new_by_id (gint32 item_id);
G_END_DECLS
#endif /* __GIMP_ITEM_H__ */

File diff suppressed because it is too large Load diff

View file

@ -32,59 +32,92 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_item_is_valid (gint32 item_ID);
gboolean gimp_item_delete (gint32 item_ID);
gboolean gimp_item_is_drawable (gint32 item_ID);
gboolean gimp_item_is_layer (gint32 item_ID);
gboolean gimp_item_is_text_layer (gint32 item_ID);
gboolean gimp_item_is_channel (gint32 item_ID);
gboolean gimp_item_is_layer_mask (gint32 item_ID);
gboolean gimp_item_is_selection (gint32 item_ID);
gboolean gimp_item_is_vectors (gint32 item_ID);
gboolean gimp_item_is_group (gint32 item_ID);
gint32 gimp_item_get_parent (gint32 item_ID);
gint* gimp_item_get_children (gint32 item_ID,
gint *num_children);
gboolean gimp_item_get_expanded (gint32 item_ID);
gboolean gimp_item_set_expanded (gint32 item_ID,
gboolean expanded);
gchar* gimp_item_get_name (gint32 item_ID);
gboolean gimp_item_set_name (gint32 item_ID,
const gchar *name);
gboolean gimp_item_get_visible (gint32 item_ID);
gboolean gimp_item_set_visible (gint32 item_ID,
gboolean visible);
gboolean gimp_item_get_linked (gint32 item_ID);
gboolean gimp_item_set_linked (gint32 item_ID,
gboolean linked);
gboolean gimp_item_get_lock_content (gint32 item_ID);
gboolean gimp_item_set_lock_content (gint32 item_ID,
gboolean lock_content);
gboolean gimp_item_get_lock_position (gint32 item_ID);
gboolean gimp_item_set_lock_position (gint32 item_ID,
gboolean lock_position);
GimpColorTag gimp_item_get_color_tag (gint32 item_ID);
gboolean gimp_item_set_color_tag (gint32 item_ID,
GimpColorTag color_tag);
guint gimp_item_get_tattoo (gint32 item_ID);
gboolean gimp_item_set_tattoo (gint32 item_ID,
guint tattoo);
gboolean gimp_item_attach_parasite (gint32 item_ID,
const GimpParasite *parasite);
gboolean gimp_item_detach_parasite (gint32 item_ID,
const gchar *name);
GimpParasite* gimp_item_get_parasite (gint32 item_ID,
const gchar *name);
gchar** gimp_item_get_parasite_list (gint32 item_ID,
gint *num_parasites);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
GimpImage* gimp_item_get_image (gint32 item_ID);
gboolean gimp_item_is_valid (GimpItem *item);
GimpImage* gimp_item_get_image (GimpItem *item);
gboolean gimp_item_delete (GimpItem *item);
gboolean gimp_item_is_drawable (GimpItem *item);
gboolean gimp_item_is_layer (GimpItem *item);
gboolean gimp_item_is_text_layer (GimpItem *item);
gboolean gimp_item_is_channel (GimpItem *item);
gboolean gimp_item_is_layer_mask (GimpItem *item);
gboolean gimp_item_is_selection (GimpItem *item);
gboolean gimp_item_is_vectors (GimpItem *item);
gboolean gimp_item_is_group (GimpItem *item);
GimpItem* gimp_item_get_parent (GimpItem *item);
gint* gimp_item_get_children (GimpItem *item,
gint *num_children);
gboolean gimp_item_get_expanded (GimpItem *item);
gboolean gimp_item_set_expanded (GimpItem *item,
gboolean expanded);
gchar* gimp_item_get_name (GimpItem *item);
gboolean gimp_item_set_name (GimpItem *item,
const gchar *name);
gboolean gimp_item_get_visible (GimpItem *item);
gboolean gimp_item_set_visible (GimpItem *item,
gboolean visible);
gboolean gimp_item_get_linked (GimpItem *item);
gboolean gimp_item_set_linked (GimpItem *item,
gboolean linked);
gboolean gimp_item_get_lock_content (GimpItem *item);
gboolean gimp_item_set_lock_content (GimpItem *item,
gboolean lock_content);
gboolean gimp_item_get_lock_position (GimpItem *item);
gboolean gimp_item_set_lock_position (GimpItem *item,
gboolean lock_position);
GimpColorTag gimp_item_get_color_tag (GimpItem *item);
gboolean gimp_item_set_color_tag (GimpItem *item,
GimpColorTag color_tag);
guint gimp_item_get_tattoo (GimpItem *item);
gboolean gimp_item_set_tattoo (GimpItem *item,
guint tattoo);
gboolean gimp_item_attach_parasite (GimpItem *item,
const GimpParasite *parasite);
gboolean gimp_item_detach_parasite (GimpItem *item,
const gchar *name);
GimpParasite* gimp_item_get_parasite (GimpItem *item,
const gchar *name);
gchar** gimp_item_get_parasite_list (GimpItem *item,
gint *num_parasites);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define gimp_item_is_valid _gimp_item_is_valid
#define gimp_item_get_image _gimp_item_get_image
#define gimp_item_delete _gimp_item_delete
#define gimp_item_is_drawable _gimp_item_is_drawable
#define gimp_item_is_layer _gimp_item_is_layer
#define gimp_item_is_text_layer _gimp_item_is_text_layer
#define gimp_item_is_channel _gimp_item_is_channel
#define gimp_item_is_layer_mask _gimp_item_is_layer_mask
#define gimp_item_is_selection _gimp_item_is_selection
#define gimp_item_is_vectors _gimp_item_is_vectors
#define gimp_item_is_group _gimp_item_is_group
#define gimp_item_get_parent _gimp_item_get_parent
#define gimp_item_get_children _gimp_item_get_children
#define gimp_item_get_expanded _gimp_item_get_expanded
#define gimp_item_set_expanded _gimp_item_set_expanded
#define gimp_item_get_name _gimp_item_get_name
#define gimp_item_set_name _gimp_item_set_name
#define gimp_item_get_visible _gimp_item_get_visible
#define gimp_item_set_visible _gimp_item_set_visible
#define gimp_item_get_linked _gimp_item_get_linked
#define gimp_item_set_linked _gimp_item_set_linked
#define gimp_item_get_lock_content _gimp_item_get_lock_content
#define gimp_item_set_lock_content _gimp_item_set_lock_content
#define gimp_item_get_lock_position _gimp_item_get_lock_position
#define gimp_item_set_lock_position _gimp_item_set_lock_position
#define gimp_item_get_color_tag _gimp_item_get_color_tag
#define gimp_item_set_color_tag _gimp_item_set_color_tag
#define gimp_item_get_tattoo _gimp_item_get_tattoo
#define gimp_item_set_tattoo _gimp_item_set_tattoo
#define gimp_item_attach_parasite _gimp_item_attach_parasite
#define gimp_item_detach_parasite _gimp_item_detach_parasite
#define gimp_item_get_parasite _gimp_item_get_parasite
#define gimp_item_get_parasite_list _gimp_item_get_parasite_list
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -93,7 +126,52 @@ GimpImage* gimp_item_get_image (gint32 item_ID);
* They are not marked internal as a trick to keep the old API alive for now.
*/
gint32 _gimp_item_get_image (gint32 item_ID);
gboolean _gimp_item_is_valid (gint32 item_ID);
gint32 _gimp_item_get_image (gint32 item_ID);
gboolean _gimp_item_delete (gint32 item_ID);
gboolean _gimp_item_is_drawable (gint32 item_ID);
gboolean _gimp_item_is_layer (gint32 item_ID);
gboolean _gimp_item_is_text_layer (gint32 item_ID);
gboolean _gimp_item_is_channel (gint32 item_ID);
gboolean _gimp_item_is_layer_mask (gint32 item_ID);
gboolean _gimp_item_is_selection (gint32 item_ID);
gboolean _gimp_item_is_vectors (gint32 item_ID);
gboolean _gimp_item_is_group (gint32 item_ID);
gint32 _gimp_item_get_parent (gint32 item_ID);
gint* _gimp_item_get_children (gint32 item_ID,
gint *num_children);
gboolean _gimp_item_get_expanded (gint32 item_ID);
gboolean _gimp_item_set_expanded (gint32 item_ID,
gboolean expanded);
gchar* _gimp_item_get_name (gint32 item_ID);
gboolean _gimp_item_set_name (gint32 item_ID,
const gchar *name);
gboolean _gimp_item_get_visible (gint32 item_ID);
gboolean _gimp_item_set_visible (gint32 item_ID,
gboolean visible);
gboolean _gimp_item_get_linked (gint32 item_ID);
gboolean _gimp_item_set_linked (gint32 item_ID,
gboolean linked);
gboolean _gimp_item_get_lock_content (gint32 item_ID);
gboolean _gimp_item_set_lock_content (gint32 item_ID,
gboolean lock_content);
gboolean _gimp_item_get_lock_position (gint32 item_ID);
gboolean _gimp_item_set_lock_position (gint32 item_ID,
gboolean lock_position);
GimpColorTag _gimp_item_get_color_tag (gint32 item_ID);
gboolean _gimp_item_set_color_tag (gint32 item_ID,
GimpColorTag color_tag);
guint _gimp_item_get_tattoo (gint32 item_ID);
gboolean _gimp_item_set_tattoo (gint32 item_ID,
guint tattoo);
gboolean _gimp_item_attach_parasite (gint32 item_ID,
const GimpParasite *parasite);
gboolean _gimp_item_detach_parasite (gint32 item_ID,
const gchar *name);
GimpParasite* _gimp_item_get_parasite (gint32 item_ID,
const gchar *name);
gchar** _gimp_item_get_parasite_list (gint32 item_ID,
gint *num_parasites);
G_END_DECLS

View file

@ -36,6 +36,61 @@
/**
* gimp_item_transform_translate:
* @item: The item.
* @off_x: Offset in x direction.
* @off_y: Offset in y direction.
*
* Translate the item by the specified offsets.
*
* This procedure translates the item by the amounts specified in the
* off_x and off_y arguments. These can be negative, and are considered
* offsets from the current position. The offsets will be rounded to
* the nearest pixel unless the item is a path.
*
* If the item is attached to an image and has its linked flag set to
* TRUE, all additional items contained in the image which have the
* linked flag set to TRUE will also be translated by the specified
* offsets.
*
* Returns: (transfer full): The translated item.
*
* Since: 2.10
**/
GimpItem *
gimp_item_transform_translate (GimpItem *item,
gdouble off_x,
gdouble off_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpItem *ret_item = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_DOUBLE, off_x,
G_TYPE_DOUBLE, off_y,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-item-transform-translate",
args);
else
return_vals = gimp_run_procedure_array ("gimp-item-transform-translate",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return ret_item;
}
/**
* _gimp_item_transform_translate: (skip)
* @item_ID: The item.
* @off_x: Offset in x direction.
* @off_y: Offset in y direction.
@ -57,9 +112,9 @@
* Since: 2.10
**/
gint32
gimp_item_transform_translate (gint32 item_ID,
gdouble off_x,
gdouble off_y)
_gimp_item_transform_translate (gint32 item_ID,
gdouble off_x,
gdouble off_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -91,6 +146,74 @@ gimp_item_transform_translate (gint32 item_ID,
/**
* gimp_item_transform_flip_simple:
* @item: The affected item.
* @flip_type: Type of flip.
* @auto_center: Whether to automatically position the axis in the selection center.
* @axis: coord. of flip axis.
*
* Flip the specified item either vertically or horizontally.
*
* This procedure flips the specified item.
*
* If a selection exists and the item is a drawable, the portion of the
* drawable which lies under the selection is cut from the drawable and
* made into a floating selection which is then flipped. If auto_center
* is set to TRUE, the flip is around the selection's center.
* Otherwise, the coordinate of the axis needs to be specified. The
* return value is the ID of the flipped floating selection.
*
* If there is no selection or the item is not a drawable, the entire
* item will be flipped around its center if auto_center is set to
* TRUE, otherwise the coordinate of the axis needs to be specified.
* Additionally, if the item has its linked flag set to TRUE, all
* additional items contained in the image which have the linked flag
* set to TRUE will also be flipped around the same axis. The return
* value will be equal to the item ID supplied as input.
*
* This procedure is affected by the following context setters:
* gimp_context_set_transform_resize().
*
* Returns: (transfer full): The flipped item.
*
* Since: 2.2
**/
GimpItem *
gimp_item_transform_flip_simple (GimpItem *item,
GimpOrientationType flip_type,
gboolean auto_center,
gdouble axis)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpItem *ret_item = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
GIMP_TYPE_ORIENTATION_TYPE, flip_type,
G_TYPE_BOOLEAN, auto_center,
G_TYPE_DOUBLE, axis,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-item-transform-flip-simple",
args);
else
return_vals = gimp_run_procedure_array ("gimp-item-transform-flip-simple",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return ret_item;
}
/**
* _gimp_item_transform_flip_simple: (skip)
* @item_ID: The affected item.
* @flip_type: Type of flip.
* @auto_center: Whether to automatically position the axis in the selection center.
@ -123,10 +246,10 @@ gimp_item_transform_translate (gint32 item_ID,
* Since: 2.2
**/
gint32
gimp_item_transform_flip_simple (gint32 item_ID,
GimpOrientationType flip_type,
gboolean auto_center,
gdouble axis)
_gimp_item_transform_flip_simple (gint32 item_ID,
GimpOrientationType flip_type,
gboolean auto_center,
gdouble axis)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -159,6 +282,77 @@ gimp_item_transform_flip_simple (gint32 item_ID,
/**
* gimp_item_transform_flip:
* @item: The affected item.
* @x0: horz. coord. of one end of axis.
* @y0: vert. coord. of one end of axis.
* @x1: horz. coord. of other end of axis.
* @y1: vert. coord. of other end of axis.
*
* Flip the specified item around a given line.
*
* This procedure flips the specified item.
*
* If a selection exists and the item is a drawable, the portion of the
* drawable which lies under the selection is cut from the drawable and
* made into a floating selection which is then flipped. The axis to
* flip around is specified by specifying two points from that line.
* The return value is the ID of the flipped floating selection.
*
* If there is no selection or the item is not a drawable, the entire
* item will be flipped around the specified axis. Additionally, if the
* item has its linked flag set to TRUE, all additional items contained
* in the image which have the linked flag set to TRUE will also be
* flipped around the same axis. The return value will be equal to the
* item ID supplied as input.
*
* This procedure is affected by the following context setters:
* gimp_context_set_interpolation(),
* gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize().
*
* Returns: (transfer full): The flipped item.
*
* Since: 2.8
**/
GimpItem *
gimp_item_transform_flip (GimpItem *item,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpItem *ret_item = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_DOUBLE, x0,
G_TYPE_DOUBLE, y0,
G_TYPE_DOUBLE, x1,
G_TYPE_DOUBLE, y1,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-item-transform-flip",
args);
else
return_vals = gimp_run_procedure_array ("gimp-item-transform-flip",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return ret_item;
}
/**
* _gimp_item_transform_flip: (skip)
* @item_ID: The affected item.
* @x0: horz. coord. of one end of axis.
* @y0: vert. coord. of one end of axis.
@ -192,11 +386,11 @@ gimp_item_transform_flip_simple (gint32 item_ID,
* Since: 2.8
**/
gint32
gimp_item_transform_flip (gint32 item_ID,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1)
_gimp_item_transform_flip (gint32 item_ID,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -230,6 +424,98 @@ gimp_item_transform_flip (gint32 item_ID,
/**
* gimp_item_transform_perspective:
* @item: The affected item.
* @x0: The new x coordinate of upper-left corner of original bounding box.
* @y0: The new y coordinate of upper-left corner of original bounding box.
* @x1: The new x coordinate of upper-right corner of original bounding box.
* @y1: The new y coordinate of upper-right corner of original bounding box.
* @x2: The new x coordinate of lower-left corner of original bounding box.
* @y2: The new y coordinate of lower-left corner of original bounding box.
* @x3: The new x coordinate of lower-right corner of original bounding box.
* @y3: The new y coordinate of lower-right corner of original bounding box.
*
* Perform a possibly non-affine transformation on the specified item.
*
* This procedure performs a possibly non-affine transformation on the
* specified item by allowing the corners of the original bounding box
* to be arbitrarily remapped to any values.
*
* The 4 coordinates specify the new locations of each corner of the
* original bounding box. By specifying these values, any affine
* transformation (rotation, scaling, translation) can be affected.
* Additionally, these values can be specified such that the resulting
* transformed item will appear to have been projected via a
* perspective transform.
*
* If a selection exists and the item is a drawable, the portion of the
* drawable which lies under the selection is cut from the drawable and
* made into a floating selection which is then transformed as
* specified. The return value is the ID of the transformed floating
* selection.
*
* If there is no selection or the item is not a drawable, the entire
* item will be transformed according to the specified mapping.
* Additionally, if the item has its linked flag set to TRUE, all
* additional items contained in the image which have the linked flag
* set to TRUE will also be transformed the same way. The return value
* will be equal to the item ID supplied as input.
*
* This procedure is affected by the following context setters:
* gimp_context_set_interpolation(),
* gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize().
*
* Returns: (transfer full): The transformed item.
*
* Since: 2.8
**/
GimpItem *
gimp_item_transform_perspective (GimpItem *item,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
gdouble x3,
gdouble y3)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpItem *ret_item = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_DOUBLE, x0,
G_TYPE_DOUBLE, y0,
G_TYPE_DOUBLE, x1,
G_TYPE_DOUBLE, y1,
G_TYPE_DOUBLE, x2,
G_TYPE_DOUBLE, y2,
G_TYPE_DOUBLE, x3,
G_TYPE_DOUBLE, y3,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-item-transform-perspective",
args);
else
return_vals = gimp_run_procedure_array ("gimp-item-transform-perspective",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return ret_item;
}
/**
* _gimp_item_transform_perspective: (skip)
* @item_ID: The affected item.
* @x0: The new x coordinate of upper-left corner of original bounding box.
* @y0: The new y coordinate of upper-left corner of original bounding box.
@ -276,15 +562,15 @@ gimp_item_transform_flip (gint32 item_ID,
* Since: 2.8
**/
gint32
gimp_item_transform_perspective (gint32 item_ID,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
gdouble x3,
gdouble y3)
_gimp_item_transform_perspective (gint32 item_ID,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
gdouble x3,
gdouble y3)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -322,6 +608,80 @@ gimp_item_transform_perspective (gint32 item_ID,
/**
* gimp_item_transform_rotate_simple:
* @item: The affected item.
* @rotate_type: Type of rotation.
* @auto_center: Whether to automatically rotate around the selection center.
* @center_x: The hor. coordinate of the center of rotation.
* @center_y: The vert. coordinate of the center of rotation.
*
* Rotate the specified item about given coordinates through the
* specified angle.
*
* This function rotates the specified item.
*
* If a selection exists and the item is a drawable, the portion of the
* drawable which lies under the selection is cut from the drawable and
* made into a floating selection which is then rotated by the
* specified amount. If auto_center is set to TRUE, the rotation is
* around the selection's center. Otherwise, the coordinate of the
* center point needs to be specified. The return value is the ID of
* the rotated floating selection.
*
* If there is no selection or the item is not a drawable, the entire
* item will be rotated around its center if auto_center is set to
* TRUE, otherwise the coordinate of the center point needs to be
* specified. Additionally, if the item has its linked flag set to
* TRUE, all additional items contained in the image which have the
* linked flag set to TRUE will also be rotated around the same center
* point. The return value will be equal to the item ID supplied as
* input.
*
* This procedure is affected by the following context setters:
* gimp_context_set_transform_resize().
*
* Returns: (transfer full): The rotated item.
*
* Since: 2.8
**/
GimpItem *
gimp_item_transform_rotate_simple (GimpItem *item,
GimpRotationType rotate_type,
gboolean auto_center,
gdouble center_x,
gdouble center_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpItem *ret_item = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
GIMP_TYPE_ROTATION_TYPE, rotate_type,
G_TYPE_BOOLEAN, auto_center,
G_TYPE_DOUBLE, center_x,
G_TYPE_DOUBLE, center_y,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-item-transform-rotate-simple",
args);
else
return_vals = gimp_run_procedure_array ("gimp-item-transform-rotate-simple",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return ret_item;
}
/**
* _gimp_item_transform_rotate_simple: (skip)
* @item_ID: The affected item.
* @rotate_type: Type of rotation.
* @auto_center: Whether to automatically rotate around the selection center.
@ -358,11 +718,11 @@ gimp_item_transform_perspective (gint32 item_ID,
* Since: 2.8
**/
gint32
gimp_item_transform_rotate_simple (gint32 item_ID,
GimpRotationType rotate_type,
gboolean auto_center,
gdouble center_x,
gdouble center_y)
_gimp_item_transform_rotate_simple (gint32 item_ID,
GimpRotationType rotate_type,
gboolean auto_center,
gdouble center_x,
gdouble center_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -396,6 +756,82 @@ gimp_item_transform_rotate_simple (gint32 item_ID,
/**
* gimp_item_transform_rotate:
* @item: The affected item.
* @angle: The angle of rotation (radians).
* @auto_center: Whether to automatically rotate around the selection center.
* @center_x: The hor. coordinate of the center of rotation.
* @center_y: The vert. coordinate of the center of rotation.
*
* Rotate the specified item about given coordinates through the
* specified angle.
*
* This function rotates the specified item.
*
* If a selection exists and the item is a drawable, the portion of the
* drawable which lies under the selection is cut from the drawable and
* made into a floating selection which is then rotated by the
* specified amount. If auto_center is set to TRUE, the rotation is
* around the selection's center. Otherwise, the coordinate of the
* center point needs to be specified. The return value is the ID of
* the rotated floating selection.
*
* If there is no selection or the item is not a drawable, the entire
* item will be rotated around its center if auto_center is set to
* TRUE, otherwise the coordinate of the center point needs to be
* specified. Additionally, if the item has its linked flag set to
* TRUE, all additional items contained in the image which have the
* linked flag set to TRUE will also be rotated around the same center
* point. The return value will be equal to the item ID supplied as
* input.
*
* This procedure is affected by the following context setters:
* gimp_context_set_interpolation(),
* gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize().
*
* Returns: (transfer full): The rotated item.
*
* Since: 2.8
**/
GimpItem *
gimp_item_transform_rotate (GimpItem *item,
gdouble angle,
gboolean auto_center,
gdouble center_x,
gdouble center_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpItem *ret_item = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_DOUBLE, angle,
G_TYPE_BOOLEAN, auto_center,
G_TYPE_DOUBLE, center_x,
G_TYPE_DOUBLE, center_y,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-item-transform-rotate",
args);
else
return_vals = gimp_run_procedure_array ("gimp-item-transform-rotate",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return ret_item;
}
/**
* _gimp_item_transform_rotate: (skip)
* @item_ID: The affected item.
* @angle: The angle of rotation (radians).
* @auto_center: Whether to automatically rotate around the selection center.
@ -434,11 +870,11 @@ gimp_item_transform_rotate_simple (gint32 item_ID,
* Since: 2.8
**/
gint32
gimp_item_transform_rotate (gint32 item_ID,
gdouble angle,
gboolean auto_center,
gdouble center_x,
gdouble center_y)
_gimp_item_transform_rotate (gint32 item_ID,
gdouble angle,
gboolean auto_center,
gdouble center_x,
gdouble center_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -472,6 +908,79 @@ gimp_item_transform_rotate (gint32 item_ID,
/**
* gimp_item_transform_scale:
* @item: The affected item.
* @x0: The new x coordinate of the upper-left corner of the scaled region.
* @y0: The new y coordinate of the upper-left corner of the scaled region.
* @x1: The new x coordinate of the lower-right corner of the scaled region.
* @y1: The new y coordinate of the lower-right corner of the scaled region.
*
* Scale the specified item.
*
* This procedure scales the specified item.
*
* The 2 coordinates specify the new locations of the top-left and
* bottom-roght corners of the original bounding box.
*
* If a selection exists and the item is a drawable, the portion of the
* drawable which lies under the selection is cut from the drawable and
* made into a floating selection which is then scaled as specified.
* The return value is the ID of the scaled floating selection.
*
* If there is no selection or the item is not a drawable, the entire
* item will be scaled according to the specified coordinates.
* Additionally, if the item has its linked flag set to TRUE, all
* additional items contained in the image which have the linked flag
* set to TRUE will also be scaled the same way. The return value will
* be equal to the item ID supplied as input.
*
* This procedure is affected by the following context setters:
* gimp_context_set_interpolation(),
* gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize().
*
* Returns: (transfer full): The scaled item.
*
* Since: 2.8
**/
GimpItem *
gimp_item_transform_scale (GimpItem *item,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpItem *ret_item = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_DOUBLE, x0,
G_TYPE_DOUBLE, y0,
G_TYPE_DOUBLE, x1,
G_TYPE_DOUBLE, y1,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-item-transform-scale",
args);
else
return_vals = gimp_run_procedure_array ("gimp-item-transform-scale",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return ret_item;
}
/**
* _gimp_item_transform_scale: (skip)
* @item_ID: The affected item.
* @x0: The new x coordinate of the upper-left corner of the scaled region.
* @y0: The new y coordinate of the upper-left corner of the scaled region.
@ -507,11 +1016,11 @@ gimp_item_transform_rotate (gint32 item_ID,
* Since: 2.8
**/
gint32
gimp_item_transform_scale (gint32 item_ID,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1)
_gimp_item_transform_scale (gint32 item_ID,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -545,6 +1054,75 @@ gimp_item_transform_scale (gint32 item_ID,
/**
* gimp_item_transform_shear:
* @item: The affected item.
* @shear_type: Type of shear.
* @magnitude: The magnitude of the shear.
*
* Shear the specified item about its center by the specified
* magnitude.
*
* This procedure shears the specified item.
*
* The shear type parameter indicates whether the shear will be applied
* horizontally or vertically. The magnitude can be either positive or
* negative and indicates the extent (in pixels) to shear by.
*
* If a selection exists and the item is a drawable, the portion of the
* drawable which lies under the selection is cut from the drawable and
* made into a floating selection which is then sheared as specified.
* The return value is the ID of the sheared floating selection.
*
* If there is no selection or the item is not a drawable, the entire
* item will be sheared according to the specified parameters.
* Additionally, if the item has its linked flag set to TRUE, all
* additional items contained in the image which have the linked flag
* set to TRUE will also be sheared the same way. The return value will
* be equal to the item ID supplied as input.
*
* This procedure is affected by the following context setters:
* gimp_context_set_interpolation(),
* gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize().
*
* Returns: (transfer full): The sheared item.
*
* Since: 2.8
**/
GimpItem *
gimp_item_transform_shear (GimpItem *item,
GimpOrientationType shear_type,
gdouble magnitude)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpItem *ret_item = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
GIMP_TYPE_ORIENTATION_TYPE, shear_type,
G_TYPE_DOUBLE, magnitude,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-item-transform-shear",
args);
else
return_vals = gimp_run_procedure_array ("gimp-item-transform-shear",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return ret_item;
}
/**
* _gimp_item_transform_shear: (skip)
* @item_ID: The affected item.
* @shear_type: Type of shear.
* @magnitude: The magnitude of the shear.
@ -580,9 +1158,9 @@ gimp_item_transform_scale (gint32 item_ID,
* Since: 2.8
**/
gint32
gimp_item_transform_shear (gint32 item_ID,
GimpOrientationType shear_type,
gdouble magnitude)
_gimp_item_transform_shear (gint32 item_ID,
GimpOrientationType shear_type,
gdouble magnitude)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -614,6 +1192,91 @@ gimp_item_transform_shear (gint32 item_ID,
/**
* gimp_item_transform_2d:
* @item: The affected item.
* @source_x: X coordinate of the transformation center.
* @source_y: Y coordinate of the transformation center.
* @scale_x: Amount to scale in x direction.
* @scale_y: Amount to scale in y direction.
* @angle: The angle of rotation (radians).
* @dest_x: X coordinate of where the center goes.
* @dest_y: Y coordinate of where the center goes.
*
* Transform the specified item in 2d.
*
* This procedure transforms the specified item.
*
* The transformation is done by scaling by the x and y scale factors
* about the point (source_x, source_y), then rotating around the same
* point, then translating that point to the new position (dest_x,
* dest_y).
*
* If a selection exists and the item is a drawable, the portion of the
* drawable which lies under the selection is cut from the drawable and
* made into a floating selection which is then transformed as
* specified. The return value is the ID of the transformed floating
* selection.
*
* If there is no selection or the item is not a drawable, the entire
* item will be transformed according to the specified parameters.
* Additionally, if the item has its linked flag set to TRUE, all
* additional items contained in the image which have the linked flag
* set to TRUE will also be transformed the same way. The return value
* will be equal to the item ID supplied as input.
*
* This procedure is affected by the following context setters:
* gimp_context_set_interpolation(),
* gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize().
*
* Returns: (transfer full): The transformed item.
*
* Since: 2.8
**/
GimpItem *
gimp_item_transform_2d (GimpItem *item,
gdouble source_x,
gdouble source_y,
gdouble scale_x,
gdouble scale_y,
gdouble angle,
gdouble dest_x,
gdouble dest_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpItem *ret_item = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_DOUBLE, source_x,
G_TYPE_DOUBLE, source_y,
G_TYPE_DOUBLE, scale_x,
G_TYPE_DOUBLE, scale_y,
G_TYPE_DOUBLE, angle,
G_TYPE_DOUBLE, dest_x,
G_TYPE_DOUBLE, dest_y,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-item-transform-2d",
args);
else
return_vals = gimp_run_procedure_array ("gimp-item-transform-2d",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return ret_item;
}
/**
* _gimp_item_transform_2d: (skip)
* @item_ID: The affected item.
* @source_x: X coordinate of the transformation center.
* @source_y: Y coordinate of the transformation center.
@ -655,14 +1318,14 @@ gimp_item_transform_shear (gint32 item_ID,
* Since: 2.8
**/
gint32
gimp_item_transform_2d (gint32 item_ID,
gdouble source_x,
gdouble source_y,
gdouble scale_x,
gdouble scale_y,
gdouble angle,
gdouble dest_x,
gdouble dest_y)
_gimp_item_transform_2d (gint32 item_ID,
gdouble source_x,
gdouble source_y,
gdouble scale_x,
gdouble scale_y,
gdouble angle,
gdouble dest_x,
gdouble dest_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -699,6 +1362,95 @@ gimp_item_transform_2d (gint32 item_ID,
/**
* gimp_item_transform_matrix:
* @item: The affected item.
* @coeff_0_0: coefficient (0,0) of the transformation matrix.
* @coeff_0_1: coefficient (0,1) of the transformation matrix.
* @coeff_0_2: coefficient (0,2) of the transformation matrix.
* @coeff_1_0: coefficient (1,0) of the transformation matrix.
* @coeff_1_1: coefficient (1,1) of the transformation matrix.
* @coeff_1_2: coefficient (1,2) of the transformation matrix.
* @coeff_2_0: coefficient (2,0) of the transformation matrix.
* @coeff_2_1: coefficient (2,1) of the transformation matrix.
* @coeff_2_2: coefficient (2,2) of the transformation matrix.
*
* Transform the specified item in 2d.
*
* This procedure transforms the specified item.
*
* The transformation is done by assembling a 3x3 matrix from the
* coefficients passed.
*
* If a selection exists and the item is a drawable, the portion of the
* drawable which lies under the selection is cut from the drawable and
* made into a floating selection which is then transformed as
* specified. The return value is the ID of the transformed floating
* selection.
*
* If there is no selection or the item is not a drawable, the entire
* item will be transformed according to the specified matrix.
* Additionally, if the item has its linked flag set to TRUE, all
* additional items contained in the image which have the linked flag
* set to TRUE will also be transformed the same way. The return value
* will be equal to the item ID supplied as input.
*
* This procedure is affected by the following context setters:
* gimp_context_set_interpolation(),
* gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize().
*
* Returns: (transfer full): The transformed item.
*
* Since: 2.8
**/
GimpItem *
gimp_item_transform_matrix (GimpItem *item,
gdouble coeff_0_0,
gdouble coeff_0_1,
gdouble coeff_0_2,
gdouble coeff_1_0,
gdouble coeff_1_1,
gdouble coeff_1_2,
gdouble coeff_2_0,
gdouble coeff_2_1,
gdouble coeff_2_2)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpItem *ret_item = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_DOUBLE, coeff_0_0,
G_TYPE_DOUBLE, coeff_0_1,
G_TYPE_DOUBLE, coeff_0_2,
G_TYPE_DOUBLE, coeff_1_0,
G_TYPE_DOUBLE, coeff_1_1,
G_TYPE_DOUBLE, coeff_1_2,
G_TYPE_DOUBLE, coeff_2_0,
G_TYPE_DOUBLE, coeff_2_1,
G_TYPE_DOUBLE, coeff_2_2,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-item-transform-matrix",
args);
else
return_vals = gimp_run_procedure_array ("gimp-item-transform-matrix",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return ret_item;
}
/**
* _gimp_item_transform_matrix: (skip)
* @item_ID: The affected item.
* @coeff_0_0: coefficient (0,0) of the transformation matrix.
* @coeff_0_1: coefficient (0,1) of the transformation matrix.
@ -740,16 +1492,16 @@ gimp_item_transform_2d (gint32 item_ID,
* Since: 2.8
**/
gint32
gimp_item_transform_matrix (gint32 item_ID,
gdouble coeff_0_0,
gdouble coeff_0_1,
gdouble coeff_0_2,
gdouble coeff_1_0,
gdouble coeff_1_1,
gdouble coeff_1_2,
gdouble coeff_2_0,
gdouble coeff_2_1,
gdouble coeff_2_2)
_gimp_item_transform_matrix (gint32 item_ID,
gdouble coeff_0_0,
gdouble coeff_0_1,
gdouble coeff_0_2,
gdouble coeff_1_0,
gdouble coeff_1_1,
gdouble coeff_1_2,
gdouble coeff_2_0,
gdouble coeff_2_1,
gdouble coeff_2_2)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;

View file

@ -32,70 +32,80 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gint32 gimp_item_transform_translate (gint32 item_ID,
gdouble off_x,
gdouble off_y);
gint32 gimp_item_transform_flip_simple (gint32 item_ID,
GimpOrientationType flip_type,
gboolean auto_center,
gdouble axis);
gint32 gimp_item_transform_flip (gint32 item_ID,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1);
gint32 gimp_item_transform_perspective (gint32 item_ID,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
gdouble x3,
gdouble y3);
gint32 gimp_item_transform_rotate_simple (gint32 item_ID,
GimpRotationType rotate_type,
gboolean auto_center,
gdouble center_x,
gdouble center_y);
gint32 gimp_item_transform_rotate (gint32 item_ID,
gdouble angle,
gboolean auto_center,
gdouble center_x,
gdouble center_y);
gint32 gimp_item_transform_scale (gint32 item_ID,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1);
gint32 gimp_item_transform_shear (gint32 item_ID,
GimpOrientationType shear_type,
gdouble magnitude);
gint32 gimp_item_transform_2d (gint32 item_ID,
gdouble source_x,
gdouble source_y,
gdouble scale_x,
gdouble scale_y,
gdouble angle,
gdouble dest_x,
gdouble dest_y);
gint32 gimp_item_transform_matrix (gint32 item_ID,
gdouble coeff_0_0,
gdouble coeff_0_1,
gdouble coeff_0_2,
gdouble coeff_1_0,
gdouble coeff_1_1,
gdouble coeff_1_2,
gdouble coeff_2_0,
gdouble coeff_2_1,
gdouble coeff_2_2);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
GimpItem* gimp_item_transform_translate (GimpItem *item,
gdouble off_x,
gdouble off_y);
GimpItem* gimp_item_transform_flip_simple (GimpItem *item,
GimpOrientationType flip_type,
gboolean auto_center,
gdouble axis);
GimpItem* gimp_item_transform_flip (GimpItem *item,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1);
GimpItem* gimp_item_transform_perspective (GimpItem *item,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
gdouble x3,
gdouble y3);
GimpItem* gimp_item_transform_rotate_simple (GimpItem *item,
GimpRotationType rotate_type,
gboolean auto_center,
gdouble center_x,
gdouble center_y);
GimpItem* gimp_item_transform_rotate (GimpItem *item,
gdouble angle,
gboolean auto_center,
gdouble center_x,
gdouble center_y);
GimpItem* gimp_item_transform_scale (GimpItem *item,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1);
GimpItem* gimp_item_transform_shear (GimpItem *item,
GimpOrientationType shear_type,
gdouble magnitude);
GimpItem* gimp_item_transform_2d (GimpItem *item,
gdouble source_x,
gdouble source_y,
gdouble scale_x,
gdouble scale_y,
gdouble angle,
gdouble dest_x,
gdouble dest_y);
GimpItem* gimp_item_transform_matrix (GimpItem *item,
gdouble coeff_0_0,
gdouble coeff_0_1,
gdouble coeff_0_2,
gdouble coeff_1_0,
gdouble coeff_1_1,
gdouble coeff_1_2,
gdouble coeff_2_0,
gdouble coeff_2_1,
gdouble coeff_2_2);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define gimp_item_transform_translate _gimp_item_transform_translate
#define gimp_item_transform_flip_simple _gimp_item_transform_flip_simple
#define gimp_item_transform_flip _gimp_item_transform_flip
#define gimp_item_transform_perspective _gimp_item_transform_perspective
#define gimp_item_transform_rotate_simple _gimp_item_transform_rotate_simple
#define gimp_item_transform_rotate _gimp_item_transform_rotate
#define gimp_item_transform_scale _gimp_item_transform_scale
#define gimp_item_transform_shear _gimp_item_transform_shear
#define gimp_item_transform_2d _gimp_item_transform_2d
#define gimp_item_transform_matrix _gimp_item_transform_matrix
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -104,7 +114,63 @@ gint32 gimp_item_transform_matrix (gint32 item_ID,
* They are not marked internal as a trick to keep the old API alive for now.
*/
gint32 _gimp_item_transform_translate (gint32 item_ID,
gdouble off_x,
gdouble off_y);
gint32 _gimp_item_transform_flip_simple (gint32 item_ID,
GimpOrientationType flip_type,
gboolean auto_center,
gdouble axis);
gint32 _gimp_item_transform_flip (gint32 item_ID,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1);
gint32 _gimp_item_transform_perspective (gint32 item_ID,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
gdouble x3,
gdouble y3);
gint32 _gimp_item_transform_rotate_simple (gint32 item_ID,
GimpRotationType rotate_type,
gboolean auto_center,
gdouble center_x,
gdouble center_y);
gint32 _gimp_item_transform_rotate (gint32 item_ID,
gdouble angle,
gboolean auto_center,
gdouble center_x,
gdouble center_y);
gint32 _gimp_item_transform_scale (gint32 item_ID,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1);
gint32 _gimp_item_transform_shear (gint32 item_ID,
GimpOrientationType shear_type,
gdouble magnitude);
gint32 _gimp_item_transform_2d (gint32 item_ID,
gdouble source_x,
gdouble source_y,
gdouble scale_x,
gdouble scale_y,
gdouble angle,
gdouble dest_x,
gdouble dest_y);
gint32 _gimp_item_transform_matrix (gint32 item_ID,
gdouble coeff_0_0,
gdouble coeff_0_1,
gdouble coeff_0_2,
gdouble coeff_1_0,
gdouble coeff_1_1,
gdouble coeff_1_2,
gdouble coeff_2_0,
gdouble coeff_2_1,
gdouble coeff_2_2);
G_END_DECLS

View file

@ -25,6 +25,25 @@
#include "gimp.h"
G_DEFINE_TYPE (GimpLayer, gimp_layer, GIMP_TYPE_DRAWABLE)
#define parent_class gimp_layer_parent_class
static void
gimp_layer_class_init (GimpLayerClass *klass)
{
}
static void
gimp_layer_init (GimpLayer *layer)
{
}
/* Public API. */
/**
* gimp_layer_new:
* @image: The image to which to add the layer.

View file

@ -29,6 +29,39 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_LAYER (gimp_layer_get_type ())
#define GIMP_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LAYER, GimpLayer))
#define GIMP_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LAYER, GimpLayerClass))
#define GIMP_IS_LAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LAYER))
#define GIMP_IS_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LAYER))
#define GIMP_LAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LAYER, GimpLayerClass))
typedef struct _GimpLayerClass GimpLayerClass;
typedef struct _GimpLayerPrivate GimpLayerPrivate;
struct _GimpLayer
{
GimpDrawable parent_instance;
};
struct _GimpLayerClass
{
GimpDrawableClass parent_class;
/* Padding for future expansion */
void (*_gimp_reserved1) (void);
void (*_gimp_reserved2) (void);
void (*_gimp_reserved3) (void);
void (*_gimp_reserved4) (void);
void (*_gimp_reserved5) (void);
void (*_gimp_reserved6) (void);
void (*_gimp_reserved7) (void);
void (*_gimp_reserved8) (void);
void (*_gimp_reserved9) (void);
};
GType gimp_layer_get_type (void) G_GNUC_CONST;
gint32 gimp_layer_copy (gint32 layer_ID);

File diff suppressed because it is too large Load diff

View file

@ -32,75 +32,76 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
G_GNUC_INTERNAL gint32 _gimp_layer_copy (gint32 layer_ID,
gboolean add_alpha);
gboolean gimp_layer_add_alpha (gint32 layer_ID);
gboolean gimp_layer_flatten (gint32 layer_ID);
gboolean gimp_layer_scale (gint32 layer_ID,
gint new_width,
gint new_height,
gboolean local_origin);
gboolean gimp_layer_resize (gint32 layer_ID,
gint new_width,
gint new_height,
gint offx,
gint offy);
gboolean gimp_layer_resize_to_image_size (gint32 layer_ID);
gboolean gimp_layer_set_offsets (gint32 layer_ID,
gint offx,
gint offy);
gint32 gimp_layer_create_mask (gint32 layer_ID,
GimpAddMaskType mask_type);
gint32 gimp_layer_get_mask (gint32 layer_ID);
gint32 gimp_layer_from_mask (gint32 mask_ID);
gboolean gimp_layer_add_mask (gint32 layer_ID,
gint32 mask_ID);
gboolean gimp_layer_remove_mask (gint32 layer_ID,
GimpMaskApplyMode mode);
gboolean gimp_layer_is_floating_sel (gint32 layer_ID);
gboolean gimp_layer_get_lock_alpha (gint32 layer_ID);
gboolean gimp_layer_set_lock_alpha (gint32 layer_ID,
gboolean lock_alpha);
gboolean gimp_layer_get_apply_mask (gint32 layer_ID);
gboolean gimp_layer_set_apply_mask (gint32 layer_ID,
gboolean apply_mask);
gboolean gimp_layer_get_show_mask (gint32 layer_ID);
gboolean gimp_layer_set_show_mask (gint32 layer_ID,
gboolean show_mask);
gboolean gimp_layer_get_edit_mask (gint32 layer_ID);
gboolean gimp_layer_set_edit_mask (gint32 layer_ID,
gboolean edit_mask);
gdouble gimp_layer_get_opacity (gint32 layer_ID);
gboolean gimp_layer_set_opacity (gint32 layer_ID,
gdouble opacity);
GimpLayerMode gimp_layer_get_mode (gint32 layer_ID);
gboolean gimp_layer_set_mode (gint32 layer_ID,
GimpLayerMode mode);
GimpLayerColorSpace gimp_layer_get_blend_space (gint32 layer_ID);
gboolean gimp_layer_set_blend_space (gint32 layer_ID,
GimpLayerColorSpace blend_space);
GimpLayerColorSpace gimp_layer_get_composite_space (gint32 layer_ID);
gboolean gimp_layer_set_composite_space (gint32 layer_ID,
GimpLayerColorSpace composite_space);
GimpLayerCompositeMode gimp_layer_get_composite_mode (gint32 layer_ID);
gboolean gimp_layer_set_composite_mode (gint32 layer_ID,
GimpLayerCompositeMode composite_mode);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
G_GNUC_INTERNAL gint32 _gimp_layer_new (GimpImage *image,
gint width,
gint height,
GimpImageType type,
const gchar *name,
gdouble opacity,
GimpLayerMode mode);
gint32 gimp_layer_new_from_visible (GimpImage *image,
GimpImage *dest_image,
const gchar *name);
gint32 gimp_layer_new_from_drawable (gint32 drawable_ID,
GimpImage *dest_image);
gint32 gimp_layer_group_new (GimpImage *image);
G_GNUC_INTERNAL GimpLayer* _gimp_layer_new (GimpImage *image,
gint width,
gint height,
GimpImageType type,
const gchar *name,
gdouble opacity,
GimpLayerMode mode);
GimpLayer* gimp_layer_new_from_visible (GimpImage *image,
GimpImage *dest_image,
const gchar *name);
GimpLayer* gimp_layer_new_from_drawable (GimpDrawable *drawable,
GimpImage *dest_image);
GimpLayer* gimp_layer_group_new (GimpImage *image);
G_GNUC_INTERNAL GimpLayer* _gimp_layer_copy (GimpLayer *layer,
gboolean add_alpha);
gboolean gimp_layer_add_alpha (GimpLayer *layer);
gboolean gimp_layer_flatten (GimpLayer *layer);
gboolean gimp_layer_scale (GimpLayer *layer,
gint new_width,
gint new_height,
gboolean local_origin);
gboolean gimp_layer_resize (GimpLayer *layer,
gint new_width,
gint new_height,
gint offx,
gint offy);
gboolean gimp_layer_resize_to_image_size (GimpLayer *layer);
gboolean gimp_layer_set_offsets (GimpLayer *layer,
gint offx,
gint offy);
gint32 gimp_layer_create_mask (GimpLayer *layer,
GimpAddMaskType mask_type);
gint32 gimp_layer_get_mask (GimpLayer *layer);
GimpLayer* gimp_layer_from_mask (gint32 mask_ID);
gboolean gimp_layer_add_mask (GimpLayer *layer,
gint32 mask_ID);
gboolean gimp_layer_remove_mask (GimpLayer *layer,
GimpMaskApplyMode mode);
gboolean gimp_layer_is_floating_sel (GimpLayer *layer);
gboolean gimp_layer_get_lock_alpha (GimpLayer *layer);
gboolean gimp_layer_set_lock_alpha (GimpLayer *layer,
gboolean lock_alpha);
gboolean gimp_layer_get_apply_mask (GimpLayer *layer);
gboolean gimp_layer_set_apply_mask (GimpLayer *layer,
gboolean apply_mask);
gboolean gimp_layer_get_show_mask (GimpLayer *layer);
gboolean gimp_layer_set_show_mask (GimpLayer *layer,
gboolean show_mask);
gboolean gimp_layer_get_edit_mask (GimpLayer *layer);
gboolean gimp_layer_set_edit_mask (GimpLayer *layer,
gboolean edit_mask);
gdouble gimp_layer_get_opacity (GimpLayer *layer);
gboolean gimp_layer_set_opacity (GimpLayer *layer,
gdouble opacity);
GimpLayerMode gimp_layer_get_mode (GimpLayer *layer);
gboolean gimp_layer_set_mode (GimpLayer *layer,
GimpLayerMode mode);
GimpLayerColorSpace gimp_layer_get_blend_space (GimpLayer *layer);
gboolean gimp_layer_set_blend_space (GimpLayer *layer,
GimpLayerColorSpace blend_space);
GimpLayerColorSpace gimp_layer_get_composite_space (GimpLayer *layer);
gboolean gimp_layer_set_composite_space (GimpLayer *layer,
GimpLayerColorSpace composite_space);
GimpLayerCompositeMode gimp_layer_get_composite_mode (GimpLayer *layer);
gboolean gimp_layer_set_composite_mode (GimpLayer *layer,
GimpLayerCompositeMode composite_mode);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -108,6 +109,37 @@ gint32 gimp_layer_group_new (GimpImage *image);
#define gimp_layer_new_from_visible _gimp_layer_new_from_visible
#define gimp_layer_new_from_drawable _gimp_layer_new_from_drawable
#define gimp_layer_group_new _gimp_layer_group_new
#define _gimp_layer_copy __gimp_layer_copy
#define gimp_layer_add_alpha _gimp_layer_add_alpha
#define gimp_layer_flatten _gimp_layer_flatten
#define gimp_layer_scale _gimp_layer_scale
#define gimp_layer_resize _gimp_layer_resize
#define gimp_layer_resize_to_image_size _gimp_layer_resize_to_image_size
#define gimp_layer_set_offsets _gimp_layer_set_offsets
#define gimp_layer_create_mask _gimp_layer_create_mask
#define gimp_layer_get_mask _gimp_layer_get_mask
#define gimp_layer_from_mask _gimp_layer_from_mask
#define gimp_layer_add_mask _gimp_layer_add_mask
#define gimp_layer_remove_mask _gimp_layer_remove_mask
#define gimp_layer_is_floating_sel _gimp_layer_is_floating_sel
#define gimp_layer_get_lock_alpha _gimp_layer_get_lock_alpha
#define gimp_layer_set_lock_alpha _gimp_layer_set_lock_alpha
#define gimp_layer_get_apply_mask _gimp_layer_get_apply_mask
#define gimp_layer_set_apply_mask _gimp_layer_set_apply_mask
#define gimp_layer_get_show_mask _gimp_layer_get_show_mask
#define gimp_layer_set_show_mask _gimp_layer_set_show_mask
#define gimp_layer_get_edit_mask _gimp_layer_get_edit_mask
#define gimp_layer_set_edit_mask _gimp_layer_set_edit_mask
#define gimp_layer_get_opacity _gimp_layer_get_opacity
#define gimp_layer_set_opacity _gimp_layer_set_opacity
#define gimp_layer_get_mode _gimp_layer_get_mode
#define gimp_layer_set_mode _gimp_layer_set_mode
#define gimp_layer_get_blend_space _gimp_layer_get_blend_space
#define gimp_layer_set_blend_space _gimp_layer_set_blend_space
#define gimp_layer_get_composite_space _gimp_layer_get_composite_space
#define gimp_layer_set_composite_space _gimp_layer_set_composite_space
#define gimp_layer_get_composite_mode _gimp_layer_get_composite_mode
#define gimp_layer_set_composite_mode _gimp_layer_set_composite_mode
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -116,19 +148,72 @@ gint32 gimp_layer_group_new (GimpImage *image);
* They are not marked internal as a trick to keep the old API alive for now.
*/
gint32 __gimp_layer_new (gint32 image_ID,
gint width,
gint height,
GimpImageType type,
const gchar *name,
gdouble opacity,
GimpLayerMode mode);
gint32 _gimp_layer_new_from_visible (gint32 image_ID,
gint32 dest_image_ID,
const gchar *name);
gint32 _gimp_layer_new_from_drawable (gint32 drawable_ID,
gint32 dest_image_ID);
gint32 _gimp_layer_group_new (gint32 image_ID);
gint32 __gimp_layer_new (gint32 image_ID,
gint width,
gint height,
GimpImageType type,
const gchar *name,
gdouble opacity,
GimpLayerMode mode);
gint32 _gimp_layer_new_from_visible (gint32 image_ID,
gint32 dest_image_ID,
const gchar *name);
gint32 _gimp_layer_new_from_drawable (gint32 drawable_ID,
gint32 dest_image_ID);
gint32 _gimp_layer_group_new (gint32 image_ID);
gint32 __gimp_layer_copy (gint32 layer_ID,
gboolean add_alpha);
gboolean _gimp_layer_add_alpha (gint32 layer_ID);
gboolean _gimp_layer_flatten (gint32 layer_ID);
gboolean _gimp_layer_scale (gint32 layer_ID,
gint new_width,
gint new_height,
gboolean local_origin);
gboolean _gimp_layer_resize (gint32 layer_ID,
gint new_width,
gint new_height,
gint offx,
gint offy);
gboolean _gimp_layer_resize_to_image_size (gint32 layer_ID);
gboolean _gimp_layer_set_offsets (gint32 layer_ID,
gint offx,
gint offy);
gint32 _gimp_layer_create_mask (gint32 layer_ID,
GimpAddMaskType mask_type);
gint32 _gimp_layer_get_mask (gint32 layer_ID);
gint32 _gimp_layer_from_mask (gint32 mask_ID);
gboolean _gimp_layer_add_mask (gint32 layer_ID,
gint32 mask_ID);
gboolean _gimp_layer_remove_mask (gint32 layer_ID,
GimpMaskApplyMode mode);
gboolean _gimp_layer_is_floating_sel (gint32 layer_ID);
gboolean _gimp_layer_get_lock_alpha (gint32 layer_ID);
gboolean _gimp_layer_set_lock_alpha (gint32 layer_ID,
gboolean lock_alpha);
gboolean _gimp_layer_get_apply_mask (gint32 layer_ID);
gboolean _gimp_layer_set_apply_mask (gint32 layer_ID,
gboolean apply_mask);
gboolean _gimp_layer_get_show_mask (gint32 layer_ID);
gboolean _gimp_layer_set_show_mask (gint32 layer_ID,
gboolean show_mask);
gboolean _gimp_layer_get_edit_mask (gint32 layer_ID);
gboolean _gimp_layer_set_edit_mask (gint32 layer_ID,
gboolean edit_mask);
gdouble _gimp_layer_get_opacity (gint32 layer_ID);
gboolean _gimp_layer_set_opacity (gint32 layer_ID,
gdouble opacity);
GimpLayerMode _gimp_layer_get_mode (gint32 layer_ID);
gboolean _gimp_layer_set_mode (gint32 layer_ID,
GimpLayerMode mode);
GimpLayerColorSpace _gimp_layer_get_blend_space (gint32 layer_ID);
gboolean _gimp_layer_set_blend_space (gint32 layer_ID,
GimpLayerColorSpace blend_space);
GimpLayerColorSpace _gimp_layer_get_composite_space (gint32 layer_ID);
gboolean _gimp_layer_set_composite_space (gint32 layer_ID,
GimpLayerColorSpace composite_space);
GimpLayerCompositeMode _gimp_layer_get_composite_mode (gint32 layer_ID);
gboolean _gimp_layer_set_composite_mode (gint32 layer_ID,
GimpLayerCompositeMode composite_mode);
G_END_DECLS

File diff suppressed because it is too large Load diff

View file

@ -32,83 +32,100 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_airbrush (gint32 drawable_ID,
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
gboolean gimp_airbrush (GimpDrawable *drawable,
gdouble pressure,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_airbrush_default (gint32 drawable_ID,
gboolean gimp_airbrush_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_clone (gint32 drawable_ID,
gint32 src_drawable_ID,
gboolean gimp_clone (GimpDrawable *drawable,
GimpDrawable *src_drawable,
GimpCloneType clone_type,
gdouble src_x,
gdouble src_y,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_clone_default (gint32 drawable_ID,
gboolean gimp_clone_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_convolve (gint32 drawable_ID,
gboolean gimp_convolve (GimpDrawable *drawable,
gdouble pressure,
GimpConvolveType convolve_type,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_convolve_default (gint32 drawable_ID,
gboolean gimp_convolve_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_dodgeburn (gint32 drawable_ID,
gboolean gimp_dodgeburn (GimpDrawable *drawable,
gdouble exposure,
GimpDodgeBurnType dodgeburn_type,
GimpTransferMode dodgeburn_mode,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_dodgeburn_default (gint32 drawable_ID,
gboolean gimp_dodgeburn_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_eraser (gint32 drawable_ID,
gboolean gimp_eraser (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes,
GimpBrushApplicationMode hardness,
GimpPaintApplicationMode method);
gboolean gimp_eraser_default (gint32 drawable_ID,
gboolean gimp_eraser_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_heal (gint32 drawable_ID,
gint32 src_drawable_ID,
gboolean gimp_heal (GimpDrawable *drawable,
GimpDrawable *src_drawable,
gdouble src_x,
gdouble src_y,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_heal_default (gint32 drawable_ID,
gboolean gimp_heal_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_paintbrush (gint32 drawable_ID,
gboolean gimp_paintbrush (GimpDrawable *drawable,
gdouble fade_out,
gint num_strokes,
const gdouble *strokes,
GimpPaintApplicationMode method,
gdouble gradient_length);
gboolean gimp_paintbrush_default (gint32 drawable_ID,
gboolean gimp_paintbrush_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_pencil (gint32 drawable_ID,
gboolean gimp_pencil (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_smudge (gint32 drawable_ID,
gboolean gimp_smudge (GimpDrawable *drawable,
gdouble pressure,
gint num_strokes,
const gdouble *strokes);
gboolean gimp_smudge_default (gint32 drawable_ID,
gboolean gimp_smudge_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define gimp_airbrush _gimp_airbrush
#define gimp_airbrush_default _gimp_airbrush_default
#define gimp_clone _gimp_clone
#define gimp_clone_default _gimp_clone_default
#define gimp_convolve _gimp_convolve
#define gimp_convolve_default _gimp_convolve_default
#define gimp_dodgeburn _gimp_dodgeburn
#define gimp_dodgeburn_default _gimp_dodgeburn_default
#define gimp_eraser _gimp_eraser
#define gimp_eraser_default _gimp_eraser_default
#define gimp_heal _gimp_heal
#define gimp_heal_default _gimp_heal_default
#define gimp_paintbrush _gimp_paintbrush
#define gimp_paintbrush_default _gimp_paintbrush_default
#define gimp_pencil _gimp_pencil
#define gimp_smudge _gimp_smudge
#define gimp_smudge_default _gimp_smudge_default
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -117,7 +134,76 @@ gboolean gimp_smudge_default (gint32 drawable_ID,
* They are not marked internal as a trick to keep the old API alive for now.
*/
gboolean _gimp_airbrush (gint32 drawable_ID,
gdouble pressure,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_airbrush_default (gint32 drawable_ID,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_clone (gint32 drawable_ID,
gint32 src_drawable_ID,
GimpCloneType clone_type,
gdouble src_x,
gdouble src_y,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_clone_default (gint32 drawable_ID,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_convolve (gint32 drawable_ID,
gdouble pressure,
GimpConvolveType convolve_type,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_convolve_default (gint32 drawable_ID,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_dodgeburn (gint32 drawable_ID,
gdouble exposure,
GimpDodgeBurnType dodgeburn_type,
GimpTransferMode dodgeburn_mode,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_dodgeburn_default (gint32 drawable_ID,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_eraser (gint32 drawable_ID,
gint num_strokes,
const gdouble *strokes,
GimpBrushApplicationMode hardness,
GimpPaintApplicationMode method);
gboolean _gimp_eraser_default (gint32 drawable_ID,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_heal (gint32 drawable_ID,
gint32 src_drawable_ID,
gdouble src_x,
gdouble src_y,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_heal_default (gint32 drawable_ID,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_paintbrush (gint32 drawable_ID,
gdouble fade_out,
gint num_strokes,
const gdouble *strokes,
GimpPaintApplicationMode method,
gdouble gradient_length);
gboolean _gimp_paintbrush_default (gint32 drawable_ID,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_pencil (gint32 drawable_ID,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_smudge (gint32 drawable_ID,
gdouble pressure,
gint num_strokes,
const gdouble *strokes);
gboolean _gimp_smudge_default (gint32 drawable_ID,
gint num_strokes,
const gdouble *strokes);
G_END_DECLS

View file

@ -444,6 +444,56 @@ _gimp_selection_translate (gint32 image_ID,
/**
* _gimp_selection_float:
* @drawable: The drawable from which to float selection.
* @offx: x offset for translation.
* @offy: y offset for translation.
*
* Float the selection from the specified drawable with initial offsets
* as specified.
*
* This procedure determines the region of the specified drawable that
* lies beneath the current selection. The region is then cut from the
* drawable and the resulting data is made into a new layer which is
* instantiated as a floating selection. The offsets allow initial
* positioning of the new floating selection.
*
* Returns: (transfer full): The floated layer.
**/
GimpLayer *
_gimp_selection_float (GimpDrawable *drawable,
gint offx,
gint offy)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_INT, offx,
G_TYPE_INT, offy,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-float",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-float",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return layer;
}
/**
* __gimp_selection_float: (skip)
* @drawable_ID: The drawable from which to float selection.
* @offx: x offset for translation.
* @offy: y offset for translation.
@ -460,9 +510,9 @@ _gimp_selection_translate (gint32 image_ID,
* Returns: The floated layer.
**/
gint32
_gimp_selection_float (gint32 drawable_ID,
gint offx,
gint offy)
__gimp_selection_float (gint32 drawable_ID,
gint offx,
gint offy)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;

View file

@ -32,39 +32,40 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
G_GNUC_INTERNAL gint32 _gimp_selection_float (gint32 drawable_ID,
gint offx,
gint offy);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
gboolean gimp_selection_bounds (GimpImage *image,
gboolean *non_empty,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gint gimp_selection_value (GimpImage *image,
gint x,
gint y);
gboolean gimp_selection_is_empty (GimpImage *image);
gboolean gimp_selection_translate (GimpImage *image,
gint offx,
gint offy);
gboolean gimp_selection_invert (GimpImage *image);
gboolean gimp_selection_sharpen (GimpImage *image);
gboolean gimp_selection_all (GimpImage *image);
gboolean gimp_selection_none (GimpImage *image);
gboolean gimp_selection_feather (GimpImage *image,
gdouble radius);
gboolean gimp_selection_border (GimpImage *image,
gint radius);
gboolean gimp_selection_grow (GimpImage *image,
gint steps);
gboolean gimp_selection_shrink (GimpImage *image,
gint steps);
gboolean gimp_selection_flood (GimpImage *image);
gint32 gimp_selection_save (GimpImage *image);
gboolean gimp_selection_bounds (GimpImage *image,
gboolean *non_empty,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gint gimp_selection_value (GimpImage *image,
gint x,
gint y);
gboolean gimp_selection_is_empty (GimpImage *image);
gboolean gimp_selection_translate (GimpImage *image,
gint offx,
gint offy);
G_GNUC_INTERNAL GimpLayer* _gimp_selection_float (GimpDrawable *drawable,
gint offx,
gint offy);
gboolean gimp_selection_invert (GimpImage *image);
gboolean gimp_selection_sharpen (GimpImage *image);
gboolean gimp_selection_all (GimpImage *image);
gboolean gimp_selection_none (GimpImage *image);
gboolean gimp_selection_feather (GimpImage *image,
gdouble radius);
gboolean gimp_selection_border (GimpImage *image,
gint radius);
gboolean gimp_selection_grow (GimpImage *image,
gint steps);
gboolean gimp_selection_shrink (GimpImage *image,
gint steps);
gboolean gimp_selection_flood (GimpImage *image);
gint32 gimp_selection_save (GimpImage *image);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -72,6 +73,7 @@ gint32 gimp_selection_save (GimpImage *image);
#define gimp_selection_value _gimp_selection_value
#define gimp_selection_is_empty _gimp_selection_is_empty
#define gimp_selection_translate _gimp_selection_translate
#define _gimp_selection_float __gimp_selection_float
#define gimp_selection_invert _gimp_selection_invert
#define gimp_selection_sharpen _gimp_selection_sharpen
#define gimp_selection_all _gimp_selection_all
@ -103,6 +105,9 @@ gboolean _gimp_selection_is_empty (gint32 image_ID);
gboolean _gimp_selection_translate (gint32 image_ID,
gint offx,
gint offy);
gint32 __gimp_selection_float (gint32 drawable_ID,
gint offx,
gint offy);
gboolean _gimp_selection_invert (gint32 image_ID);
gboolean _gimp_selection_sharpen (gint32 image_ID);
gboolean _gimp_selection_all (gint32 image_ID);

File diff suppressed because it is too large Load diff

View file

@ -32,64 +32,93 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gchar* gimp_text_layer_get_text (gint32 layer_ID);
gboolean gimp_text_layer_set_text (gint32 layer_ID,
const gchar *text);
gchar* gimp_text_layer_get_markup (gint32 layer_ID);
gchar* gimp_text_layer_get_font (gint32 layer_ID);
gboolean gimp_text_layer_set_font (gint32 layer_ID,
const gchar *font);
gdouble gimp_text_layer_get_font_size (gint32 layer_ID,
GimpUnit *unit);
gboolean gimp_text_layer_set_font_size (gint32 layer_ID,
gdouble font_size,
GimpUnit unit);
gboolean gimp_text_layer_get_antialias (gint32 layer_ID);
gboolean gimp_text_layer_set_antialias (gint32 layer_ID,
gboolean antialias);
GimpTextHintStyle gimp_text_layer_get_hint_style (gint32 layer_ID);
gboolean gimp_text_layer_set_hint_style (gint32 layer_ID,
GimpTextHintStyle style);
gboolean gimp_text_layer_get_kerning (gint32 layer_ID);
gboolean gimp_text_layer_set_kerning (gint32 layer_ID,
gboolean kerning);
gchar* gimp_text_layer_get_language (gint32 layer_ID);
gboolean gimp_text_layer_set_language (gint32 layer_ID,
const gchar *language);
GimpTextDirection gimp_text_layer_get_base_direction (gint32 layer_ID);
gboolean gimp_text_layer_set_base_direction (gint32 layer_ID,
GimpTextDirection direction);
GimpTextJustification gimp_text_layer_get_justification (gint32 layer_ID);
gboolean gimp_text_layer_set_justification (gint32 layer_ID,
GimpTextJustification justify);
gboolean gimp_text_layer_get_color (gint32 layer_ID,
GimpRGB *color);
gboolean gimp_text_layer_set_color (gint32 layer_ID,
const GimpRGB *color);
gdouble gimp_text_layer_get_indent (gint32 layer_ID);
gboolean gimp_text_layer_set_indent (gint32 layer_ID,
gdouble indent);
gdouble gimp_text_layer_get_line_spacing (gint32 layer_ID);
gboolean gimp_text_layer_set_line_spacing (gint32 layer_ID,
gdouble line_spacing);
gdouble gimp_text_layer_get_letter_spacing (gint32 layer_ID);
gboolean gimp_text_layer_set_letter_spacing (gint32 layer_ID,
gdouble letter_spacing);
gboolean gimp_text_layer_resize (gint32 layer_ID,
gdouble width,
gdouble height);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
gint32 gimp_text_layer_new (GimpImage *image,
const gchar *text,
const gchar *fontname,
gdouble size,
GimpUnit unit);
GimpLayer* gimp_text_layer_new (GimpImage *image,
const gchar *text,
const gchar *fontname,
gdouble size,
GimpUnit unit);
gchar* gimp_text_layer_get_text (GimpLayer *layer);
gboolean gimp_text_layer_set_text (GimpLayer *layer,
const gchar *text);
gchar* gimp_text_layer_get_markup (GimpLayer *layer);
gchar* gimp_text_layer_get_font (GimpLayer *layer);
gboolean gimp_text_layer_set_font (GimpLayer *layer,
const gchar *font);
gdouble gimp_text_layer_get_font_size (GimpLayer *layer,
GimpUnit *unit);
gboolean gimp_text_layer_set_font_size (GimpLayer *layer,
gdouble font_size,
GimpUnit unit);
gboolean gimp_text_layer_get_antialias (GimpLayer *layer);
gboolean gimp_text_layer_set_antialias (GimpLayer *layer,
gboolean antialias);
GimpTextHintStyle gimp_text_layer_get_hint_style (GimpLayer *layer);
gboolean gimp_text_layer_set_hint_style (GimpLayer *layer,
GimpTextHintStyle style);
gboolean gimp_text_layer_get_kerning (GimpLayer *layer);
gboolean gimp_text_layer_set_kerning (GimpLayer *layer,
gboolean kerning);
gchar* gimp_text_layer_get_language (GimpLayer *layer);
gboolean gimp_text_layer_set_language (GimpLayer *layer,
const gchar *language);
GimpTextDirection gimp_text_layer_get_base_direction (GimpLayer *layer);
gboolean gimp_text_layer_set_base_direction (GimpLayer *layer,
GimpTextDirection direction);
GimpTextJustification gimp_text_layer_get_justification (GimpLayer *layer);
gboolean gimp_text_layer_set_justification (GimpLayer *layer,
GimpTextJustification justify);
gboolean gimp_text_layer_get_color (GimpLayer *layer,
GimpRGB *color);
gboolean gimp_text_layer_set_color (GimpLayer *layer,
const GimpRGB *color);
gdouble gimp_text_layer_get_indent (GimpLayer *layer);
gboolean gimp_text_layer_set_indent (GimpLayer *layer,
gdouble indent);
gdouble gimp_text_layer_get_line_spacing (GimpLayer *layer);
gboolean gimp_text_layer_set_line_spacing (GimpLayer *layer,
gdouble line_spacing);
gdouble gimp_text_layer_get_letter_spacing (GimpLayer *layer);
gboolean gimp_text_layer_set_letter_spacing (GimpLayer *layer,
gdouble letter_spacing);
gboolean gimp_text_layer_resize (GimpLayer *layer,
gdouble width,
gdouble height);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define gimp_text_layer_new _gimp_text_layer_new
#define gimp_text_layer_get_text _gimp_text_layer_get_text
#define gimp_text_layer_set_text _gimp_text_layer_set_text
#define gimp_text_layer_get_markup _gimp_text_layer_get_markup
#define gimp_text_layer_get_font _gimp_text_layer_get_font
#define gimp_text_layer_set_font _gimp_text_layer_set_font
#define gimp_text_layer_get_font_size _gimp_text_layer_get_font_size
#define gimp_text_layer_set_font_size _gimp_text_layer_set_font_size
#define gimp_text_layer_get_antialias _gimp_text_layer_get_antialias
#define gimp_text_layer_set_antialias _gimp_text_layer_set_antialias
#define gimp_text_layer_get_hint_style _gimp_text_layer_get_hint_style
#define gimp_text_layer_set_hint_style _gimp_text_layer_set_hint_style
#define gimp_text_layer_get_kerning _gimp_text_layer_get_kerning
#define gimp_text_layer_set_kerning _gimp_text_layer_set_kerning
#define gimp_text_layer_get_language _gimp_text_layer_get_language
#define gimp_text_layer_set_language _gimp_text_layer_set_language
#define gimp_text_layer_get_base_direction _gimp_text_layer_get_base_direction
#define gimp_text_layer_set_base_direction _gimp_text_layer_set_base_direction
#define gimp_text_layer_get_justification _gimp_text_layer_get_justification
#define gimp_text_layer_set_justification _gimp_text_layer_set_justification
#define gimp_text_layer_get_color _gimp_text_layer_get_color
#define gimp_text_layer_set_color _gimp_text_layer_set_color
#define gimp_text_layer_get_indent _gimp_text_layer_get_indent
#define gimp_text_layer_set_indent _gimp_text_layer_set_indent
#define gimp_text_layer_get_line_spacing _gimp_text_layer_get_line_spacing
#define gimp_text_layer_set_line_spacing _gimp_text_layer_set_line_spacing
#define gimp_text_layer_get_letter_spacing _gimp_text_layer_get_letter_spacing
#define gimp_text_layer_set_letter_spacing _gimp_text_layer_set_letter_spacing
#define gimp_text_layer_resize _gimp_text_layer_resize
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -98,11 +127,57 @@ gint32 gimp_text_layer_new (GimpImage *image,
* They are not marked internal as a trick to keep the old API alive for now.
*/
gint32 _gimp_text_layer_new (gint32 image_ID,
const gchar *text,
const gchar *fontname,
gdouble size,
GimpUnit unit);
gint32 _gimp_text_layer_new (gint32 image_ID,
const gchar *text,
const gchar *fontname,
gdouble size,
GimpUnit unit);
gchar* _gimp_text_layer_get_text (gint32 layer_ID);
gboolean _gimp_text_layer_set_text (gint32 layer_ID,
const gchar *text);
gchar* _gimp_text_layer_get_markup (gint32 layer_ID);
gchar* _gimp_text_layer_get_font (gint32 layer_ID);
gboolean _gimp_text_layer_set_font (gint32 layer_ID,
const gchar *font);
gdouble _gimp_text_layer_get_font_size (gint32 layer_ID,
GimpUnit *unit);
gboolean _gimp_text_layer_set_font_size (gint32 layer_ID,
gdouble font_size,
GimpUnit unit);
gboolean _gimp_text_layer_get_antialias (gint32 layer_ID);
gboolean _gimp_text_layer_set_antialias (gint32 layer_ID,
gboolean antialias);
GimpTextHintStyle _gimp_text_layer_get_hint_style (gint32 layer_ID);
gboolean _gimp_text_layer_set_hint_style (gint32 layer_ID,
GimpTextHintStyle style);
gboolean _gimp_text_layer_get_kerning (gint32 layer_ID);
gboolean _gimp_text_layer_set_kerning (gint32 layer_ID,
gboolean kerning);
gchar* _gimp_text_layer_get_language (gint32 layer_ID);
gboolean _gimp_text_layer_set_language (gint32 layer_ID,
const gchar *language);
GimpTextDirection _gimp_text_layer_get_base_direction (gint32 layer_ID);
gboolean _gimp_text_layer_set_base_direction (gint32 layer_ID,
GimpTextDirection direction);
GimpTextJustification _gimp_text_layer_get_justification (gint32 layer_ID);
gboolean _gimp_text_layer_set_justification (gint32 layer_ID,
GimpTextJustification justify);
gboolean _gimp_text_layer_get_color (gint32 layer_ID,
GimpRGB *color);
gboolean _gimp_text_layer_set_color (gint32 layer_ID,
const GimpRGB *color);
gdouble _gimp_text_layer_get_indent (gint32 layer_ID);
gboolean _gimp_text_layer_set_indent (gint32 layer_ID,
gdouble indent);
gdouble _gimp_text_layer_get_line_spacing (gint32 layer_ID);
gboolean _gimp_text_layer_set_line_spacing (gint32 layer_ID,
gdouble line_spacing);
gdouble _gimp_text_layer_get_letter_spacing (gint32 layer_ID);
gboolean _gimp_text_layer_set_letter_spacing (gint32 layer_ID,
gdouble letter_spacing);
gboolean _gimp_text_layer_resize (gint32 layer_ID,
gdouble width,
gdouble height);
G_END_DECLS

View file

@ -37,7 +37,7 @@
/**
* gimp_text_fontname:
* @image: The image.
* @drawable_ID: The affected drawable: (-1 for a new text layer).
* @drawable: The affected drawable: (-1 for a new text layer).
* @x: The x coordinate for the left of the text bounding box.
* @y: The y coordinate for the top of the text bounding box.
* @text: The text to generate (in UTF-8 encoding).
@ -64,11 +64,11 @@
* divide the size in points by 72.0 and multiply it by the image's
* vertical resolution.
*
* Returns: The new text layer or -1 if no layer was created.
* Returns: (transfer full): The new text layer or -1 if no layer was created.
**/
gint32
GimpLayer *
gimp_text_fontname (GimpImage *image,
gint32 drawable_ID,
GimpDrawable *drawable,
gdouble x,
gdouble y,
const gchar *text,
@ -81,11 +81,11 @@ gimp_text_fontname (GimpImage *image,
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 text_layer_ID = -1;
GimpLayer *text_layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_DOUBLE, x,
G_TYPE_DOUBLE, y,
G_TYPE_STRING, text,
@ -106,11 +106,11 @@ gimp_text_fontname (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
text_layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
text_layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return text_layer_ID;
return text_layer;
}
/**

View file

@ -43,16 +43,16 @@ gboolean gimp_text_get_extents_fontname (const gchar *text,
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
gint32 gimp_text_fontname (GimpImage *image,
gint32 drawable_ID,
gdouble x,
gdouble y,
const gchar *text,
gint border,
gboolean antialias,
gdouble size,
GimpSizeType size_type,
const gchar *fontname);
GimpLayer* gimp_text_fontname (GimpImage *image,
GimpDrawable *drawable,
gdouble x,
gdouble y,
const gchar *text,
gint border,
gboolean antialias,
gdouble size,
GimpSizeType size_type,
const gchar *fontname);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */

View file

@ -38,6 +38,9 @@ typedef union _GimpParamData GimpParamData;
typedef struct _GimpParam GimpParam;
typedef struct _GimpImage GimpImage;
typedef struct _GimpItem GimpItem;
typedef struct _GimpDrawable GimpDrawable;
typedef struct _GimpLayer GimpLayer;
/* FIXME move somewhere else */

View file

@ -127,7 +127,7 @@ _gimp_vectors_new (gint32 image_ID,
/**
* gimp_vectors_new_from_text_layer:
* @image: The image.
* @layer_ID: The text layer.
* @layer: The text layer.
*
* Creates a new vectors object from a text layer.
*
@ -140,7 +140,7 @@ _gimp_vectors_new (gint32 image_ID,
**/
gint32
gimp_vectors_new_from_text_layer (GimpImage *image,
gint32 layer_ID)
GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -149,7 +149,7 @@ gimp_vectors_new_from_text_layer (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_LAYER_ID, layer_ID,
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)

View file

@ -121,7 +121,7 @@ gint gimp_vectors_bezier_stroke_new_ellipse (gint32
gint32 gimp_vectors_new (GimpImage *image,
const gchar *name);
gint32 gimp_vectors_new_from_text_layer (GimpImage *image,
gint32 layer_ID);
GimpLayer *layer);
gboolean gimp_vectors_import_from_file (GimpImage *image,
const gchar *filename,
gboolean merge,

View file

@ -45,8 +45,17 @@ sub desc_wrap {
return $wrapped;
}
sub is_id_arg {
my ($arg) = @_;
return ($arg->{name} eq 'IMAGE' ||
$arg->{name} eq 'ITEM' ||
$arg->{name} eq 'DRAWABLE' ||
$arg->{name} eq 'LAYER');
}
sub generate_fun {
my ($proc, $out, $api_deprecated, $has_image_arg) = @_;
my ($proc, $out, $api_deprecated, $has_id_arg) = @_;
my @inargs = @{$proc->{inargs}} if (defined $proc->{inargs});
my @outargs = @{$proc->{outargs}} if (defined $proc->{outargs});
@ -58,7 +67,7 @@ sub generate_fun {
my $argtype = $arg_types{$type};
my $rettype = '';
if ($api_deprecated && $argtype->{name} eq 'IMAGE') {
if ($api_deprecated && is_id_arg($argtype)) {
return 'gint32 ';
}
@ -211,7 +220,7 @@ sub generate_fun {
my $desc = exists $_->{desc} ? $_->{desc} : "";
my $var_len;
my $value;
my $is_id = ($arg->{id} || ($api_deprecated && $arg->{name} eq 'IMAGE'));
my $is_id = ($arg->{id} || ($api_deprecated && is_id_arg($arg)));
$var .= '_ID' if $is_id;
@ -309,7 +318,7 @@ sub generate_fun {
my ($type) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
my $var;
my $is_id = ($arg->{id} || ($api_deprecated && $arg->{name} eq 'IMAGE'));
my $is_id = ($arg->{id} || ($api_deprecated && is_id_arg($arg)));
$return_marshal = "" unless $once++;
@ -390,7 +399,7 @@ CODE
my ($type) = &arg_parse($_->{type});
my $desc = exists $_->{desc} ? $_->{desc} : "";
my $arg = $arg_types{$type};
my $is_id = ($arg->{id} || ($api_deprecated && $arg->{name} eq 'IMAGE'));
my $is_id = ($arg->{id} || ($api_deprecated && is_id_arg($arg)));
my $var;
# The return value variable
@ -521,7 +530,7 @@ CODE
push @{$out->{protos_deprecated}}, $proto;
push @{$out->{defines_deprecated}}, $define_dep;
}
elsif (! $has_image_arg){
elsif (! $has_id_arg){
push @{$out->{protos_no_alt}}, $proto;
}
else {
@ -720,28 +729,28 @@ sub generate {
my @outargs = @{$proc->{outargs}} if (defined $proc->{outargs});
# Check if any of the argument or returned value is an image.
$has_image_arg = 0;
$has_id_arg = 0;
foreach (@outargs) {
my ($type, @typeinfo) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
if ($arg->{name} eq 'IMAGE') {
$has_image_arg = 1;
if (is_id_arg($arg)) {
$has_id_arg = 1;
last;
}
}
unless ($has_image_arg) {
unless ($has_id_arg) {
foreach (@inargs) {
my ($type, @typeinfo) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
if ($arg->{name} eq 'IMAGE') {
$has_image_arg = 1;
if (is_id_arg($arg)) {
$has_id_arg = 1;
last;
}
}
}
$out->{code} .= generate_fun($proc, $out, 0, $has_image_arg);
if ($has_image_arg) {
$out->{code} .= generate_fun($proc, $out, 1, $has_image_arg);
$out->{code} .= generate_fun($proc, $out, 0, $has_id_arg);
if ($has_id_arg) {
$out->{code} .= generate_fun($proc, $out, 1, $has_id_arg);
}
}

View file

@ -177,24 +177,28 @@ package Gimp::CodeGen::pdb;
gtype => 'GIMP_TYPE_ITEM_ID',
type => 'GimpItem *',
const_type => 'GimpItem *',
id => 1,
init_value => 'NULL',
out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_item ($value, gimp)',
dup_value_func => '$var = gimp_value_get_item_id ($value)',
dup_value_func => '$var = gimp_item_new_by_id (gimp_value_get_item_id ($value))',
dup_value_func_d=> '$var = gimp_value_get_item_id ($value)',
set_value_func => 'gimp_value_set_item_id ($value, $var)',
take_value_func => 'gimp_value_set_item ($value, $var)',
convert_func => 'gimp_item_get_id (GIMP_ITEM ($var))',
headers => [ qw("core/gimpitem.h") ] },
layer => { name => 'LAYER',
gtype => 'GIMP_TYPE_LAYER_ID',
type => 'GimpLayer *',
const_type => 'GimpLayer *',
id => 1,
init_value => 'NULL',
out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_layer ($value, gimp)',
dup_value_func => '$var = gimp_value_get_layer_id ($value)',
dup_value_func => '$var = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id ($value)))',
dup_value_func_d=> '$var = gimp_value_get_layer_id ($value)',
set_value_func => 'gimp_value_set_layer_id ($value, $var)',
take_value_func => 'gimp_value_set_layer ($value, $var)',
convert_func => 'gimp_item_get_id (GIMP_ITEM ($var))',
headers => [ qw("core/gimplayer.h") ] },
channel => { name => 'CHANNEL',
@ -213,12 +217,14 @@ package Gimp::CodeGen::pdb;
gtype => 'GIMP_TYPE_DRAWABLE_ID',
type => 'GimpDrawable *',
const_type => 'GimpDrawable *',
id => 1,
init_value => 'NULL',
out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_drawable ($value, gimp)',
dup_value_func => '$var = gimp_value_get_drawable_id ($value)',
dup_value_func => '$var = GIMP_DRAWABLE (gimp_item_new_by_id (gimp_value_get_drawable_id ($value)))',
dup_value_func_d=> '$var = gimp_value_get_drawable_id ($value)',
set_value_func => 'gimp_value_set_drawable_id ($value, $var)',
take_value_func => 'gimp_value_set_drawable ($value, $var)',
convert_func => 'gimp_item_get_id (GIMP_ITEM ($var))',
headers => [ qw("core/gimpdrawable.h") ] },
selection => { name => 'SELECTION',