pdb, libgimp: now make all ID types classes of their own.

No need of is_id_arg() anymore in pdb/lib.pl. Let's reuse the {id}
value. Also I had to add an additional trick for GimpDisplay which we
will now generate as such in libgimp PDB files, but still need to show
as GimpObject on app/pdb/.

As previously, only the new classes and the PDB generation for a first
step.
This commit is contained in:
Jehan 2019-08-13 21:36:03 +02:00
parent 292b697f3e
commit 8c95499e14
34 changed files with 2687 additions and 447 deletions

View File

@ -111,6 +111,7 @@ libgimp_introspectable_headers = \
${PDB_WRAPPERS_H} \
../libgimp/gimpbrushselect.h \
../libgimp/gimpchannel.h \
../libgimp/gimpdisplay.h \
../libgimp/gimpdrawable.h \
../libgimp/gimpfileprocedure.h \
../libgimp/gimpfontselect.h \
@ -121,6 +122,7 @@ libgimp_introspectable_headers = \
../libgimp/gimpimageprocedure.h \
../libgimp/gimpitem.h \
../libgimp/gimplayer.h \
../libgimp/gimplayermask.h \
../libgimp/gimploadprocedure.h \
../libgimp/gimppaletteselect.h \
../libgimp/gimpparamspecs.h \
@ -131,7 +133,8 @@ libgimp_introspectable_headers = \
../libgimp/gimpprogress.h \
../libgimp/gimpsaveprocedure.h \
../libgimp/gimpselection.h \
../libgimp/gimpthumbnailprocedure.h
../libgimp/gimpthumbnailprocedure.h \
../libgimp/gimpvectors.h
libgimp_introspectable = \
$(libgimp_introspectable_headers) \
@ -140,6 +143,7 @@ libgimp_introspectable = \
${PDB_WRAPPERS_C} \
../libgimp/gimpbrushselect.c \
../libgimp/gimpchannel.c \
../libgimp/gimpdisplay.c \
../libgimp/gimpdrawable.c \
../libgimp/gimpfileprocedure.c \
../libgimp/gimpfontselect.c \
@ -150,6 +154,7 @@ libgimp_introspectable = \
../libgimp/gimpimageprocedure.c \
../libgimp/gimpitem.c \
../libgimp/gimplayer.c \
../libgimp/gimplayermask.c \
../libgimp/gimploadprocedure.c \
../libgimp/gimppaletteselect.c \
../libgimp/gimpparamspecs.c \
@ -160,7 +165,8 @@ libgimp_introspectable = \
../libgimp/gimpprogress.c \
../libgimp/gimpsaveprocedure.c \
../libgimp/gimpselection.c \
../libgimp/gimpthumbnailprocedure.c
../libgimp/gimpthumbnailprocedure.c \
../libgimp/gimpvectors.c
libgimpui_introspectable_headers = \
../libgimp/gimpui.h \

View File

@ -37,6 +37,7 @@
#include <libgimp/gimpbrushselect.h>
#include <libgimp/gimpchannel.h>
#include <libgimp/gimpdisplay.h>
#include <libgimp/gimpdrawable.h>
#include <libgimp/gimpfontselect.h>
#include <libgimp/gimpgimprc.h>
@ -46,6 +47,7 @@
#include <libgimp/gimpimageprocedure.h>
#include <libgimp/gimpitem.h>
#include <libgimp/gimplayer.h>
#include <libgimp/gimplayermask.h>
#include <libgimp/gimploadprocedure.h>
#include <libgimp/gimplegacy.h>
#include <libgimp/gimppaletteselect.h>
@ -58,6 +60,7 @@
#include <libgimp/gimpsaveprocedure.h>
#include <libgimp/gimpselection.h>
#include <libgimp/gimpthumbnailprocedure.h>
#include <libgimp/gimpvectors.h>
#include <libgimp/gimp_pdb_headers.h>

View File

@ -23,6 +23,24 @@
#include "gimp.h"
G_DEFINE_TYPE (GimpChannel, gimp_channel, GIMP_TYPE_DRAWABLE)
#define parent_class gimp_drawable_parent_class
static void
gimp_channel_class_init (GimpChannelClass *klass)
{
}
static void
gimp_channel_init (GimpChannel *channel)
{
}
/* Public API. */
/**
* gimp_channel_new:
* @image: The image to which to add the channel.

View File

@ -29,6 +29,41 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#include <libgimp/gimpdrawable.h>
#define GIMP_TYPE_CHANNEL (gimp_channel_get_type ())
#define GIMP_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CHANNEL, GimpChannel))
#define GIMP_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CHANNEL, GimpChannelClass))
#define GIMP_IS_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CHANNEL))
#define GIMP_IS_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHANNEL))
#define GIMP_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CHANNEL, GimpChannelClass))
typedef struct _GimpChannelClass GimpChannelClass;
struct _GimpChannel
{
GimpDrawable parent_instance;
};
struct _GimpChannelClass
{
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_channel_get_type (void) G_GNUC_CONST;
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API

View File

@ -53,9 +53,9 @@
* explicit procedure calls.
* The channel's contents are undefined initially.
*
* Returns: The newly created channel.
* Returns: (transfer full): The newly created channel.
**/
gint32
GimpChannel *
_gimp_channel_new (GimpImage *image,
gint width,
gint height,
@ -66,7 +66,7 @@ _gimp_channel_new (GimpImage *image,
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 channel_ID = -1;
GimpChannel *channel = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -87,11 +87,11 @@ _gimp_channel_new (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
channel = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return channel_ID;
return channel;
}
/**
@ -168,11 +168,11 @@ __gimp_channel_new (gint32 image_ID,
* Other attributes, such as channel visibility, should be set with
* explicit procedure calls.
*
* Returns: The newly created channel.
* Returns: (transfer full): The newly created channel.
*
* Since: 2.4
**/
gint32
GimpChannel *
gimp_channel_new_from_component (GimpImage *image,
GimpChannelType component,
const gchar *name)
@ -180,7 +180,7 @@ gimp_channel_new_from_component (GimpImage *image,
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 channel_ID = -1;
GimpChannel *channel = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -198,11 +198,11 @@ gimp_channel_new_from_component (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
channel = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return channel_ID;
return channel;
}
/**
@ -258,6 +258,47 @@ _gimp_channel_new_from_component (gint32 image_ID,
/**
* gimp_channel_copy:
* @channel: The channel to copy.
*
* Copy a channel.
*
* This procedure copies the specified channel and returns the copy.
* The new channel still needs to be added to the image, as this is not
* automatic. Add the new channel with gimp_image_insert_channel().
*
* Returns: (transfer full): The newly copied channel.
**/
GimpChannel *
gimp_channel_copy (GimpChannel *channel)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpChannel *channel_copy = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (channel)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-channel-copy",
args);
else
return_vals = gimp_run_procedure_array ("gimp-channel-copy",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
channel_copy = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return channel_copy;
}
/**
* _gimp_channel_copy: (skip)
* @channel_ID: The channel to copy.
*
* Copy a channel.
@ -269,7 +310,7 @@ _gimp_channel_new_from_component (gint32 image_ID,
* Returns: The newly copied channel.
**/
gint32
gimp_channel_copy (gint32 channel_ID)
_gimp_channel_copy (gint32 channel_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -299,6 +340,57 @@ gimp_channel_copy (gint32 channel_ID)
/**
* gimp_channel_combine_masks:
* @channel1: The channel1.
* @channel2: The channel2.
* @operation: The selection operation.
* @offx: x offset between upper left corner of channels: (second - first).
* @offy: y offset between upper left corner of channels: (second - first).
*
* Combine two channel masks.
*
* This procedure combines two channel masks. The result is stored in
* the first channel.
*
* Returns: TRUE on success.
**/
gboolean
gimp_channel_combine_masks (GimpChannel *channel1,
GimpChannel *channel2,
GimpChannelOps operation,
gint offx,
gint offy)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (channel1)),
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (channel2)),
GIMP_TYPE_CHANNEL_OPS, operation,
G_TYPE_INT, offx,
G_TYPE_INT, offy,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-channel-combine-masks",
args);
else
return_vals = gimp_run_procedure_array ("gimp-channel-combine-masks",
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_channel_combine_masks: (skip)
* @channel1_ID: The channel1.
* @channel2_ID: The channel2.
* @operation: The selection operation.
@ -313,11 +405,11 @@ gimp_channel_copy (gint32 channel_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_channel_combine_masks (gint32 channel1_ID,
gint32 channel2_ID,
GimpChannelOps operation,
gint offx,
gint offy)
_gimp_channel_combine_masks (gint32 channel1_ID,
gint32 channel2_ID,
GimpChannelOps operation,
gint offx,
gint offy)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -350,6 +442,47 @@ gimp_channel_combine_masks (gint32 channel1_ID,
/**
* gimp_channel_get_show_masked:
* @channel: The channel.
*
* Get the composite method of the specified channel.
*
* This procedure returns the specified channel's composite method. If
* it is TRUE, then the channel is composited with the image so that
* masked regions are shown. Otherwise, selected regions are shown.
*
* Returns: The channel composite method.
**/
gboolean
gimp_channel_get_show_masked (GimpChannel *channel)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean show_masked = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (channel)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-channel-get-show-masked",
args);
else
return_vals = gimp_run_procedure_array ("gimp-channel-get-show-masked",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
show_masked = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return show_masked;
}
/**
* _gimp_channel_get_show_masked: (skip)
* @channel_ID: The channel.
*
* Get the composite method of the specified channel.
@ -361,7 +494,7 @@ gimp_channel_combine_masks (gint32 channel1_ID,
* Returns: The channel composite method.
**/
gboolean
gimp_channel_get_show_masked (gint32 channel_ID)
_gimp_channel_get_show_masked (gint32 channel_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -391,6 +524,49 @@ gimp_channel_get_show_masked (gint32 channel_ID)
/**
* gimp_channel_set_show_masked:
* @channel: The channel.
* @show_masked: The new channel composite method.
*
* Set the composite method of the specified channel.
*
* This procedure sets the specified channel's composite method. If it
* is TRUE, then the channel is composited with the image so that
* masked regions are shown. Otherwise, selected regions are shown.
*
* Returns: TRUE on success.
**/
gboolean
gimp_channel_set_show_masked (GimpChannel *channel,
gboolean show_masked)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (channel)),
G_TYPE_BOOLEAN, show_masked,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-channel-set-show-masked",
args);
else
return_vals = gimp_run_procedure_array ("gimp-channel-set-show-masked",
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_channel_set_show_masked: (skip)
* @channel_ID: The channel.
* @show_masked: The new channel composite method.
*
@ -403,8 +579,8 @@ gimp_channel_get_show_masked (gint32 channel_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_channel_set_show_masked (gint32 channel_ID,
gboolean show_masked)
_gimp_channel_set_show_masked (gint32 channel_ID,
gboolean show_masked)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -434,6 +610,45 @@ gimp_channel_set_show_masked (gint32 channel_ID,
/**
* gimp_channel_get_opacity:
* @channel: The channel.
*
* Get the opacity of the specified channel.
*
* This procedure returns the specified channel's opacity.
*
* Returns: The channel opacity.
**/
gdouble
gimp_channel_get_opacity (GimpChannel *channel)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gdouble opacity = 0.0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (channel)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-channel-get-opacity",
args);
else
return_vals = gimp_run_procedure_array ("gimp-channel-get-opacity",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
opacity = g_value_get_double (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return opacity;
}
/**
* _gimp_channel_get_opacity: (skip)
* @channel_ID: The channel.
*
* Get the opacity of the specified channel.
@ -443,7 +658,7 @@ gimp_channel_set_show_masked (gint32 channel_ID,
* Returns: The channel opacity.
**/
gdouble
gimp_channel_get_opacity (gint32 channel_ID)
_gimp_channel_get_opacity (gint32 channel_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -473,6 +688,47 @@ gimp_channel_get_opacity (gint32 channel_ID)
/**
* gimp_channel_set_opacity:
* @channel: The channel.
* @opacity: The new channel opacity.
*
* Set the opacity of the specified channel.
*
* This procedure sets the specified channel's opacity.
*
* Returns: TRUE on success.
**/
gboolean
gimp_channel_set_opacity (GimpChannel *channel,
gdouble opacity)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (channel)),
G_TYPE_DOUBLE, opacity,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-channel-set-opacity",
args);
else
return_vals = gimp_run_procedure_array ("gimp-channel-set-opacity",
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_channel_set_opacity: (skip)
* @channel_ID: The channel.
* @opacity: The new channel opacity.
*
@ -483,8 +739,8 @@ gimp_channel_get_opacity (gint32 channel_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_channel_set_opacity (gint32 channel_ID,
gdouble opacity)
_gimp_channel_set_opacity (gint32 channel_ID,
gdouble opacity)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -514,6 +770,49 @@ gimp_channel_set_opacity (gint32 channel_ID,
/**
* gimp_channel_get_color:
* @channel: The channel.
* @color: (out caller-allocates): The channel compositing color.
*
* Get the compositing color of the specified channel.
*
* This procedure returns the specified channel's compositing color.
*
* Returns: TRUE on success.
**/
gboolean
gimp_channel_get_color (GimpChannel *channel,
GimpRGB *color)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (channel)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-channel-get-color",
args);
else
return_vals = gimp_run_procedure_array ("gimp-channel-get-color",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
if (success)
gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*color);
gimp_value_array_unref (return_vals);
return success;
}
/**
* _gimp_channel_get_color: (skip)
* @channel_ID: The channel.
* @color: (out caller-allocates): The channel compositing color.
*
@ -524,8 +823,8 @@ gimp_channel_set_opacity (gint32 channel_ID,
* Returns: TRUE on success.
**/
gboolean
gimp_channel_get_color (gint32 channel_ID,
GimpRGB *color)
_gimp_channel_get_color (gint32 channel_ID,
GimpRGB *color)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -557,6 +856,47 @@ gimp_channel_get_color (gint32 channel_ID,
/**
* gimp_channel_set_color:
* @channel: The channel.
* @color: The new channel compositing color.
*
* Set the compositing color of the specified channel.
*
* This procedure sets the specified channel's compositing color.
*
* Returns: TRUE on success.
**/
gboolean
gimp_channel_set_color (GimpChannel *channel,
const GimpRGB *color)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (channel)),
GIMP_TYPE_RGB, color,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-channel-set-color",
args);
else
return_vals = gimp_run_procedure_array ("gimp-channel-set-color",
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_channel_set_color: (skip)
* @channel_ID: The channel.
* @color: The new channel compositing color.
*
@ -567,8 +907,8 @@ gimp_channel_get_color (gint32 channel_ID,
* Returns: TRUE on success.
**/
gboolean
gimp_channel_set_color (gint32 channel_ID,
const GimpRGB *color)
_gimp_channel_set_color (gint32 channel_ID,
const GimpRGB *color)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;

View File

@ -32,39 +32,48 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gint32 gimp_channel_copy (gint32 channel_ID);
gboolean gimp_channel_combine_masks (gint32 channel1_ID,
gint32 channel2_ID,
GimpChannelOps operation,
gint offx,
gint offy);
gboolean gimp_channel_get_show_masked (gint32 channel_ID);
gboolean gimp_channel_set_show_masked (gint32 channel_ID,
gboolean show_masked);
gdouble gimp_channel_get_opacity (gint32 channel_ID);
gboolean gimp_channel_set_opacity (gint32 channel_ID,
gdouble opacity);
gboolean gimp_channel_get_color (gint32 channel_ID,
GimpRGB *color);
gboolean gimp_channel_set_color (gint32 channel_ID,
const GimpRGB *color);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
G_GNUC_INTERNAL gint32 _gimp_channel_new (GimpImage *image,
gint width,
gint height,
const gchar *name,
gdouble opacity,
const GimpRGB *color);
gint32 gimp_channel_new_from_component (GimpImage *image,
GimpChannelType component,
const gchar *name);
G_GNUC_INTERNAL GimpChannel* _gimp_channel_new (GimpImage *image,
gint width,
gint height,
const gchar *name,
gdouble opacity,
const GimpRGB *color);
GimpChannel* gimp_channel_new_from_component (GimpImage *image,
GimpChannelType component,
const gchar *name);
GimpChannel* gimp_channel_copy (GimpChannel *channel);
gboolean gimp_channel_combine_masks (GimpChannel *channel1,
GimpChannel *channel2,
GimpChannelOps operation,
gint offx,
gint offy);
gboolean gimp_channel_get_show_masked (GimpChannel *channel);
gboolean gimp_channel_set_show_masked (GimpChannel *channel,
gboolean show_masked);
gdouble gimp_channel_get_opacity (GimpChannel *channel);
gboolean gimp_channel_set_opacity (GimpChannel *channel,
gdouble opacity);
gboolean gimp_channel_get_color (GimpChannel *channel,
GimpRGB *color);
gboolean gimp_channel_set_color (GimpChannel *channel,
const GimpRGB *color);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define _gimp_channel_new __gimp_channel_new
#define gimp_channel_new_from_component _gimp_channel_new_from_component
#define gimp_channel_copy _gimp_channel_copy
#define gimp_channel_combine_masks _gimp_channel_combine_masks
#define gimp_channel_get_show_masked _gimp_channel_get_show_masked
#define gimp_channel_set_show_masked _gimp_channel_set_show_masked
#define gimp_channel_get_opacity _gimp_channel_get_opacity
#define gimp_channel_set_opacity _gimp_channel_set_opacity
#define gimp_channel_get_color _gimp_channel_get_color
#define gimp_channel_set_color _gimp_channel_set_color
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -73,15 +82,31 @@ gint32 gimp_channel_new_from_component (GimpImage *image,
* They are not marked internal as a trick to keep the old API alive for now.
*/
gint32 __gimp_channel_new (gint32 image_ID,
gint width,
gint height,
const gchar *name,
gdouble opacity,
const GimpRGB *color);
gint32 _gimp_channel_new_from_component (gint32 image_ID,
GimpChannelType component,
const gchar *name);
gint32 __gimp_channel_new (gint32 image_ID,
gint width,
gint height,
const gchar *name,
gdouble opacity,
const GimpRGB *color);
gint32 _gimp_channel_new_from_component (gint32 image_ID,
GimpChannelType component,
const gchar *name);
gint32 _gimp_channel_copy (gint32 channel_ID);
gboolean _gimp_channel_combine_masks (gint32 channel1_ID,
gint32 channel2_ID,
GimpChannelOps operation,
gint offx,
gint offy);
gboolean _gimp_channel_get_show_masked (gint32 channel_ID);
gboolean _gimp_channel_set_show_masked (gint32 channel_ID,
gboolean show_masked);
gdouble _gimp_channel_get_opacity (gint32 channel_ID);
gboolean _gimp_channel_set_opacity (gint32 channel_ID,
gdouble opacity);
gboolean _gimp_channel_get_color (gint32 channel_ID,
GimpRGB *color);
gboolean _gimp_channel_set_color (gint32 channel_ID,
const GimpRGB *color);
G_END_DECLS

160
libgimp/gimpdisplay.c Normal file
View File

@ -0,0 +1,160 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpdisplay.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 _GimpDisplayPrivate
{
gint id;
};
static void gimp_display_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_display_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
G_DEFINE_TYPE_WITH_PRIVATE (GimpDisplay, gimp_display, G_TYPE_OBJECT)
#define parent_class gimp_display_parent_class
static GParamSpec *props[N_PROPS] = { NULL, };
static void
gimp_display_class_init (GimpDisplayClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_display_set_property;
object_class->get_property = gimp_display_get_property;
props[PROP_ID] =
g_param_spec_int ("id",
"The display id",
"The display 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_display_init (GimpDisplay *display)
{
display->priv = gimp_display_get_instance_private (display);
}
static void
gimp_display_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpDisplay *display = GIMP_DISPLAY (object);
switch (property_id)
{
case PROP_ID:
display->priv->id = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_display_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpDisplay *display = GIMP_DISPLAY (object);
switch (property_id)
{
case PROP_ID:
g_value_set_int (value, display->priv->id);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
/* Public API. */
/**
* gimp_display_get_id:
* @display: The display.
*
* Returns: the display ID.
*
* Since: 3.0
**/
gint32
gimp_display_get_id (GimpDisplay *display)
{
return display->priv->id;
}
/**
* gimp_display_new_by_id:
* @display_id: The display id.
*
* Creates a #GimpDisplay representing @display_id.
*
* Returns: (nullable) (transfer full): a #GimpDisplay for @display_id or
* %NULL if @display_id does not represent a valid display.
*
* Since: 3.0
**/
GimpDisplay *
gimp_display_new_by_id (gint32 display_id)
{
GimpDisplay *display = NULL;
if (_gimp_display_is_valid (display_id))
display = g_object_new (GIMP_TYPE_DISPLAY,
"id", display_id,
NULL);
return display;
}

75
libgimp/gimpdisplay.h Normal file
View File

@ -0,0 +1,75 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpdisplay.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_DISPLAY_H__
#define __GIMP_DISPLAY_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_DISPLAY (gimp_display_get_type ())
#define GIMP_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DISPLAY, GimpDisplay))
#define GIMP_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DISPLAY, GimpDisplayClass))
#define GIMP_IS_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DISPLAY))
#define GIMP_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DISPLAY))
#define GIMP_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DISPLAY, GimpDisplayClass))
typedef struct _GimpDisplayClass GimpDisplayClass;
typedef struct _GimpDisplayPrivate GimpDisplayPrivate;
struct _GimpDisplay
{
GObject parent_instance;
GimpDisplayPrivate *priv;
};
struct _GimpDisplayClass
{
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_display_get_type (void) G_GNUC_CONST;
gint32 gimp_display_get_id (GimpDisplay *display);
GimpDisplay * gimp_display_new_by_id (gint32 display_id);
G_END_DECLS
#endif /* __GIMP_DISPLAY_H__ */

View File

@ -36,6 +36,48 @@
/**
* gimp_display_is_valid:
* @display: The display to check.
*
* Returns TRUE if the display is valid.
*
* This procedure checks if the given display ID is valid and refers to
* an existing display.
*
* Returns: Whether the display ID is valid.
*
* Since: 2.4
**/
gboolean
gimp_display_is_valid (GimpDisplay *display)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean valid = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DISPLAY_ID, gimp_display_get_id (display),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-display-is-valid",
args);
else
return_vals = gimp_run_procedure_array ("gimp-display-is-valid",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
valid = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return valid;
}
/**
* _gimp_display_is_valid: (skip)
* @display_ID: The display to check.
*
* Returns TRUE if the display is valid.
@ -48,7 +90,7 @@
* Since: 2.4
**/
gboolean
gimp_display_is_valid (gint32 display_ID)
_gimp_display_is_valid (gint32 display_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -89,15 +131,15 @@ gimp_display_is_valid (gint32 display_ID)
* procedure only makes sense for use with the GIMP UI, and will result
* in an execution error if called when GIMP has no UI.
*
* Returns: The new display.
* Returns: (transfer full): The new display.
**/
gint32
GimpDisplay *
gimp_display_new (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 display_ID = -1;
GimpDisplay *display = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -113,11 +155,11 @@ gimp_display_new (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
display_ID = gimp_value_get_display_id (gimp_value_array_index (return_vals, 1));
display = gimp_display_new_by_id (gimp_value_get_display_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return display_ID;
return display;
}
/**
@ -166,6 +208,48 @@ _gimp_display_new (gint32 image_ID)
/**
* gimp_display_delete:
* @display: The display to delete.
*
* Delete the specified display.
*
* This procedure removes the specified display. If this is the last
* remaining display for the underlying image, then the image is
* deleted also. Note that the display is closed no matter if the image
* is dirty or not. Better save the image before calling this
* procedure.
*
* Returns: TRUE on success.
**/
gboolean
gimp_display_delete (GimpDisplay *display)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DISPLAY_ID, gimp_display_get_id (display),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-display-delete",
args);
else
return_vals = gimp_run_procedure_array ("gimp-display-delete",
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_display_delete: (skip)
* @display_ID: The display to delete.
*
* Delete the specified display.
@ -179,7 +263,7 @@ _gimp_display_new (gint32 image_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_display_delete (gint32 display_ID)
_gimp_display_delete (gint32 display_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -208,6 +292,51 @@ gimp_display_delete (gint32 display_ID)
/**
* gimp_display_get_window_handle:
* @display: The display to get the window handle from.
*
* Get a handle to the native window for an image display.
*
* This procedure returns a handle to the native window for a given
* image display. For example in the X backend of GDK, a native window
* handle is an Xlib XID. A value of 0 is returned for an invalid
* display or if this function is unimplemented for the windowing
* system that is being used.
*
* Returns: The native window handle or 0.
*
* Since: 2.4
**/
gint
gimp_display_get_window_handle (GimpDisplay *display)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint window = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DISPLAY_ID, gimp_display_get_id (display),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-display-get-window-handle",
args);
else
return_vals = gimp_run_procedure_array ("gimp-display-get-window-handle",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
window = g_value_get_int (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return window;
}
/**
* _gimp_display_get_window_handle: (skip)
* @display_ID: The display to get the window handle from.
*
* Get a handle to the native window for an image display.
@ -223,7 +352,7 @@ gimp_display_delete (gint32 display_ID)
* Since: 2.4
**/
gint
gimp_display_get_window_handle (gint32 display_ID)
_gimp_display_get_window_handle (gint32 display_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;

View File

@ -32,20 +32,23 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_display_is_valid (gint32 display_ID);
gboolean gimp_display_delete (gint32 display_ID);
gint gimp_display_get_window_handle (gint32 display_ID);
gboolean gimp_displays_flush (void);
gboolean gimp_displays_flush (void);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
gint32 gimp_display_new (GimpImage *image);
gboolean gimp_displays_reconnect (GimpImage *old_image,
GimpImage *new_image);
gboolean gimp_display_is_valid (GimpDisplay *display);
GimpDisplay* gimp_display_new (GimpImage *image);
gboolean gimp_display_delete (GimpDisplay *display);
gint gimp_display_get_window_handle (GimpDisplay *display);
gboolean gimp_displays_reconnect (GimpImage *old_image,
GimpImage *new_image);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define gimp_display_is_valid _gimp_display_is_valid
#define gimp_display_new _gimp_display_new
#define gimp_display_delete _gimp_display_delete
#define gimp_display_get_window_handle _gimp_display_get_window_handle
#define gimp_displays_reconnect _gimp_displays_reconnect
@ -55,9 +58,12 @@ gboolean gimp_displays_reconnect (GimpImage *old_image,
* They are not marked internal as a trick to keep the old API alive for now.
*/
gint32 _gimp_display_new (gint32 image_ID);
gboolean _gimp_displays_reconnect (gint32 old_image_ID,
gint32 new_image_ID);
gboolean _gimp_display_is_valid (gint32 display_ID);
gint32 _gimp_display_new (gint32 image_ID);
gboolean _gimp_display_delete (gint32 display_ID);
gint _gimp_display_get_window_handle (gint32 display_ID);
gboolean _gimp_displays_reconnect (gint32 old_image_ID,
gint32 new_image_ID);
G_END_DECLS

View File

@ -2214,8 +2214,8 @@ _gimp_image_thaw_layers (gint32 image_ID)
/**
* gimp_image_insert_channel:
* @image: The image.
* @channel_ID: The channel.
* @parent_ID: The parent channel.
* @channel: The channel.
* @parent: The parent channel.
* @position: The channel position.
*
* Add the specified channel to the image.
@ -2230,10 +2230,10 @@ _gimp_image_thaw_layers (gint32 image_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_image_insert_channel (GimpImage *image,
gint32 channel_ID,
gint32 parent_ID,
gint position)
gimp_image_insert_channel (GimpImage *image,
GimpChannel *channel,
GimpChannel *parent,
gint position)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -2242,8 +2242,8 @@ gimp_image_insert_channel (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_CHANNEL_ID, channel_ID,
GIMP_TYPE_CHANNEL_ID, parent_ID,
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (channel)),
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (parent)),
G_TYPE_INT, position,
G_TYPE_NONE);
@ -2318,7 +2318,7 @@ _gimp_image_insert_channel (gint32 image_ID,
/**
* gimp_image_remove_channel:
* @image: The image.
* @channel_ID: The channel.
* @channel: The channel.
*
* Remove the specified channel from the image.
*
@ -2328,8 +2328,8 @@ _gimp_image_insert_channel (gint32 image_ID,
* Returns: TRUE on success.
**/
gboolean
gimp_image_remove_channel (GimpImage *image,
gint32 channel_ID)
gimp_image_remove_channel (GimpImage *image,
GimpChannel *channel)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -2338,7 +2338,7 @@ gimp_image_remove_channel (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_CHANNEL_ID, channel_ID,
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (channel)),
G_TYPE_NONE);
if (pdb)
@ -2584,8 +2584,8 @@ _gimp_image_thaw_channels (gint32 image_ID)
/**
* gimp_image_insert_vectors:
* @image: The image.
* @vectors_ID: The vectors.
* @parent_ID: The parent vectors.
* @vectors: The vectors.
* @parent: The parent vectors.
* @position: The vectors position.
*
* Add the specified vectors to the image.
@ -2600,10 +2600,10 @@ _gimp_image_thaw_channels (gint32 image_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_image_insert_vectors (GimpImage *image,
gint32 vectors_ID,
gint32 parent_ID,
gint position)
gimp_image_insert_vectors (GimpImage *image,
GimpVectors *vectors,
GimpVectors *parent,
gint position)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -2612,8 +2612,8 @@ gimp_image_insert_vectors (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_VECTORS_ID, vectors_ID,
GIMP_TYPE_VECTORS_ID, parent_ID,
GIMP_TYPE_VECTORS_ID, gimp_item_get_id (GIMP_ITEM (vectors)),
GIMP_TYPE_VECTORS_ID, gimp_item_get_id (GIMP_ITEM (parent)),
G_TYPE_INT, position,
G_TYPE_NONE);
@ -2688,7 +2688,7 @@ _gimp_image_insert_vectors (gint32 image_ID,
/**
* gimp_image_remove_vectors:
* @image: The image.
* @vectors_ID: The vectors object.
* @vectors: The vectors object.
*
* Remove the specified path from the image.
*
@ -2700,8 +2700,8 @@ _gimp_image_insert_vectors (gint32 image_ID,
* Since: 2.4
**/
gboolean
gimp_image_remove_vectors (GimpImage *image,
gint32 vectors_ID)
gimp_image_remove_vectors (GimpImage *image,
GimpVectors *vectors)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -2710,7 +2710,7 @@ gimp_image_remove_vectors (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_VECTORS_ID, vectors_ID,
GIMP_TYPE_VECTORS_ID, gimp_item_get_id (GIMP_ITEM (vectors)),
G_TYPE_NONE);
if (pdb)
@ -4637,15 +4637,15 @@ _gimp_image_set_active_layer (gint32 image_ID,
* If there is an active channel, this will return the channel ID,
* otherwise, -1.
*
* Returns: The active channel.
* Returns: (transfer full): The active channel.
**/
gint32
GimpChannel *
gimp_image_get_active_channel (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 active_channel_ID = -1;
GimpChannel *active_channel = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -4661,11 +4661,11 @@ gimp_image_get_active_channel (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
active_channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
active_channel = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return active_channel_ID;
return active_channel;
}
/**
@ -4711,7 +4711,7 @@ _gimp_image_get_active_channel (gint32 image_ID)
/**
* gimp_image_set_active_channel:
* @image: The image.
* @active_channel_ID: The new image active channel.
* @active_channel: The new image active channel.
*
* Sets the specified image's active channel.
*
@ -4723,8 +4723,8 @@ _gimp_image_get_active_channel (gint32 image_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_image_set_active_channel (GimpImage *image,
gint32 active_channel_ID)
gimp_image_set_active_channel (GimpImage *image,
GimpChannel *active_channel)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -4733,7 +4733,7 @@ gimp_image_set_active_channel (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_CHANNEL_ID, active_channel_ID,
GIMP_TYPE_CHANNEL_ID, gimp_item_get_id (GIMP_ITEM (active_channel)),
G_TYPE_NONE);
if (pdb)
@ -4804,15 +4804,15 @@ _gimp_image_set_active_channel (gint32 image_ID,
*
* If there is an active path, its ID will be returned, otherwise, -1.
*
* Returns: The active vectors.
* Returns: (transfer full): The active vectors.
**/
gint32
GimpVectors *
gimp_image_get_active_vectors (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 active_vectors_ID = -1;
GimpVectors *active_vectors = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -4828,11 +4828,11 @@ gimp_image_get_active_vectors (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
active_vectors_ID = gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1));
active_vectors = GIMP_VECTORS (gimp_item_new_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return active_vectors_ID;
return active_vectors;
}
/**
@ -4877,7 +4877,7 @@ _gimp_image_get_active_vectors (gint32 image_ID)
/**
* gimp_image_set_active_vectors:
* @image: The image.
* @active_vectors_ID: The new image active vectors.
* @active_vectors: The new image active vectors.
*
* Sets the specified image's active vectors.
*
@ -4886,8 +4886,8 @@ _gimp_image_get_active_vectors (gint32 image_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_image_set_active_vectors (GimpImage *image,
gint32 active_vectors_ID)
gimp_image_set_active_vectors (GimpImage *image,
GimpVectors *active_vectors)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -4896,7 +4896,7 @@ gimp_image_set_active_vectors (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_VECTORS_ID, active_vectors_ID,
GIMP_TYPE_VECTORS_ID, gimp_item_get_id (GIMP_ITEM (active_vectors)),
G_TYPE_NONE);
if (pdb)
@ -4965,15 +4965,15 @@ _gimp_image_set_active_vectors (gint32 image_ID,
* This will always return a valid ID for a selection -- which is
* represented as a channel internally.
*
* Returns: The selection channel.
* Returns: (transfer full): The selection channel.
**/
gint32
GimpSelection *
gimp_image_get_selection (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 selection_ID = -1;
GimpSelection *selection = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -4989,11 +4989,11 @@ gimp_image_get_selection (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
selection_ID = gimp_value_get_selection_id (gimp_value_array_index (return_vals, 1));
selection = GIMP_SELECTION (gimp_item_new_by_id (gimp_value_get_selection_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return selection_ID;
return selection;
}
/**
@ -6682,16 +6682,16 @@ _gimp_image_get_layer_by_tattoo (gint32 image_ID,
* This procedure returns the channel with the given tattoo in the
* specified image.
*
* Returns: The channel with the specified tattoo.
* Returns: (transfer full): The channel with the specified tattoo.
**/
gint32
GimpChannel *
gimp_image_get_channel_by_tattoo (GimpImage *image,
guint tattoo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 channel_ID = -1;
GimpChannel *channel = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -6708,11 +6708,11 @@ gimp_image_get_channel_by_tattoo (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
channel = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return channel_ID;
return channel;
}
/**
@ -6768,18 +6768,18 @@ _gimp_image_get_channel_by_tattoo (gint32 image_ID,
* This procedure returns the vectors with the given tattoo in the
* specified image.
*
* Returns: The vectors with the specified tattoo.
* Returns: (transfer full): The vectors with the specified tattoo.
*
* Since: 2.6
**/
gint32
GimpVectors *
gimp_image_get_vectors_by_tattoo (GimpImage *image,
guint tattoo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 vectors_ID = -1;
GimpVectors *vectors = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -6796,11 +6796,11 @@ gimp_image_get_vectors_by_tattoo (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
vectors_ID = gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1));
vectors = GIMP_VECTORS (gimp_item_new_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return vectors_ID;
return vectors;
}
/**
@ -6948,18 +6948,18 @@ _gimp_image_get_layer_by_name (gint32 image_ID,
* This procedure returns the channel with the given name in the
* specified image.
*
* Returns: The channel with the specified name.
* Returns: (transfer full): The channel with the specified name.
*
* Since: 2.8
**/
gint32
GimpChannel *
gimp_image_get_channel_by_name (GimpImage *image,
const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 channel_ID = -1;
GimpChannel *channel = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -6976,11 +6976,11 @@ gimp_image_get_channel_by_name (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
channel = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return channel_ID;
return channel;
}
/**
@ -7038,18 +7038,18 @@ _gimp_image_get_channel_by_name (gint32 image_ID,
* This procedure returns the vectors with the given name in the
* specified image.
*
* Returns: The vectors with the specified name.
* Returns: (transfer full): The vectors with the specified name.
*
* Since: 2.8
**/
gint32
GimpVectors *
gimp_image_get_vectors_by_name (GimpImage *image,
const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 vectors_ID = -1;
GimpVectors *vectors = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -7066,11 +7066,11 @@ gimp_image_get_vectors_by_name (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
vectors_ID = gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1));
vectors = GIMP_VECTORS (gimp_item_new_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return vectors_ID;
return vectors;
}
/**

View File

@ -81,19 +81,19 @@ gboolean gimp_image_remove_layer (GimpImage
gboolean gimp_image_freeze_layers (GimpImage *image);
gboolean gimp_image_thaw_layers (GimpImage *image);
gboolean gimp_image_insert_channel (GimpImage *image,
gint32 channel_ID,
gint32 parent_ID,
GimpChannel *channel,
GimpChannel *parent,
gint position);
gboolean gimp_image_remove_channel (GimpImage *image,
gint32 channel_ID);
GimpChannel *channel);
gboolean gimp_image_freeze_channels (GimpImage *image);
gboolean gimp_image_thaw_channels (GimpImage *image);
gboolean gimp_image_insert_vectors (GimpImage *image,
gint32 vectors_ID,
gint32 parent_ID,
GimpVectors *vectors,
GimpVectors *parent,
gint position);
gboolean gimp_image_remove_vectors (GimpImage *image,
gint32 vectors_ID);
GimpVectors *vectors);
gboolean gimp_image_freeze_vectors (GimpImage *image);
gboolean gimp_image_thaw_vectors (GimpImage *image);
gint gimp_image_get_item_position (GimpImage *image,
@ -137,13 +137,13 @@ G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (GimpImage
GimpLayer* gimp_image_get_active_layer (GimpImage *image);
gboolean gimp_image_set_active_layer (GimpImage *image,
GimpLayer *active_layer);
gint32 gimp_image_get_active_channel (GimpImage *image);
GimpChannel* gimp_image_get_active_channel (GimpImage *image);
gboolean gimp_image_set_active_channel (GimpImage *image,
gint32 active_channel_ID);
gint32 gimp_image_get_active_vectors (GimpImage *image);
GimpChannel *active_channel);
GimpVectors* gimp_image_get_active_vectors (GimpImage *image);
gboolean gimp_image_set_active_vectors (GimpImage *image,
gint32 active_vectors_ID);
gint32 gimp_image_get_selection (GimpImage *image);
GimpVectors *active_vectors);
GimpSelection* gimp_image_get_selection (GimpImage *image);
gboolean gimp_image_get_component_active (GimpImage *image,
GimpChannelType component);
gboolean gimp_image_set_component_active (GimpImage *image,
@ -176,15 +176,15 @@ gboolean gimp_image_set_tattoo_state (GimpImage
guint tattoo_state);
GimpLayer* gimp_image_get_layer_by_tattoo (GimpImage *image,
guint tattoo);
gint32 gimp_image_get_channel_by_tattoo (GimpImage *image,
GimpChannel* gimp_image_get_channel_by_tattoo (GimpImage *image,
guint tattoo);
gint32 gimp_image_get_vectors_by_tattoo (GimpImage *image,
GimpVectors* gimp_image_get_vectors_by_tattoo (GimpImage *image,
guint tattoo);
GimpLayer* gimp_image_get_layer_by_name (GimpImage *image,
const gchar *name);
gint32 gimp_image_get_channel_by_name (GimpImage *image,
GimpChannel* gimp_image_get_channel_by_name (GimpImage *image,
const gchar *name);
gint32 gimp_image_get_vectors_by_name (GimpImage *image,
GimpVectors* gimp_image_get_vectors_by_name (GimpImage *image,
const gchar *name);
gboolean gimp_image_attach_parasite (GimpImage *image,
const GimpParasite *parasite);

View File

@ -47,14 +47,14 @@
*
* Returns: The new guide.
**/
gint32
guint
gimp_image_add_hguide (GimpImage *image,
gint yposition)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 guide_ID = -1;
guint guide = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -71,11 +71,11 @@ gimp_image_add_hguide (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
guide_ID = g_value_get_uint (gimp_value_array_index (return_vals, 1));
guide = g_value_get_uint (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return guide_ID;
return guide;
}
/**
@ -135,14 +135,14 @@ _gimp_image_add_hguide (gint32 image_ID,
*
* Returns: The new guide.
**/
gint32
guint
gimp_image_add_vguide (GimpImage *image,
gint xposition)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 guide_ID = -1;
guint guide = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -159,11 +159,11 @@ gimp_image_add_vguide (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
guide_ID = g_value_get_uint (gimp_value_array_index (return_vals, 1));
guide = g_value_get_uint (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return guide_ID;
return guide;
}
/**
@ -213,7 +213,7 @@ _gimp_image_add_vguide (gint32 image_ID,
/**
* gimp_image_delete_guide:
* @image: The image.
* @guide_ID: The ID of the guide to be removed.
* @guide: The ID of the guide to be removed.
*
* Deletes a guide from an image.
*
@ -224,7 +224,7 @@ _gimp_image_add_vguide (gint32 image_ID,
**/
gboolean
gimp_image_delete_guide (GimpImage *image,
gint32 guide_ID)
guint guide)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -233,7 +233,7 @@ gimp_image_delete_guide (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
G_TYPE_UINT, guide_ID,
G_TYPE_UINT, guide,
G_TYPE_NONE);
if (pdb)
@ -297,7 +297,7 @@ _gimp_image_delete_guide (gint32 image_ID,
/**
* gimp_image_find_next_guide:
* @image: The image.
* @guide_ID: The ID of the current guide (0 if first invocation).
* @guide: The ID of the current guide (0 if first invocation).
*
* Find next guide on an image.
*
@ -309,18 +309,18 @@ _gimp_image_delete_guide (gint32 image_ID,
*
* Returns: The next guide's ID.
**/
gint32
guint
gimp_image_find_next_guide (GimpImage *image,
gint32 guide_ID)
guint guide)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 next_guide_ID = -1;
guint next_guide = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
G_TYPE_UINT, guide_ID,
G_TYPE_UINT, guide,
G_TYPE_NONE);
if (pdb)
@ -333,11 +333,11 @@ gimp_image_find_next_guide (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
next_guide_ID = g_value_get_uint (gimp_value_array_index (return_vals, 1));
next_guide = g_value_get_uint (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return next_guide_ID;
return next_guide;
}
/**
@ -389,7 +389,7 @@ _gimp_image_find_next_guide (gint32 image_ID,
/**
* gimp_image_get_guide_orientation:
* @image: The image.
* @guide_ID: The guide.
* @guide: The guide.
*
* Get orientation of a guide on an image.
*
@ -400,7 +400,7 @@ _gimp_image_find_next_guide (gint32 image_ID,
**/
GimpOrientationType
gimp_image_get_guide_orientation (GimpImage *image,
gint32 guide_ID)
guint guide)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -409,7 +409,7 @@ gimp_image_get_guide_orientation (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
G_TYPE_UINT, guide_ID,
G_TYPE_UINT, guide,
G_TYPE_NONE);
if (pdb)
@ -475,7 +475,7 @@ _gimp_image_get_guide_orientation (gint32 image_ID,
/**
* gimp_image_get_guide_position:
* @image: The image.
* @guide_ID: The guide.
* @guide: The guide.
*
* Get position of a guide on an image.
*
@ -486,7 +486,7 @@ _gimp_image_get_guide_orientation (gint32 image_ID,
**/
gint
gimp_image_get_guide_position (GimpImage *image,
gint32 guide_ID)
guint guide)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -495,7 +495,7 @@ gimp_image_get_guide_position (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
G_TYPE_UINT, guide_ID,
G_TYPE_UINT, guide,
G_TYPE_NONE);
if (pdb)

View File

@ -36,18 +36,18 @@ G_BEGIN_DECLS
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
gint32 gimp_image_add_hguide (GimpImage *image,
guint gimp_image_add_hguide (GimpImage *image,
gint yposition);
gint32 gimp_image_add_vguide (GimpImage *image,
guint gimp_image_add_vguide (GimpImage *image,
gint xposition);
gboolean gimp_image_delete_guide (GimpImage *image,
gint32 guide_ID);
gint32 gimp_image_find_next_guide (GimpImage *image,
gint32 guide_ID);
guint guide);
guint gimp_image_find_next_guide (GimpImage *image,
guint guide);
GimpOrientationType gimp_image_get_guide_orientation (GimpImage *image,
gint32 guide_ID);
guint guide);
gint gimp_image_get_guide_position (GimpImage *image,
gint32 guide_ID);
guint guide);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */

View File

@ -50,7 +50,7 @@
*
* Since: 2.10
**/
gint32
guint
gimp_image_add_sample_point (GimpImage *image,
gint position_x,
gint position_y)
@ -58,7 +58,7 @@ gimp_image_add_sample_point (GimpImage *image,
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 sample_point_ID = -1;
guint sample_point = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -76,11 +76,11 @@ gimp_image_add_sample_point (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
sample_point_ID = g_value_get_uint (gimp_value_array_index (return_vals, 1));
sample_point = g_value_get_uint (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return sample_point_ID;
return sample_point;
}
/**
@ -135,7 +135,7 @@ _gimp_image_add_sample_point (gint32 image_ID,
/**
* gimp_image_delete_sample_point:
* @image: The image.
* @sample_point_ID: The ID of the sample point to be removed.
* @sample_point: The ID of the sample point to be removed.
*
* Deletes a sample point from an image.
*
@ -148,7 +148,7 @@ _gimp_image_add_sample_point (gint32 image_ID,
**/
gboolean
gimp_image_delete_sample_point (GimpImage *image,
gint32 sample_point_ID)
guint sample_point)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -157,7 +157,7 @@ gimp_image_delete_sample_point (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
G_TYPE_UINT, sample_point_ID,
G_TYPE_UINT, sample_point,
G_TYPE_NONE);
if (pdb)
@ -223,7 +223,7 @@ _gimp_image_delete_sample_point (gint32 image_ID,
/**
* gimp_image_find_next_sample_point:
* @image: The image.
* @sample_point_ID: The ID of the current sample point (0 if first invocation).
* @sample_point: The ID of the current sample point (0 if first invocation).
*
* Find next sample point on an image.
*
@ -238,18 +238,18 @@ _gimp_image_delete_sample_point (gint32 image_ID,
*
* Since: 2.10
**/
gint32
guint
gimp_image_find_next_sample_point (GimpImage *image,
gint32 sample_point_ID)
guint sample_point)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 next_sample_point_ID = -1;
guint next_sample_point = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
G_TYPE_UINT, sample_point_ID,
G_TYPE_UINT, sample_point,
G_TYPE_NONE);
if (pdb)
@ -262,11 +262,11 @@ gimp_image_find_next_sample_point (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
next_sample_point_ID = g_value_get_uint (gimp_value_array_index (return_vals, 1));
next_sample_point = g_value_get_uint (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return next_sample_point_ID;
return next_sample_point;
}
/**
@ -321,7 +321,7 @@ _gimp_image_find_next_sample_point (gint32 image_ID,
/**
* gimp_image_get_sample_point_position:
* @image: The image.
* @sample_point_ID: The guide.
* @sample_point: The guide.
* @position_y: (out): The sample points's position relative to top of image.
*
* Get position of a sample point on an image.
@ -336,7 +336,7 @@ _gimp_image_find_next_sample_point (gint32 image_ID,
**/
gint
gimp_image_get_sample_point_position (GimpImage *image,
gint32 sample_point_ID,
guint sample_point,
gint *position_y)
{
GimpPDB *pdb = gimp_get_pdb ();
@ -346,7 +346,7 @@ gimp_image_get_sample_point_position (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
G_TYPE_UINT, sample_point_ID,
G_TYPE_UINT, sample_point,
G_TYPE_NONE);
if (pdb)

View File

@ -36,15 +36,15 @@ G_BEGIN_DECLS
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
gint32 gimp_image_add_sample_point (GimpImage *image,
guint gimp_image_add_sample_point (GimpImage *image,
gint position_x,
gint position_y);
gboolean gimp_image_delete_sample_point (GimpImage *image,
gint32 sample_point_ID);
gint32 gimp_image_find_next_sample_point (GimpImage *image,
gint32 sample_point_ID);
guint sample_point);
guint gimp_image_find_next_sample_point (GimpImage *image,
guint sample_point);
gint gimp_image_get_sample_point_position (GimpImage *image,
gint32 sample_point_ID,
guint sample_point,
gint *position_y);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */

View File

@ -1118,16 +1118,16 @@ _gimp_layer_set_offsets (gint32 layer_ID,
* 'ADD-ALPHA-TRANSFER-MASK' on a layer with no alpha channels, or with
* 'ADD-SELECTION-MASK' when there is no selection on the image.
*
* Returns: The newly created mask.
* Returns: (transfer full): The newly created mask.
**/
gint32
GimpLayerMask *
gimp_layer_create_mask (GimpLayer *layer,
GimpAddMaskType mask_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 mask_ID = -1;
GimpLayerMask *mask = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
@ -1144,11 +1144,11 @@ gimp_layer_create_mask (GimpLayer *layer,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
mask_ID = gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1));
mask = GIMP_LAYER_MASK (gimp_item_new_by_id (gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return mask_ID;
return mask;
}
/**
@ -1221,15 +1221,15 @@ _gimp_layer_create_mask (gint32 layer_ID,
* This procedure returns the specified layer's mask, or -1 if none
* exists.
*
* Returns: The layer mask.
* Returns: (transfer full): The layer mask.
**/
gint32
GimpLayerMask *
gimp_layer_get_mask (GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 mask_ID = -1;
GimpLayerMask *mask = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
@ -1245,11 +1245,11 @@ gimp_layer_get_mask (GimpLayer *layer)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
mask_ID = gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1));
mask = GIMP_LAYER_MASK (gimp_item_new_by_id (gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return mask_ID;
return mask;
}
/**
@ -1294,7 +1294,7 @@ _gimp_layer_get_mask (gint32 layer_ID)
/**
* gimp_layer_from_mask:
* @mask_ID: Mask for which to return the layer.
* @mask: Mask for which to return the layer.
*
* Get the specified mask's layer.
*
@ -1306,7 +1306,7 @@ _gimp_layer_get_mask (gint32 layer_ID)
* Since: 2.2
**/
GimpLayer *
gimp_layer_from_mask (gint32 mask_ID)
gimp_layer_from_mask (GimpLayerMask *mask)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -1314,7 +1314,7 @@ gimp_layer_from_mask (gint32 mask_ID)
GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_MASK_ID, mask_ID,
GIMP_TYPE_LAYER_MASK_ID, gimp_item_get_id (GIMP_ITEM (mask)),
G_TYPE_NONE);
if (pdb)
@ -1379,7 +1379,7 @@ _gimp_layer_from_mask (gint32 mask_ID)
/**
* gimp_layer_add_mask:
* @layer: The layer to receive the mask.
* @mask_ID: The mask to add to the layer.
* @mask: The mask to add to the layer.
*
* Add a layer mask to the specified layer.
*
@ -1394,8 +1394,8 @@ _gimp_layer_from_mask (gint32 mask_ID)
* Returns: TRUE on success.
**/
gboolean
gimp_layer_add_mask (GimpLayer *layer,
gint32 mask_ID)
gimp_layer_add_mask (GimpLayer *layer,
GimpLayerMask *mask)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@ -1404,7 +1404,7 @@ gimp_layer_add_mask (GimpLayer *layer,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
GIMP_TYPE_LAYER_MASK_ID, mask_ID,
GIMP_TYPE_LAYER_MASK_ID, gimp_item_get_id (GIMP_ITEM (mask)),
G_TYPE_NONE);
if (pdb)

View File

@ -66,12 +66,12 @@ gboolean gimp_layer_resize_to_image_size (GimpLayer
gboolean gimp_layer_set_offsets (GimpLayer *layer,
gint offx,
gint offy);
gint32 gimp_layer_create_mask (GimpLayer *layer,
GimpLayerMask* gimp_layer_create_mask (GimpLayer *layer,
GimpAddMaskType mask_type);
gint32 gimp_layer_get_mask (GimpLayer *layer);
GimpLayer* gimp_layer_from_mask (gint32 mask_ID);
GimpLayerMask* gimp_layer_get_mask (GimpLayer *layer);
GimpLayer* gimp_layer_from_mask (GimpLayerMask *mask);
gboolean gimp_layer_add_mask (GimpLayer *layer,
gint32 mask_ID);
GimpLayerMask *mask);
gboolean gimp_layer_remove_mask (GimpLayer *layer,
GimpMaskApplyMode mode);
gboolean gimp_layer_is_floating_sel (GimpLayer *layer);

39
libgimp/gimplayermask.c Normal file
View File

@ -0,0 +1,39 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimplayermask.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
* Library 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"
G_DEFINE_TYPE (GimpLayerMask, gimp_layer_mask, GIMP_TYPE_CHANNEL)
#define parent_class gimp_layer_mask_parent_class
static void
gimp_layer_mask_class_init (GimpLayerMaskClass *klass)
{
}
static void
gimp_layer_mask_init (GimpLayerMask *layer_mask)
{
}

70
libgimp/gimplayermask.h Normal file
View File

@ -0,0 +1,70 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimplayermask.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_LAYER_MASK_H__
#define __GIMP_LAYER_MASK_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_LAYER_MASK (gimp_layer_mask_get_type ())
#define GIMP_LAYER_MASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LAYER_MASK, GimpLayerMask))
#define GIMP_LAYER_MASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LAYER_MASK, GimpLayerMaskClass))
#define GIMP_IS_LAYER_MASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LAYER_MASK))
#define GIMP_IS_LAYER_MASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LAYER_MASK))
#define GIMP_LAYER_MASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LAYER_MASK, GimpLayerMaskClass))
typedef struct _GimpLayerMaskClass GimpLayerMaskClass;
typedef struct _GimpLayerMaskPrivate GimpLayerMaskPrivate;
struct _GimpLayerMask
{
GimpChannel parent_instance;
};
struct _GimpLayerMaskClass
{
GimpChannelClass 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_mask_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GIMP_LAYER_MASK_H__ */

View File

@ -37,7 +37,7 @@
/**
* _gimp_progress_init:
* @message: Message to use in the progress dialog.
* @gdisplay_ID: GimpDisplay to update progressbar in, or -1 for a separate window.
* @gdisplay: GimpDisplay to update progressbar in, or -1 for a separate window.
*
* Initializes the progress bar for the current plug-in.
*
@ -48,7 +48,49 @@
**/
gboolean
_gimp_progress_init (const gchar *message,
gint32 gdisplay_ID)
GimpDisplay *gdisplay)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
G_TYPE_STRING, message,
GIMP_TYPE_DISPLAY_ID, gimp_display_get_id (gdisplay),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-progress-init",
args);
else
return_vals = gimp_run_procedure_array ("gimp-progress-init",
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_progress_init: (skip)
* @message: Message to use in the progress dialog.
* @gdisplay_ID: GimpDisplay to update progressbar in, or -1 for a separate window.
*
* Initializes the progress bar for the current plug-in.
*
* Initializes the progress bar for the current plug-in. It is only
* valid to call this procedure from a plug-in.
*
* Returns: TRUE on success.
**/
gboolean
__gimp_progress_init (const gchar *message,
gint32 gdisplay_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;

View File

@ -32,8 +32,6 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
G_GNUC_INTERNAL gboolean _gimp_progress_init (const gchar *message,
gint32 gdisplay_ID);
G_GNUC_INTERNAL gboolean _gimp_progress_update (gdouble percentage);
gboolean gimp_progress_pulse (void);
gboolean gimp_progress_set_text (const gchar *message);
@ -45,10 +43,12 @@ gboolean gimp_progress_cancel (const gchar *progress_
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
G_GNUC_INTERNAL gboolean _gimp_progress_init (const gchar *message,
GimpDisplay *gdisplay);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define _gimp_progress_init __gimp_progress_init
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@ -57,7 +57,8 @@ gboolean gimp_progress_cancel (const gchar *progress_
* They are not marked internal as a trick to keep the old API alive for now.
*/
gboolean __gimp_progress_init (const gchar *message,
gint32 gdisplay_ID);
G_END_DECLS

View File

@ -22,6 +22,20 @@
#include "gimp.h"
G_DEFINE_TYPE (GimpSelection, gimp_selection, GIMP_TYPE_CHANNEL)
#define parent_class gimp_selection_parent_class
static void
gimp_selection_class_init (GimpSelectionClass *klass)
{
}
static void
gimp_selection_init (GimpSelection *selection)
{
}
/**
* gimp_selection_float:
* @image: ignored

View File

@ -30,6 +30,39 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_SELECTION (gimp_selection_get_type ())
#define GIMP_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SELECTION, GimpSelection))
#define GIMP_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SELECTION, GimpSelectionClass))
#define GIMP_IS_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_SELECTION))
#define GIMP_IS_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SELECTION))
#define GIMP_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SELECTION, GimpSelectionClass))
typedef struct _GimpSelectionClass GimpSelectionClass;
struct _GimpSelection
{
GimpChannel parent_instance;
};
struct _GimpSelectionClass
{
GimpChannelClass 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_selection_get_type (void) G_GNUC_CONST;
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
GimpLayer * gimp_selection_float (GimpImage *image,

View File

@ -1294,15 +1294,15 @@ _gimp_selection_flood (gint32 image_ID)
* new channel. The new channel is automatically inserted into the
* image's list of channels.
*
* Returns: The new channel.
* Returns: (transfer full): The new channel.
**/
gint32
GimpChannel *
gimp_selection_save (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 channel_ID = -1;
GimpChannel *channel = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@ -1318,11 +1318,11 @@ gimp_selection_save (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
channel = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals);
return channel_ID;
return channel;
}
/**

View File

@ -65,7 +65,7 @@ gboolean gimp_selection_grow (GimpImage *image,
gboolean gimp_selection_shrink (GimpImage *image,
gint steps);
gboolean gimp_selection_flood (GimpImage *image);
gint32 gimp_selection_save (GimpImage *image);
GimpChannel* gimp_selection_save (GimpImage *image);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */

View File

@ -41,6 +41,12 @@ typedef struct _GimpImage GimpImage;
typedef struct _GimpItem GimpItem;
typedef struct _GimpDrawable GimpDrawable;
typedef struct _GimpLayer GimpLayer;
typedef struct _GimpChannel GimpChannel;
typedef struct _GimpLayerMask GimpLayerMask;
typedef struct _GimpSelection GimpSelection;
typedef struct _GimpVectors GimpVectors;
typedef struct _GimpDisplay GimpDisplay;
/* FIXME move somewhere else */

39
libgimp/gimpvectors.c Normal file
View File

@ -0,0 +1,39 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpvectors.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"
G_DEFINE_TYPE (GimpVectors, gimp_vectors, GIMP_TYPE_ITEM)
#define parent_class gimp_vectors_parent_class
static void
gimp_vectors_class_init (GimpVectorsClass *klass)
{
}
static void
gimp_vectors_init (GimpVectors *vectors)
{
}

70
libgimp/gimpvectors.h Normal file
View File

@ -0,0 +1,70 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpvectors.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_VECTORS_H__
#define __GIMP_VECTORS_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_VECTORS (gimp_vectors_get_type ())
#define GIMP_VECTORS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTORS, GimpVectors))
#define GIMP_VECTORS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VECTORS, GimpVectorsClass))
#define GIMP_IS_VECTORS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VECTORS))
#define GIMP_IS_VECTORS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VECTORS))
#define GIMP_VECTORS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VECTORS, GimpVectorsClass))
typedef struct _GimpVectorsClass GimpVectorsClass;
typedef struct _GimpVectorsPrivate GimpVectorsPrivate;
struct _GimpVectors
{
GimpItem parent_instance;
};
struct _GimpVectorsClass
{
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_vectors_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GIMP_VECTORS_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -32,13 +32,21 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gint32 gimp_vectors_copy (gint32 vectors_ID);
gint* gimp_vectors_get_strokes (gint32 vectors_ID,
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
GimpVectors* gimp_vectors_new (GimpImage *image,
const gchar *name);
GimpVectors* gimp_vectors_new_from_text_layer (GimpImage *image,
GimpLayer *layer);
GimpVectors* gimp_vectors_copy (GimpVectors *vectors);
gint* gimp_vectors_get_strokes (GimpVectors *vectors,
gint *num_strokes);
gdouble gimp_vectors_stroke_get_length (gint32 vectors_ID,
gdouble gimp_vectors_stroke_get_length (GimpVectors *vectors,
gint stroke_id,
gdouble precision);
gboolean gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID,
gboolean gimp_vectors_stroke_get_point_at_dist (GimpVectors *vectors,
gint stroke_id,
gdouble dist,
gdouble precision,
@ -46,62 +54,62 @@ gboolean gimp_vectors_stroke_get_point_at_dist (gint32
gdouble *y_point,
gdouble *slope,
gboolean *valid);
gboolean gimp_vectors_remove_stroke (gint32 vectors_ID,
gboolean gimp_vectors_remove_stroke (GimpVectors *vectors,
gint stroke_id);
gboolean gimp_vectors_stroke_close (gint32 vectors_ID,
gboolean gimp_vectors_stroke_close (GimpVectors *vectors,
gint stroke_id);
gboolean gimp_vectors_stroke_translate (gint32 vectors_ID,
gboolean gimp_vectors_stroke_translate (GimpVectors *vectors,
gint stroke_id,
gint off_x,
gint off_y);
gboolean gimp_vectors_stroke_scale (gint32 vectors_ID,
gboolean gimp_vectors_stroke_scale (GimpVectors *vectors,
gint stroke_id,
gdouble scale_x,
gdouble scale_y);
gboolean gimp_vectors_stroke_rotate (gint32 vectors_ID,
gboolean gimp_vectors_stroke_rotate (GimpVectors *vectors,
gint stroke_id,
gdouble center_x,
gdouble center_y,
gdouble angle);
gboolean gimp_vectors_stroke_flip (gint32 vectors_ID,
gboolean gimp_vectors_stroke_flip (GimpVectors *vectors,
gint stroke_id,
GimpOrientationType flip_type,
gdouble axis);
gboolean gimp_vectors_stroke_flip_free (gint32 vectors_ID,
gboolean gimp_vectors_stroke_flip_free (GimpVectors *vectors,
gint stroke_id,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
GimpVectorsStrokeType gimp_vectors_stroke_get_points (gint32 vectors_ID,
GimpVectorsStrokeType gimp_vectors_stroke_get_points (GimpVectors *vectors,
gint stroke_id,
gint *num_points,
gdouble **controlpoints,
gboolean *closed);
gint gimp_vectors_stroke_new_from_points (gint32 vectors_ID,
gint gimp_vectors_stroke_new_from_points (GimpVectors *vectors,
GimpVectorsStrokeType type,
gint num_points,
const gdouble *controlpoints,
gboolean closed);
gdouble* gimp_vectors_stroke_interpolate (gint32 vectors_ID,
gdouble* gimp_vectors_stroke_interpolate (GimpVectors *vectors,
gint stroke_id,
gdouble precision,
gint *num_coords,
gboolean *closed);
gint gimp_vectors_bezier_stroke_new_moveto (gint32 vectors_ID,
gint gimp_vectors_bezier_stroke_new_moveto (GimpVectors *vectors,
gdouble x0,
gdouble y0);
gboolean gimp_vectors_bezier_stroke_lineto (gint32 vectors_ID,
gboolean gimp_vectors_bezier_stroke_lineto (GimpVectors *vectors,
gint stroke_id,
gdouble x0,
gdouble y0);
gboolean gimp_vectors_bezier_stroke_conicto (gint32 vectors_ID,
gboolean gimp_vectors_bezier_stroke_conicto (GimpVectors *vectors,
gint stroke_id,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1);
gboolean gimp_vectors_bezier_stroke_cubicto (gint32 vectors_ID,
gboolean gimp_vectors_bezier_stroke_cubicto (GimpVectors *vectors,
gint stroke_id,
gdouble x0,
gdouble y0,
@ -109,42 +117,54 @@ gboolean gimp_vectors_bezier_stroke_cubicto (gint32
gdouble y1,
gdouble x2,
gdouble y2);
gint gimp_vectors_bezier_stroke_new_ellipse (gint32 vectors_ID,
gint gimp_vectors_bezier_stroke_new_ellipse (GimpVectors *vectors,
gdouble x0,
gdouble y0,
gdouble radius_x,
gdouble radius_y,
gdouble angle);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
gint32 gimp_vectors_new (GimpImage *image,
const gchar *name);
gint32 gimp_vectors_new_from_text_layer (GimpImage *image,
GimpLayer *layer);
gboolean gimp_vectors_import_from_file (GimpImage *image,
const gchar *filename,
gboolean merge,
gboolean scale,
gint *num_vectors,
gint **vectors_ids);
gboolean gimp_vectors_import_from_string (GimpImage *image,
const gchar *string,
gint length,
gboolean merge,
gboolean scale,
gint *num_vectors,
gint **vectors_ids);
gboolean gimp_vectors_export_to_file (GimpImage *image,
const gchar *filename,
gint32 vectors_ID);
gchar* gimp_vectors_export_to_string (GimpImage *image,
gint32 vectors_ID);
gboolean gimp_vectors_import_from_file (GimpImage *image,
const gchar *filename,
gboolean merge,
gboolean scale,
gint *num_vectors,
gint **vectors_ids);
gboolean gimp_vectors_import_from_string (GimpImage *image,
const gchar *string,
gint length,
gboolean merge,
gboolean scale,
gint *num_vectors,
gint **vectors_ids);
gboolean gimp_vectors_export_to_file (GimpImage *image,
const gchar *filename,
GimpVectors *vectors);
gchar* gimp_vectors_export_to_string (GimpImage *image,
GimpVectors *vectors);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define gimp_vectors_new _gimp_vectors_new
#define gimp_vectors_new_from_text_layer _gimp_vectors_new_from_text_layer
#define gimp_vectors_copy _gimp_vectors_copy
#define gimp_vectors_get_strokes _gimp_vectors_get_strokes
#define gimp_vectors_stroke_get_length _gimp_vectors_stroke_get_length
#define gimp_vectors_stroke_get_point_at_dist _gimp_vectors_stroke_get_point_at_dist
#define gimp_vectors_remove_stroke _gimp_vectors_remove_stroke
#define gimp_vectors_stroke_close _gimp_vectors_stroke_close
#define gimp_vectors_stroke_translate _gimp_vectors_stroke_translate
#define gimp_vectors_stroke_scale _gimp_vectors_stroke_scale
#define gimp_vectors_stroke_rotate _gimp_vectors_stroke_rotate
#define gimp_vectors_stroke_flip _gimp_vectors_stroke_flip
#define gimp_vectors_stroke_flip_free _gimp_vectors_stroke_flip_free
#define gimp_vectors_stroke_get_points _gimp_vectors_stroke_get_points
#define gimp_vectors_stroke_new_from_points _gimp_vectors_stroke_new_from_points
#define gimp_vectors_stroke_interpolate _gimp_vectors_stroke_interpolate
#define gimp_vectors_bezier_stroke_new_moveto _gimp_vectors_bezier_stroke_new_moveto
#define gimp_vectors_bezier_stroke_lineto _gimp_vectors_bezier_stroke_lineto
#define gimp_vectors_bezier_stroke_conicto _gimp_vectors_bezier_stroke_conicto
#define gimp_vectors_bezier_stroke_cubicto _gimp_vectors_bezier_stroke_cubicto
#define gimp_vectors_bezier_stroke_new_ellipse _gimp_vectors_bezier_stroke_new_ellipse
#define gimp_vectors_import_from_file _gimp_vectors_import_from_file
#define gimp_vectors_import_from_string _gimp_vectors_import_from_string
#define gimp_vectors_export_to_file _gimp_vectors_export_to_file
@ -157,28 +177,111 @@ gchar* gimp_vectors_export_to_string (GimpImage *image,
* They are not marked internal as a trick to keep the old API alive for now.
*/
gint32 _gimp_vectors_new (gint32 image_ID,
const gchar *name);
gint32 _gimp_vectors_new_from_text_layer (gint32 image_ID,
gint32 layer_ID);
gboolean _gimp_vectors_import_from_file (gint32 image_ID,
const gchar *filename,
gboolean merge,
gboolean scale,
gint *num_vectors,
gint **vectors_ids);
gboolean _gimp_vectors_import_from_string (gint32 image_ID,
const gchar *string,
gint length,
gboolean merge,
gboolean scale,
gint *num_vectors,
gint **vectors_ids);
gboolean _gimp_vectors_export_to_file (gint32 image_ID,
const gchar *filename,
gint32 vectors_ID);
gchar* _gimp_vectors_export_to_string (gint32 image_ID,
gint32 vectors_ID);
gint32 _gimp_vectors_new (gint32 image_ID,
const gchar *name);
gint32 _gimp_vectors_new_from_text_layer (gint32 image_ID,
gint32 layer_ID);
gint32 _gimp_vectors_copy (gint32 vectors_ID);
gint* _gimp_vectors_get_strokes (gint32 vectors_ID,
gint *num_strokes);
gdouble _gimp_vectors_stroke_get_length (gint32 vectors_ID,
gint stroke_id,
gdouble precision);
gboolean _gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID,
gint stroke_id,
gdouble dist,
gdouble precision,
gdouble *x_point,
gdouble *y_point,
gdouble *slope,
gboolean *valid);
gboolean _gimp_vectors_remove_stroke (gint32 vectors_ID,
gint stroke_id);
gboolean _gimp_vectors_stroke_close (gint32 vectors_ID,
gint stroke_id);
gboolean _gimp_vectors_stroke_translate (gint32 vectors_ID,
gint stroke_id,
gint off_x,
gint off_y);
gboolean _gimp_vectors_stroke_scale (gint32 vectors_ID,
gint stroke_id,
gdouble scale_x,
gdouble scale_y);
gboolean _gimp_vectors_stroke_rotate (gint32 vectors_ID,
gint stroke_id,
gdouble center_x,
gdouble center_y,
gdouble angle);
gboolean _gimp_vectors_stroke_flip (gint32 vectors_ID,
gint stroke_id,
GimpOrientationType flip_type,
gdouble axis);
gboolean _gimp_vectors_stroke_flip_free (gint32 vectors_ID,
gint stroke_id,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
GimpVectorsStrokeType _gimp_vectors_stroke_get_points (gint32 vectors_ID,
gint stroke_id,
gint *num_points,
gdouble **controlpoints,
gboolean *closed);
gint _gimp_vectors_stroke_new_from_points (gint32 vectors_ID,
GimpVectorsStrokeType type,
gint num_points,
const gdouble *controlpoints,
gboolean closed);
gdouble* _gimp_vectors_stroke_interpolate (gint32 vectors_ID,
gint stroke_id,
gdouble precision,
gint *num_coords,
gboolean *closed);
gint _gimp_vectors_bezier_stroke_new_moveto (gint32 vectors_ID,
gdouble x0,
gdouble y0);
gboolean _gimp_vectors_bezier_stroke_lineto (gint32 vectors_ID,
gint stroke_id,
gdouble x0,
gdouble y0);
gboolean _gimp_vectors_bezier_stroke_conicto (gint32 vectors_ID,
gint stroke_id,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1);
gboolean _gimp_vectors_bezier_stroke_cubicto (gint32 vectors_ID,
gint stroke_id,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
gint _gimp_vectors_bezier_stroke_new_ellipse (gint32 vectors_ID,
gdouble x0,
gdouble y0,
gdouble radius_x,
gdouble radius_y,
gdouble angle);
gboolean _gimp_vectors_import_from_file (gint32 image_ID,
const gchar *filename,
gboolean merge,
gboolean scale,
gint *num_vectors,
gint **vectors_ids);
gboolean _gimp_vectors_import_from_string (gint32 image_ID,
const gchar *string,
gint length,
gboolean merge,
gboolean scale,
gint *num_vectors,
gint **vectors_ids);
gboolean _gimp_vectors_export_to_file (gint32 image_ID,
const gchar *filename,
gint32 vectors_ID);
gchar* _gimp_vectors_export_to_string (gint32 image_ID,
gint32 vectors_ID);
G_END_DECLS

View File

@ -82,10 +82,20 @@ sub declare_args {
unless (exists $_->{no_declare} || exists $_->{dead}) {
if ($outargs) {
$result .= " $arg->{type}$_->{name} = $arg->{init_value}";
if (exists $arg->{app_type}) {
$result .= " $arg->{app_type}$_->{name} = $arg->{init_value}";
}
else {
$result .= " $arg->{type}$_->{name} = $arg->{init_value}";
}
}
else {
$result .= " $arg->{const_type}$_->{name}";
if (exists $arg->{app_const_type}) {
$result .= " $arg->{app_const_type}$_->{name}";
}
else {
$result .= " $arg->{const_type}$_->{name}";
}
}
$result .= ";\n";

View File

@ -45,15 +45,6 @@ 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_id_arg) = @_;
my @inargs = @{$proc->{inargs}} if (defined $proc->{inargs});
@ -67,11 +58,7 @@ sub generate_fun {
my $argtype = $arg_types{$type};
my $rettype = '';
if ($api_deprecated && is_id_arg($argtype)) {
return 'gint32 ';
}
if (exists $argtype->{id}) {
if ($api_deprecated && exists $argtype->{id}) {
return 'gint32 ';
}
@ -220,7 +207,7 @@ sub generate_fun {
my $desc = exists $_->{desc} ? $_->{desc} : "";
my $var_len;
my $value;
my $is_id = ($arg->{id} || ($api_deprecated && is_id_arg($arg)));
my $is_id = $arg->{id} && $api_deprecated;
$var .= '_ID' if $is_id;
@ -318,7 +305,7 @@ sub generate_fun {
my ($type) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
my $var;
my $is_id = ($arg->{id} || ($api_deprecated && is_id_arg($arg)));
my $is_id = $arg->{id} && $api_deprecated;
$return_marshal = "" unless $once++;
@ -399,7 +386,7 @@ CODE
my ($type) = &arg_parse($_->{type});
my $desc = exists $_->{desc} ? $_->{desc} : "";
my $arg = $arg_types{$type};
my $is_id = ($arg->{id} || ($api_deprecated && is_id_arg($arg)));
my $is_id = $arg->{id} && $api_deprecated;
my $var;
# The return value variable
@ -733,7 +720,7 @@ sub generate {
foreach (@outargs) {
my ($type, @typeinfo) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
if (is_id_arg($arg)) {
if (exists $arg->{id}) {
$has_id_arg = 1;
last;
}
@ -742,7 +729,7 @@ sub generate {
foreach (@inargs) {
my ($type, @typeinfo) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
if (is_id_arg($arg)) {
if (exists $arg->{id}) {
$has_id_arg = 1;
last;
}

View File

@ -150,19 +150,25 @@ package Gimp::CodeGen::pdb;
display => { name => 'DISPLAY',
gtype => 'GIMP_TYPE_DISPLAY_ID',
type => 'GimpObject *',
const_type => 'GimpObject *',
type => 'GimpDisplay *',
const_type => 'GimpDisplay *',
app_type => 'GimpObject *',
app_const_type => 'GimpObject *',
id => 1,
init_value => 'NULL',
out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_display ($value, gimp)',
dup_value_func => '$var = gimp_value_get_display_id ($value)',
set_value_func => 'gimp_value_set_display_id ($value, $var)',
take_value_func => 'gimp_value_set_display ($value, $var)' },
dup_value_func => '$var = gimp_display_new_by_id (gimp_value_get_display_id ($value))',
dup_value_func_d=> '$var = gimp_value_get_display_id ($value)',
set_value_func => 'gimp_value_set_display_id ($value, gimp_display_get_id ($var))',
take_value_func => 'gimp_value_set_display ($value, $var)' ,
convert_func => 'gimp_display_get_id ($var)'},
image => { name => 'IMAGE',
gtype => 'GIMP_TYPE_IMAGE_ID',
type => 'GimpImage *',
const_type => 'GimpImage *',
id => 1,
init_value => 'NULL',
out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_image ($value, gimp)',
@ -177,6 +183,7 @@ 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)',
@ -191,6 +198,7 @@ package Gimp::CodeGen::pdb;
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)',
@ -207,16 +215,20 @@ package Gimp::CodeGen::pdb;
const_type => 'GimpChannel *',
id => 1,
init_value => 'NULL',
out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_channel ($value, gimp)',
dup_value_func => '$var = gimp_value_get_channel_id ($value)',
dup_value_func => '$var = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id ($value)))',
dup_value_func_d=> '$var = gimp_value_get_channel_id ($value)',
set_value_func => 'gimp_value_set_channel_id ($value, $var)',
take_value_func => 'gimp_value_set_channel ($value, $var)',
convert_func => 'gimp_item_get_id (GIMP_ITEM ($var))',
headers => [ qw("core/gimpchannel.h") ] },
drawable => { name => 'DRAWABLE',
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)',
@ -233,10 +245,13 @@ package Gimp::CodeGen::pdb;
const_type => 'GimpSelection *',
id => 1,
init_value => 'NULL',
out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_selection ($value, gimp)',
dup_value_func => '$var = gimp_value_get_selection_id ($value)',
dup_value_func => '$var = GIMP_SELECTION (gimp_item_new_by_id (gimp_value_get_selection_id ($value)))',
dup_value_func_d=> '$var = gimp_value_get_selection_id ($value)',
set_value_func => 'gimp_value_set_selection_id ($value, $var)',
take_value_func => 'gimp_value_set_selection ($value, $var)',
convert_func => 'gimp_item_get_id (GIMP_ITEM ($var))',
headers => [ qw("core/gimpselection.h") ] },
layer_mask => { name => 'CHANNEL',
@ -245,10 +260,13 @@ package Gimp::CodeGen::pdb;
const_type => 'GimpLayerMask *',
id => 1,
init_value => 'NULL',
out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_layer_mask ($value, gimp)',
dup_value_func => '$var = gimp_value_get_layer_mask_id ($value)',
dup_value_func => '$var = GIMP_LAYER_MASK (gimp_item_new_by_id (gimp_value_get_layer_mask_id ($value)))',
dup_value_func_d=> '$var = gimp_value_get_layer_mask_id ($value)',
set_value_func => 'gimp_value_set_layer_mask_id ($value, $var)',
take_value_func => 'gimp_value_set_layer_mask ($value, $var)',
convert_func => 'gimp_item_get_id (GIMP_ITEM ($var))',
headers => [ qw("core/gimplayermask.h") ] },
vectors => { name => 'VECTORS',
@ -257,10 +275,13 @@ package Gimp::CodeGen::pdb;
const_type => 'GimpVectors *',
id => 1,
init_value => 'NULL',
out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_vectors ($value, gimp)',
dup_value_func => '$var = gimp_value_get_vectors_id ($value)',
dup_value_func => '$var = GIMP_VECTORS (gimp_item_new_by_id (gimp_value_get_vectors_id ($value)))',
dup_value_func_d=> '$var = gimp_value_get_vectors_id ($value)',
set_value_func => 'gimp_value_set_vectors_id ($value, $var)',
take_value_func => 'gimp_value_set_vectors ($value, $var)',
convert_func => 'gimp_item_get_id (GIMP_ITEM ($var))',
headers => [ qw("vectors/gimpvectors.h") ] },
parasite => { name => 'PARASITE',