libgimp: generate functions both for old and new GimpImage APIs.

This way, it would still be possible to use the old API. WIP.
This commit is contained in:
Jehan 2019-08-12 14:44:07 +02:00
parent 688c3230d0
commit 17a40b049f
40 changed files with 9732 additions and 980 deletions

View File

@ -94,6 +94,66 @@ _gimp_channel_new (GimpImage *image,
return channel_ID; return channel_ID;
} }
/**
* __gimp_channel_new: (skip)
* @image_ID: The image to which to add the channel.
* @width: The channel width.
* @height: The channel height.
* @name: The channel name.
* @opacity: The channel opacity.
* @color: The channel compositing color.
*
* Create a new channel.
*
* This procedure creates a new channel with the specified width,
* height, name, opacity and color.
* 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().
* Other attributes, such as channel visibility, should be set with
* explicit procedure calls.
* The channel's contents are undefined initially.
*
* Returns: The newly created channel.
**/
gint32
__gimp_channel_new (gint32 image_ID,
gint width,
gint height,
const gchar *name,
gdouble opacity,
const GimpRGB *color)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 channel_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, width,
G_TYPE_INT, height,
G_TYPE_STRING, name,
G_TYPE_DOUBLE, opacity,
GIMP_TYPE_RGB, color,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-channel-new",
args);
else
return_vals = gimp_run_procedure_array ("gimp-channel-new",
args);
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));
gimp_value_array_unref (return_vals);
return channel_ID;
}
/** /**
* gimp_channel_new_from_component: * gimp_channel_new_from_component:
* @image: The image to which to add the channel. * @image: The image to which to add the channel.
@ -145,6 +205,57 @@ gimp_channel_new_from_component (GimpImage *image,
return channel_ID; return channel_ID;
} }
/**
* _gimp_channel_new_from_component: (skip)
* @image_ID: The image to which to add the channel.
* @component: The image component.
* @name: The channel name.
*
* Create a new channel from a color component
*
* This procedure creates a new channel from a color component.
* 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().
* Other attributes, such as channel visibility, should be set with
* explicit procedure calls.
*
* Returns: The newly created channel.
*
* Since: 2.4
**/
gint32
_gimp_channel_new_from_component (gint32 image_ID,
GimpChannelType component,
const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 channel_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_CHANNEL_TYPE, component,
G_TYPE_STRING, name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-channel-new-from-component",
args);
else
return_vals = gimp_run_procedure_array ("gimp-channel-new-from-component",
args);
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));
gimp_value_array_unref (return_vals);
return channel_ID;
}
/** /**
* gimp_channel_copy: * gimp_channel_copy:
* @channel_ID: The channel to copy. * @channel_ID: The channel to copy.

View File

@ -32,31 +32,42 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
G_GNUC_INTERNAL gint32 _gimp_channel_new (GimpImage *image, G_GNUC_INTERNAL gint32 _gimp_channel_new (GimpImage *image,
gint width, gint width,
gint height, gint height,
const gchar *name, const gchar *name,
gdouble opacity, gdouble opacity,
const GimpRGB *color); const GimpRGB *color);
gint32 gimp_channel_new_from_component (GimpImage *image, GIMP_DEPRECATED_FOR(_gimp_channel_new)
GimpChannelType component, G_GNUC_INTERNAL gint32 __gimp_channel_new (gint32 image_ID,
const gchar *name); gint width,
gint32 gimp_channel_copy (gint32 channel_ID); gint height,
gboolean gimp_channel_combine_masks (gint32 channel1_ID, const gchar *name,
gint32 channel2_ID, gdouble opacity,
GimpChannelOps operation, const GimpRGB *color);
gint offx, gint32 gimp_channel_new_from_component (GimpImage *image,
gint offy); GimpChannelType component,
gboolean gimp_channel_get_show_masked (gint32 channel_ID); const gchar *name);
gboolean gimp_channel_set_show_masked (gint32 channel_ID, GIMP_DEPRECATED_FOR(gimp_channel_new_from_component)
gboolean show_masked); G_GNUC_INTERNAL gint32 _gimp_channel_new_from_component (gint32 image_ID,
gdouble gimp_channel_get_opacity (gint32 channel_ID); GimpChannelType component,
gboolean gimp_channel_set_opacity (gint32 channel_ID, const gchar *name);
gdouble opacity); gint32 gimp_channel_copy (gint32 channel_ID);
gboolean gimp_channel_get_color (gint32 channel_ID, gboolean gimp_channel_combine_masks (gint32 channel1_ID,
GimpRGB *color); gint32 channel2_ID,
gboolean gimp_channel_set_color (gint32 channel_ID, GimpChannelOps operation,
const GimpRGB *color); 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 G_END_DECLS

View File

@ -120,6 +120,50 @@ gimp_display_new (GimpImage *image)
return display_ID; return display_ID;
} }
/**
* _gimp_display_new: (skip)
* @image_ID: The image.
*
* Create a new display for the specified image.
*
* Creates a new display for the specified image. If the image already
* has a display, another is added. Multiple displays are handled
* transparently by GIMP. The newly created display is returned and can
* be subsequently destroyed with a call to gimp_display_delete(). This
* 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.
**/
gint32
_gimp_display_new (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 display_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-display-new",
args);
else
return_vals = gimp_run_procedure_array ("gimp-display-new",
args);
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));
gimp_value_array_unref (return_vals);
return display_ID;
}
/** /**
* gimp_display_delete: * gimp_display_delete:
* @display_ID: The display to delete. * @display_ID: The display to delete.
@ -289,3 +333,47 @@ gimp_displays_reconnect (GimpImage *old_image,
return success; return success;
} }
/**
* _gimp_displays_reconnect: (skip)
* @old_image_ID: The old image (must have at least one display).
* @new_image_ID: The new image (must not have a display).
*
* Reconnect displays from one image to another image.
*
* This procedure connects all displays of the old_image to the
* new_image. If the old_image has no display or new_image already has
* a display the reconnect is not performed and the procedure returns
* without success. You should rarely need to use this function.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_displays_reconnect (gint32 old_image_ID,
gint32 new_image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, old_image_ID,
GIMP_TYPE_IMAGE_ID, new_image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-displays-reconnect",
args);
else
return_vals = gimp_run_procedure_array ("gimp-displays-reconnect",
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;
}

View File

@ -32,13 +32,18 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gboolean gimp_display_is_valid (gint32 display_ID); gboolean gimp_display_is_valid (gint32 display_ID);
gint32 gimp_display_new (GimpImage *image); gint32 gimp_display_new (GimpImage *image);
gboolean gimp_display_delete (gint32 display_ID); GIMP_DEPRECATED_FOR(gimp_display_new)
gint gimp_display_get_window_handle (gint32 display_ID); G_GNUC_INTERNAL gint32 _gimp_display_new (gint32 image_ID);
gboolean gimp_displays_flush (void); gboolean gimp_display_delete (gint32 display_ID);
gboolean gimp_displays_reconnect (GimpImage *old_image, gint gimp_display_get_window_handle (gint32 display_ID);
GimpImage *new_image); gboolean gimp_displays_flush (void);
gboolean gimp_displays_reconnect (GimpImage *old_image,
GimpImage *new_image);
GIMP_DEPRECATED_FOR(gimp_displays_reconnect)
G_GNUC_INTERNAL gboolean _gimp_displays_reconnect (gint32 old_image_ID,
gint32 new_image_ID);
G_END_DECLS G_END_DECLS

View File

@ -172,6 +172,52 @@ gimp_edit_copy_visible (GimpImage *image)
return non_empty; return non_empty;
} }
/**
* _gimp_edit_copy_visible: (skip)
* @image_ID: The image to copy from.
*
* Copy from the projection.
*
* If there is a selection in the image, then the area specified by the
* selection is copied from the projection and placed in an internal
* GIMP edit buffer. It can subsequently be retrieved using the
* gimp_edit_paste() command. If there is no selection, then the
* projection's contents will be stored in the internal GIMP edit
* buffer.
*
* Returns: TRUE if the copy was successful.
*
* Since: 2.2
**/
gboolean
_gimp_edit_copy_visible (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean non_empty = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-edit-copy-visible",
args);
else
return_vals = gimp_run_procedure_array ("gimp-edit-copy-visible",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return non_empty;
}
/** /**
* gimp_edit_paste: * gimp_edit_paste:
* @drawable_ID: The drawable to paste to. * @drawable_ID: The drawable to paste to.
@ -263,13 +309,55 @@ gimp_edit_paste_as_new_image (void)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
image = gimp_image_new_by_id (g_value_get_int (gimp_value_array_index (return_vals, 1))); image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
return image; return image;
} }
/**
* _gimp_edit_paste_as_new_image: (skip)
*
* Paste buffer to a new image.
*
* This procedure pastes a copy of the internal GIMP edit buffer to a
* new image. The GIMP edit buffer will be empty unless a call was
* previously made to either gimp_edit_cut() or gimp_edit_copy(). This
* procedure returns the new image or -1 if the edit buffer was empty.
*
* Returns: The new image.
*
* Since: 2.10
**/
gint32
_gimp_edit_paste_as_new_image (void)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 image_ID = -1;
args = gimp_value_array_new_from_types (NULL,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-edit-paste-as-new-image",
args);
else
return_vals = gimp_run_procedure_array ("gimp-edit-paste-as-new-image",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
image_ID = gimp_value_get_image_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return image_ID;
}
/** /**
* gimp_edit_named_cut: * gimp_edit_named_cut:
* @drawable_ID: The drawable to cut from. * @drawable_ID: The drawable to cut from.
@ -417,6 +505,54 @@ gimp_edit_named_copy_visible (GimpImage *image,
return real_name; return real_name;
} }
/**
* _gimp_edit_named_copy_visible: (skip)
* @image_ID: The image to copy from.
* @buffer_name: The name of the buffer to create.
*
* Copy from the projection into a named buffer.
*
* This procedure works like gimp_edit_copy_visible(), but additionally
* stores the copied buffer into a named buffer that will stay
* available for later pasting, regardless of any intermediate copy or
* cut operations.
*
* Returns: The real name given to the buffer, or NULL if the copy failed.
* The returned value must be freed with g_free().
*
* Since: 2.4
**/
gchar *
_gimp_edit_named_copy_visible (gint32 image_ID,
const gchar *buffer_name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gchar *real_name = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, buffer_name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-edit-named-copy-visible",
args);
else
return_vals = gimp_run_procedure_array ("gimp-edit-named-copy-visible",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
real_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return real_name;
}
/** /**
* gimp_edit_named_paste: * gimp_edit_named_paste:
* @drawable_ID: The drawable to paste to. * @drawable_ID: The drawable to paste to.
@ -500,9 +636,51 @@ gimp_edit_named_paste_as_new_image (const gchar *buffer_name)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
image = gimp_image_new_by_id (g_value_get_int (gimp_value_array_index (return_vals, 1))); image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
return image; return image;
} }
/**
* _gimp_edit_named_paste_as_new_image: (skip)
* @buffer_name: The name of the buffer to paste.
*
* Paste named buffer to a new image.
*
* This procedure works like gimp_edit_paste_as_new_image() but pastes
* a named buffer instead of the global buffer.
*
* Returns: The new image.
*
* Since: 2.10
**/
gint32
_gimp_edit_named_paste_as_new_image (const gchar *buffer_name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 image_ID = -1;
args = gimp_value_array_new_from_types (NULL,
G_TYPE_STRING, buffer_name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-edit-named-paste-as-new-image",
args);
else
return_vals = gimp_run_procedure_array ("gimp-edit-named-paste-as-new-image",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
image_ID = gimp_value_get_image_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return image_ID;
}

View File

@ -32,22 +32,31 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gboolean gimp_edit_cut (gint32 drawable_ID); gboolean gimp_edit_cut (gint32 drawable_ID);
gboolean gimp_edit_copy (gint32 drawable_ID); gboolean gimp_edit_copy (gint32 drawable_ID);
gboolean gimp_edit_copy_visible (GimpImage *image); gboolean gimp_edit_copy_visible (GimpImage *image);
gint32 gimp_edit_paste (gint32 drawable_ID, GIMP_DEPRECATED_FOR(gimp_edit_copy_visible)
gboolean paste_into); G_GNUC_INTERNAL gboolean _gimp_edit_copy_visible (gint32 image_ID);
GimpImage* gimp_edit_paste_as_new_image (void); gint32 gimp_edit_paste (gint32 drawable_ID,
gchar* gimp_edit_named_cut (gint32 drawable_ID, gboolean paste_into);
const gchar *buffer_name); GimpImage* gimp_edit_paste_as_new_image (void);
gchar* gimp_edit_named_copy (gint32 drawable_ID, GIMP_DEPRECATED_FOR(gimp_edit_paste_as_new_image)
const gchar *buffer_name); G_GNUC_INTERNAL gint32 _gimp_edit_paste_as_new_image (void);
gchar* gimp_edit_named_copy_visible (GimpImage *image, gchar* gimp_edit_named_cut (gint32 drawable_ID,
const gchar *buffer_name); const gchar *buffer_name);
gint32 gimp_edit_named_paste (gint32 drawable_ID, gchar* gimp_edit_named_copy (gint32 drawable_ID,
const gchar *buffer_name, const gchar *buffer_name);
gboolean paste_into); gchar* gimp_edit_named_copy_visible (GimpImage *image,
GimpImage* gimp_edit_named_paste_as_new_image (const gchar *buffer_name); const gchar *buffer_name);
GIMP_DEPRECATED_FOR(gimp_edit_named_copy_visible)
G_GNUC_INTERNAL gchar* _gimp_edit_named_copy_visible (gint32 image_ID,
const gchar *buffer_name);
gint32 gimp_edit_named_paste (gint32 drawable_ID,
const gchar *buffer_name,
gboolean paste_into);
GimpImage* gimp_edit_named_paste_as_new_image (const gchar *buffer_name);
GIMP_DEPRECATED_FOR(gimp_edit_named_paste_as_new_image)
G_GNUC_INTERNAL gint32 _gimp_edit_named_paste_as_new_image (const gchar *buffer_name);
G_END_DECLS G_END_DECLS

View File

@ -78,13 +78,64 @@ gimp_file_load (GimpRunMode run_mode,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
image = gimp_image_new_by_id (g_value_get_int (gimp_value_array_index (return_vals, 1))); image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
return image; return image;
} }
/**
* _gimp_file_load: (skip)
* @run_mode: The run mode.
* @filename: The name of the file to load.
* @raw_filename: The name as entered by the user.
*
* Loads an image file by invoking the right load handler.
*
* This procedure invokes the correct file load handler using magic if
* possible, and falling back on the file's extension and/or prefix if
* not. The name of the file to load is typically a full pathname, and
* the name entered is what the user actually typed before prepending a
* directory path. The reason for this is that if the user types
* https://www.gimp.org/foo.png he wants to fetch a URL, and the full
* pathname will not look like a URL.
*
* Returns: The output image.
**/
gint32
_gimp_file_load (GimpRunMode run_mode,
const gchar *filename,
const gchar *raw_filename)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 image_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_RUN_MODE, run_mode,
G_TYPE_STRING, filename,
G_TYPE_STRING, raw_filename,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-file-load",
args);
else
return_vals = gimp_run_procedure_array ("gimp-file-load",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
image_ID = gimp_value_get_image_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return image_ID;
}
/** /**
* gimp_file_load_layer: * gimp_file_load_layer:
* @run_mode: The run mode. * @run_mode: The run mode.
@ -135,6 +186,56 @@ gimp_file_load_layer (GimpRunMode run_mode,
return layer_ID; return layer_ID;
} }
/**
* _gimp_file_load_layer: (skip)
* @run_mode: The run mode.
* @image_ID: Destination image.
* @filename: The name of the file to load.
*
* Loads an image file as a layer for an existing image.
*
* This procedure behaves like the file-load procedure but opens the
* specified image as a layer for an existing image. The returned layer
* needs to be added to the existing image with
* gimp_image_insert_layer().
*
* Returns: The layer created when loading the image file.
*
* Since: 2.4
**/
gint32
_gimp_file_load_layer (GimpRunMode run_mode,
gint32 image_ID,
const gchar *filename)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_RUN_MODE, run_mode,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, filename,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-file-load-layer",
args);
else
return_vals = gimp_run_procedure_array ("gimp-file-load-layer",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return layer_ID;
}
/** /**
* gimp_file_load_layers: * gimp_file_load_layers:
* @run_mode: The run mode. * @run_mode: The run mode.
@ -194,6 +295,64 @@ gimp_file_load_layers (GimpRunMode run_mode,
return layer_ids; return layer_ids;
} }
/**
* _gimp_file_load_layers: (skip)
* @run_mode: The run mode.
* @image_ID: Destination image.
* @filename: The name of the file to load.
* @num_layers: (out): The number of loaded layers.
*
* Loads an image file as layers for an existing image.
*
* This procedure behaves like the file-load procedure but opens the
* specified image as layers for an existing image. The returned layers
* needs to be added to the existing image with
* gimp_image_insert_layer().
*
* Returns: (array length=num_layers): The list of loaded layers.
* The returned value must be freed with g_free().
*
* Since: 2.4
**/
gint *
_gimp_file_load_layers (GimpRunMode run_mode,
gint32 image_ID,
const gchar *filename,
gint *num_layers)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint *layer_ids = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_RUN_MODE, run_mode,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, filename,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-file-load-layers",
args);
else
return_vals = gimp_run_procedure_array ("gimp-file-load-layers",
args);
gimp_value_array_unref (args);
*num_layers = 0;
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
{
*num_layers = g_value_get_int (gimp_value_array_index (return_vals, 1));
layer_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
}
gimp_value_array_unref (return_vals);
return layer_ids;
}
/** /**
* gimp_file_save: * gimp_file_save:
* @run_mode: The run mode. * @run_mode: The run mode.
@ -250,6 +409,62 @@ gimp_file_save (GimpRunMode run_mode,
return success; return success;
} }
/**
* _gimp_file_save: (skip)
* @run_mode: The run mode.
* @image_ID: Input image.
* @drawable_ID: Drawable to save.
* @filename: The name of the file to save the image in.
* @raw_filename: The name as entered by the user.
*
* Saves a file by extension.
*
* This procedure invokes the correct file save handler according to
* the file's extension and/or prefix. The name of the file to save is
* typically a full pathname, and the name entered is what the user
* actually typed before prepending a directory path. The reason for
* this is that if the user types https://www.gimp.org/foo.png she
* wants to fetch a URL, and the full pathname will not look like a
* URL.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_file_save (GimpRunMode run_mode,
gint32 image_ID,
gint32 drawable_ID,
const gchar *filename,
const gchar *raw_filename)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_RUN_MODE, run_mode,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
G_TYPE_STRING, filename,
G_TYPE_STRING, raw_filename,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-file-save",
args);
else
return_vals = gimp_run_procedure_array ("gimp-file-save",
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_file_save_thumbnail: * gimp_file_save_thumbnail:
* @image: The image. * @image: The image.
@ -296,6 +511,52 @@ gimp_file_save_thumbnail (GimpImage *image,
return success; return success;
} }
/**
* _gimp_file_save_thumbnail: (skip)
* @image_ID: The image.
* @filename: The name of the file the thumbnail belongs to.
*
* Saves a thumbnail for the given image
*
* This procedure saves a thumbnail for the given image according to
* the Free Desktop Thumbnail Managing Standard. The thumbnail is saved
* so that it belongs to the file with the given filename. This means
* you have to save the image under this name first, otherwise this
* procedure will fail. This procedure may become useful if you want to
* explicitly save a thumbnail with a file.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_file_save_thumbnail (gint32 image_ID,
const gchar *filename)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, filename,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-file-save-thumbnail",
args);
else
return_vals = gimp_run_procedure_array ("gimp-file-save-thumbnail",
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_register_magic_load_handler: * _gimp_register_magic_load_handler:
* @procedure_name: The name of the procedure to be used for loading. * @procedure_name: The name of the procedure to be used for loading.

View File

@ -35,20 +35,42 @@ G_BEGIN_DECLS
GimpImage* gimp_file_load (GimpRunMode run_mode, GimpImage* gimp_file_load (GimpRunMode run_mode,
const gchar *filename, const gchar *filename,
const gchar *raw_filename); const gchar *raw_filename);
GIMP_DEPRECATED_FOR(gimp_file_load)
G_GNUC_INTERNAL gint32 _gimp_file_load (GimpRunMode run_mode,
const gchar *filename,
const gchar *raw_filename);
gint32 gimp_file_load_layer (GimpRunMode run_mode, gint32 gimp_file_load_layer (GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
const gchar *filename); const gchar *filename);
GIMP_DEPRECATED_FOR(gimp_file_load_layer)
G_GNUC_INTERNAL gint32 _gimp_file_load_layer (GimpRunMode run_mode,
gint32 image_ID,
const gchar *filename);
gint* gimp_file_load_layers (GimpRunMode run_mode, gint* gimp_file_load_layers (GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
const gchar *filename, const gchar *filename,
gint *num_layers); gint *num_layers);
GIMP_DEPRECATED_FOR(gimp_file_load_layers)
G_GNUC_INTERNAL gint* _gimp_file_load_layers (GimpRunMode run_mode,
gint32 image_ID,
const gchar *filename,
gint *num_layers);
gboolean gimp_file_save (GimpRunMode run_mode, gboolean gimp_file_save (GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
gint32 drawable_ID, gint32 drawable_ID,
const gchar *filename, const gchar *filename,
const gchar *raw_filename); const gchar *raw_filename);
GIMP_DEPRECATED_FOR(gimp_file_save)
G_GNUC_INTERNAL gboolean _gimp_file_save (GimpRunMode run_mode,
gint32 image_ID,
gint32 drawable_ID,
const gchar *filename,
const gchar *raw_filename);
gboolean gimp_file_save_thumbnail (GimpImage *image, gboolean gimp_file_save_thumbnail (GimpImage *image,
const gchar *filename); const gchar *filename);
GIMP_DEPRECATED_FOR(gimp_file_save_thumbnail)
G_GNUC_INTERNAL gboolean _gimp_file_save_thumbnail (gint32 image_ID,
const gchar *filename);
G_GNUC_INTERNAL gboolean _gimp_register_magic_load_handler (const gchar *procedure_name, G_GNUC_INTERNAL gboolean _gimp_register_magic_load_handler (const gchar *procedure_name,
const gchar *extensions, const gchar *extensions,
const gchar *prefixes, const gchar *prefixes,

File diff suppressed because it is too large Load Diff

View File

@ -32,165 +32,404 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gboolean gimp_image_is_valid (GimpImage *image); gboolean gimp_image_is_valid (GimpImage *image);
gint* gimp_image_list (gint *num_images); GIMP_DEPRECATED_FOR(gimp_image_is_valid)
GimpImage* gimp_image_new (gint width, G_GNUC_INTERNAL gboolean _gimp_image_is_valid (gint32 image_ID);
gint height, gint* gimp_image_list (gint *num_images);
GimpImageBaseType type); GimpImage* gimp_image_new (gint width,
GimpImage* gimp_image_new_with_precision (gint width, gint height,
gint height, GimpImageBaseType type);
GimpImageBaseType type, GIMP_DEPRECATED_FOR(gimp_image_new)
GimpPrecision precision); G_GNUC_INTERNAL gint32 _gimp_image_new (gint width,
GimpImage* gimp_image_duplicate (GimpImage *image); gint height,
gboolean gimp_image_delete (GimpImage *image); GimpImageBaseType type);
GimpImageBaseType gimp_image_base_type (GimpImage *image); GimpImage* gimp_image_new_with_precision (gint width,
GimpPrecision gimp_image_get_precision (GimpImage *image); gint height,
GimpLayerMode gimp_image_get_default_new_layer_mode (GimpImage *image); GimpImageBaseType type,
gint gimp_image_width (GimpImage *image); GimpPrecision precision);
gint gimp_image_height (GimpImage *image); GIMP_DEPRECATED_FOR(gimp_image_new_with_precision)
gint* gimp_image_get_layers (GimpImage *image, G_GNUC_INTERNAL gint32 _gimp_image_new_with_precision (gint width,
gint *num_layers); gint height,
gint* gimp_image_get_channels (GimpImage *image, GimpImageBaseType type,
gint *num_channels); GimpPrecision precision);
gint* gimp_image_get_vectors (GimpImage *image, GimpImage* gimp_image_duplicate (GimpImage *image);
gint *num_vectors); GIMP_DEPRECATED_FOR(gimp_image_duplicate)
gint32 gimp_image_get_active_drawable (GimpImage *image); G_GNUC_INTERNAL gint32 _gimp_image_duplicate (gint32 image_ID);
gboolean gimp_image_unset_active_channel (GimpImage *image); gboolean gimp_image_delete (GimpImage *image);
gint32 gimp_image_get_floating_sel (GimpImage *image); GIMP_DEPRECATED_FOR(gimp_image_delete)
gint32 gimp_image_floating_sel_attached_to (GimpImage *image); G_GNUC_INTERNAL gboolean _gimp_image_delete (gint32 image_ID);
gboolean gimp_image_pick_color (GimpImage *image, GimpImageBaseType gimp_image_base_type (GimpImage *image);
gint32 drawable_ID, GIMP_DEPRECATED_FOR(gimp_image_base_type)
gdouble x, G_GNUC_INTERNAL GimpImageBaseType _gimp_image_base_type (gint32 image_ID);
gdouble y, GimpPrecision gimp_image_get_precision (GimpImage *image);
gboolean sample_merged, GIMP_DEPRECATED_FOR(gimp_image_get_precision)
gboolean sample_average, G_GNUC_INTERNAL GimpPrecision _gimp_image_get_precision (gint32 image_ID);
gdouble average_radius, GimpLayerMode gimp_image_get_default_new_layer_mode (GimpImage *image);
GimpRGB *color); GIMP_DEPRECATED_FOR(gimp_image_get_default_new_layer_mode)
gint32 gimp_image_pick_correlate_layer (GimpImage *image, G_GNUC_INTERNAL GimpLayerMode _gimp_image_get_default_new_layer_mode (gint32 image_ID);
gint x, gint gimp_image_width (GimpImage *image);
gint y); GIMP_DEPRECATED_FOR(gimp_image_width)
gboolean gimp_image_insert_layer (GimpImage *image, G_GNUC_INTERNAL gint _gimp_image_width (gint32 image_ID);
gint32 layer_ID, gint gimp_image_height (GimpImage *image);
gint32 parent_ID, GIMP_DEPRECATED_FOR(gimp_image_height)
gint position); G_GNUC_INTERNAL gint _gimp_image_height (gint32 image_ID);
gboolean gimp_image_remove_layer (GimpImage *image, gint* gimp_image_get_layers (GimpImage *image,
gint32 layer_ID); gint *num_layers);
gboolean gimp_image_freeze_layers (GimpImage *image); GIMP_DEPRECATED_FOR(gimp_image_get_layers)
gboolean gimp_image_thaw_layers (GimpImage *image); G_GNUC_INTERNAL gint* _gimp_image_get_layers (gint32 image_ID,
gboolean gimp_image_insert_channel (GimpImage *image, gint *num_layers);
gint32 channel_ID, gint* gimp_image_get_channels (GimpImage *image,
gint32 parent_ID, gint *num_channels);
gint position); GIMP_DEPRECATED_FOR(gimp_image_get_channels)
gboolean gimp_image_remove_channel (GimpImage *image, G_GNUC_INTERNAL gint* _gimp_image_get_channels (gint32 image_ID,
gint32 channel_ID); gint *num_channels);
gboolean gimp_image_freeze_channels (GimpImage *image); gint* gimp_image_get_vectors (GimpImage *image,
gboolean gimp_image_thaw_channels (GimpImage *image); gint *num_vectors);
gboolean gimp_image_insert_vectors (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_get_vectors)
gint32 vectors_ID, G_GNUC_INTERNAL gint* _gimp_image_get_vectors (gint32 image_ID,
gint32 parent_ID, gint *num_vectors);
gint position); gint32 gimp_image_get_active_drawable (GimpImage *image);
gboolean gimp_image_remove_vectors (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_get_active_drawable)
gint32 vectors_ID); G_GNUC_INTERNAL gint32 _gimp_image_get_active_drawable (gint32 image_ID);
gboolean gimp_image_freeze_vectors (GimpImage *image); gboolean gimp_image_unset_active_channel (GimpImage *image);
gboolean gimp_image_thaw_vectors (GimpImage *image); GIMP_DEPRECATED_FOR(gimp_image_unset_active_channel)
gint gimp_image_get_item_position (GimpImage *image, G_GNUC_INTERNAL gboolean _gimp_image_unset_active_channel (gint32 image_ID);
gint32 item_ID); gint32 gimp_image_get_floating_sel (GimpImage *image);
gboolean gimp_image_raise_item (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_get_floating_sel)
gint32 item_ID); G_GNUC_INTERNAL gint32 _gimp_image_get_floating_sel (gint32 image_ID);
gboolean gimp_image_lower_item (GimpImage *image, gint32 gimp_image_floating_sel_attached_to (GimpImage *image);
gint32 item_ID); GIMP_DEPRECATED_FOR(gimp_image_floating_sel_attached_to)
gboolean gimp_image_raise_item_to_top (GimpImage *image, G_GNUC_INTERNAL gint32 _gimp_image_floating_sel_attached_to (gint32 image_ID);
gint32 item_ID); gboolean gimp_image_pick_color (GimpImage *image,
gboolean gimp_image_lower_item_to_bottom (GimpImage *image, gint32 drawable_ID,
gint32 item_ID); gdouble x,
gboolean gimp_image_reorder_item (GimpImage *image, gdouble y,
gint32 item_ID, gboolean sample_merged,
gint32 parent_ID, gboolean sample_average,
gint position); gdouble average_radius,
gint32 gimp_image_flatten (GimpImage *image); GimpRGB *color);
gint32 gimp_image_merge_visible_layers (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_pick_color)
GimpMergeType merge_type); G_GNUC_INTERNAL gboolean _gimp_image_pick_color (gint32 image_ID,
gint32 gimp_image_merge_down (GimpImage *image, gint32 drawable_ID,
gint32 merge_layer_ID, gdouble x,
GimpMergeType merge_type); gdouble y,
G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (GimpImage *image, gboolean sample_merged,
gint *num_bytes); gboolean sample_average,
G_GNUC_INTERNAL gboolean _gimp_image_set_colormap (GimpImage *image, gdouble average_radius,
gint num_bytes, GimpRGB *color);
const guint8 *colormap); gint32 gimp_image_pick_correlate_layer (GimpImage *image,
G_GNUC_INTERNAL gchar* _gimp_image_get_metadata (GimpImage *image); gint x,
G_GNUC_INTERNAL gboolean _gimp_image_set_metadata (GimpImage *image, gint y);
const gchar *metadata_string); GIMP_DEPRECATED_FOR(gimp_image_pick_correlate_layer)
gboolean gimp_image_clean_all (GimpImage *image); G_GNUC_INTERNAL gint32 _gimp_image_pick_correlate_layer (gint32 image_ID,
gboolean gimp_image_is_dirty (GimpImage *image); gint x,
G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (GimpImage *image, gint y);
gint width, gboolean gimp_image_insert_layer (GimpImage *image,
gint height, gint32 layer_ID,
gint *actual_width, gint32 parent_ID,
gint *actual_height, gint position);
gint *bpp, GIMP_DEPRECATED_FOR(gimp_image_insert_layer)
gint *thumbnail_data_count, G_GNUC_INTERNAL gboolean _gimp_image_insert_layer (gint32 image_ID,
guint8 **thumbnail_data); gint32 layer_ID,
gint32 gimp_image_get_active_layer (GimpImage *image); gint32 parent_ID,
gboolean gimp_image_set_active_layer (GimpImage *image, gint position);
gint32 active_layer_ID); gboolean gimp_image_remove_layer (GimpImage *image,
gint32 gimp_image_get_active_channel (GimpImage *image); gint32 layer_ID);
gboolean gimp_image_set_active_channel (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_remove_layer)
gint32 active_channel_ID); G_GNUC_INTERNAL gboolean _gimp_image_remove_layer (gint32 image_ID,
gint32 gimp_image_get_active_vectors (GimpImage *image); gint32 layer_ID);
gboolean gimp_image_set_active_vectors (GimpImage *image, gboolean gimp_image_freeze_layers (GimpImage *image);
gint32 active_vectors_ID); GIMP_DEPRECATED_FOR(gimp_image_freeze_layers)
gint32 gimp_image_get_selection (GimpImage *image); G_GNUC_INTERNAL gboolean _gimp_image_freeze_layers (gint32 image_ID);
gboolean gimp_image_get_component_active (GimpImage *image, gboolean gimp_image_thaw_layers (GimpImage *image);
GimpChannelType component); GIMP_DEPRECATED_FOR(gimp_image_thaw_layers)
gboolean gimp_image_set_component_active (GimpImage *image, G_GNUC_INTERNAL gboolean _gimp_image_thaw_layers (gint32 image_ID);
GimpChannelType component, gboolean gimp_image_insert_channel (GimpImage *image,
gboolean active); gint32 channel_ID,
gboolean gimp_image_get_component_visible (GimpImage *image, gint32 parent_ID,
GimpChannelType component); gint position);
gboolean gimp_image_set_component_visible (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_insert_channel)
GimpChannelType component, G_GNUC_INTERNAL gboolean _gimp_image_insert_channel (gint32 image_ID,
gboolean visible); gint32 channel_ID,
gchar* gimp_image_get_filename (GimpImage *image); gint32 parent_ID,
gboolean gimp_image_set_filename (GimpImage *image, gint position);
const gchar *filename); gboolean gimp_image_remove_channel (GimpImage *image,
gchar* gimp_image_get_uri (GimpImage *image); gint32 channel_ID);
gchar* gimp_image_get_xcf_uri (GimpImage *image); GIMP_DEPRECATED_FOR(gimp_image_remove_channel)
gchar* gimp_image_get_imported_uri (GimpImage *image); G_GNUC_INTERNAL gboolean _gimp_image_remove_channel (gint32 image_ID,
gchar* gimp_image_get_exported_uri (GimpImage *image); gint32 channel_ID);
gchar* gimp_image_get_name (GimpImage *image); gboolean gimp_image_freeze_channels (GimpImage *image);
gboolean gimp_image_get_resolution (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_freeze_channels)
gdouble *xresolution, G_GNUC_INTERNAL gboolean _gimp_image_freeze_channels (gint32 image_ID);
gdouble *yresolution); gboolean gimp_image_thaw_channels (GimpImage *image);
gboolean gimp_image_set_resolution (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_thaw_channels)
gdouble xresolution, G_GNUC_INTERNAL gboolean _gimp_image_thaw_channels (gint32 image_ID);
gdouble yresolution); gboolean gimp_image_insert_vectors (GimpImage *image,
GimpUnit gimp_image_get_unit (GimpImage *image); gint32 vectors_ID,
gboolean gimp_image_set_unit (GimpImage *image, gint32 parent_ID,
GimpUnit unit); gint position);
guint gimp_image_get_tattoo_state (GimpImage *image); GIMP_DEPRECATED_FOR(gimp_image_insert_vectors)
gboolean gimp_image_set_tattoo_state (GimpImage *image, G_GNUC_INTERNAL gboolean _gimp_image_insert_vectors (gint32 image_ID,
guint tattoo_state); gint32 vectors_ID,
gint32 gimp_image_get_layer_by_tattoo (GimpImage *image, gint32 parent_ID,
guint tattoo); gint position);
gint32 gimp_image_get_channel_by_tattoo (GimpImage *image, gboolean gimp_image_remove_vectors (GimpImage *image,
guint tattoo); gint32 vectors_ID);
gint32 gimp_image_get_vectors_by_tattoo (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_remove_vectors)
guint tattoo); G_GNUC_INTERNAL gboolean _gimp_image_remove_vectors (gint32 image_ID,
gint32 gimp_image_get_layer_by_name (GimpImage *image, gint32 vectors_ID);
const gchar *name); gboolean gimp_image_freeze_vectors (GimpImage *image);
gint32 gimp_image_get_channel_by_name (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_freeze_vectors)
const gchar *name); G_GNUC_INTERNAL gboolean _gimp_image_freeze_vectors (gint32 image_ID);
gint32 gimp_image_get_vectors_by_name (GimpImage *image, gboolean gimp_image_thaw_vectors (GimpImage *image);
const gchar *name); GIMP_DEPRECATED_FOR(gimp_image_thaw_vectors)
gboolean gimp_image_attach_parasite (GimpImage *image, G_GNUC_INTERNAL gboolean _gimp_image_thaw_vectors (gint32 image_ID);
const GimpParasite *parasite); gint gimp_image_get_item_position (GimpImage *image,
gboolean gimp_image_detach_parasite (GimpImage *image, gint32 item_ID);
const gchar *name); GIMP_DEPRECATED_FOR(gimp_image_get_item_position)
GimpParasite* gimp_image_get_parasite (GimpImage *image, G_GNUC_INTERNAL gint _gimp_image_get_item_position (gint32 image_ID,
const gchar *name); gint32 item_ID);
gchar** gimp_image_get_parasite_list (GimpImage *image, gboolean gimp_image_raise_item (GimpImage *image,
gint *num_parasites); gint32 item_ID);
GIMP_DEPRECATED_FOR(gimp_image_raise_item)
G_GNUC_INTERNAL gboolean _gimp_image_raise_item (gint32 image_ID,
gint32 item_ID);
gboolean gimp_image_lower_item (GimpImage *image,
gint32 item_ID);
GIMP_DEPRECATED_FOR(gimp_image_lower_item)
G_GNUC_INTERNAL gboolean _gimp_image_lower_item (gint32 image_ID,
gint32 item_ID);
gboolean gimp_image_raise_item_to_top (GimpImage *image,
gint32 item_ID);
GIMP_DEPRECATED_FOR(gimp_image_raise_item_to_top)
G_GNUC_INTERNAL gboolean _gimp_image_raise_item_to_top (gint32 image_ID,
gint32 item_ID);
gboolean gimp_image_lower_item_to_bottom (GimpImage *image,
gint32 item_ID);
GIMP_DEPRECATED_FOR(gimp_image_lower_item_to_bottom)
G_GNUC_INTERNAL gboolean _gimp_image_lower_item_to_bottom (gint32 image_ID,
gint32 item_ID);
gboolean gimp_image_reorder_item (GimpImage *image,
gint32 item_ID,
gint32 parent_ID,
gint position);
GIMP_DEPRECATED_FOR(gimp_image_reorder_item)
G_GNUC_INTERNAL gboolean _gimp_image_reorder_item (gint32 image_ID,
gint32 item_ID,
gint32 parent_ID,
gint position);
gint32 gimp_image_flatten (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_flatten)
G_GNUC_INTERNAL gint32 _gimp_image_flatten (gint32 image_ID);
gint32 gimp_image_merge_visible_layers (GimpImage *image,
GimpMergeType merge_type);
GIMP_DEPRECATED_FOR(gimp_image_merge_visible_layers)
G_GNUC_INTERNAL gint32 _gimp_image_merge_visible_layers (gint32 image_ID,
GimpMergeType merge_type);
gint32 gimp_image_merge_down (GimpImage *image,
gint32 merge_layer_ID,
GimpMergeType merge_type);
GIMP_DEPRECATED_FOR(gimp_image_merge_down)
G_GNUC_INTERNAL gint32 _gimp_image_merge_down (gint32 image_ID,
gint32 merge_layer_ID,
GimpMergeType merge_type);
G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (GimpImage *image,
gint *num_bytes);
GIMP_DEPRECATED_FOR(_gimp_image_get_colormap)
G_GNUC_INTERNAL guint8* __gimp_image_get_colormap (gint32 image_ID,
gint *num_bytes);
G_GNUC_INTERNAL gboolean _gimp_image_set_colormap (GimpImage *image,
gint num_bytes,
const guint8 *colormap);
GIMP_DEPRECATED_FOR(_gimp_image_set_colormap)
G_GNUC_INTERNAL gboolean __gimp_image_set_colormap (gint32 image_ID,
gint num_bytes,
const guint8 *colormap);
G_GNUC_INTERNAL gchar* _gimp_image_get_metadata (GimpImage *image);
GIMP_DEPRECATED_FOR(_gimp_image_get_metadata)
G_GNUC_INTERNAL gchar* __gimp_image_get_metadata (gint32 image_ID);
G_GNUC_INTERNAL gboolean _gimp_image_set_metadata (GimpImage *image,
const gchar *metadata_string);
GIMP_DEPRECATED_FOR(_gimp_image_set_metadata)
G_GNUC_INTERNAL gboolean __gimp_image_set_metadata (gint32 image_ID,
const gchar *metadata_string);
gboolean gimp_image_clean_all (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_clean_all)
G_GNUC_INTERNAL gboolean _gimp_image_clean_all (gint32 image_ID);
gboolean gimp_image_is_dirty (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_is_dirty)
G_GNUC_INTERNAL gboolean _gimp_image_is_dirty (gint32 image_ID);
G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (GimpImage *image,
gint width,
gint height,
gint *actual_width,
gint *actual_height,
gint *bpp,
gint *thumbnail_data_count,
guint8 **thumbnail_data);
GIMP_DEPRECATED_FOR(_gimp_image_thumbnail)
G_GNUC_INTERNAL gboolean __gimp_image_thumbnail (gint32 image_ID,
gint width,
gint height,
gint *actual_width,
gint *actual_height,
gint *bpp,
gint *thumbnail_data_count,
guint8 **thumbnail_data);
gint32 gimp_image_get_active_layer (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_get_active_layer)
G_GNUC_INTERNAL gint32 _gimp_image_get_active_layer (gint32 image_ID);
gboolean gimp_image_set_active_layer (GimpImage *image,
gint32 active_layer_ID);
GIMP_DEPRECATED_FOR(gimp_image_set_active_layer)
G_GNUC_INTERNAL gboolean _gimp_image_set_active_layer (gint32 image_ID,
gint32 active_layer_ID);
gint32 gimp_image_get_active_channel (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_get_active_channel)
G_GNUC_INTERNAL gint32 _gimp_image_get_active_channel (gint32 image_ID);
gboolean gimp_image_set_active_channel (GimpImage *image,
gint32 active_channel_ID);
GIMP_DEPRECATED_FOR(gimp_image_set_active_channel)
G_GNUC_INTERNAL gboolean _gimp_image_set_active_channel (gint32 image_ID,
gint32 active_channel_ID);
gint32 gimp_image_get_active_vectors (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_get_active_vectors)
G_GNUC_INTERNAL gint32 _gimp_image_get_active_vectors (gint32 image_ID);
gboolean gimp_image_set_active_vectors (GimpImage *image,
gint32 active_vectors_ID);
GIMP_DEPRECATED_FOR(gimp_image_set_active_vectors)
G_GNUC_INTERNAL gboolean _gimp_image_set_active_vectors (gint32 image_ID,
gint32 active_vectors_ID);
gint32 gimp_image_get_selection (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_get_selection)
G_GNUC_INTERNAL gint32 _gimp_image_get_selection (gint32 image_ID);
gboolean gimp_image_get_component_active (GimpImage *image,
GimpChannelType component);
GIMP_DEPRECATED_FOR(gimp_image_get_component_active)
G_GNUC_INTERNAL gboolean _gimp_image_get_component_active (gint32 image_ID,
GimpChannelType component);
gboolean gimp_image_set_component_active (GimpImage *image,
GimpChannelType component,
gboolean active);
GIMP_DEPRECATED_FOR(gimp_image_set_component_active)
G_GNUC_INTERNAL gboolean _gimp_image_set_component_active (gint32 image_ID,
GimpChannelType component,
gboolean active);
gboolean gimp_image_get_component_visible (GimpImage *image,
GimpChannelType component);
GIMP_DEPRECATED_FOR(gimp_image_get_component_visible)
G_GNUC_INTERNAL gboolean _gimp_image_get_component_visible (gint32 image_ID,
GimpChannelType component);
gboolean gimp_image_set_component_visible (GimpImage *image,
GimpChannelType component,
gboolean visible);
GIMP_DEPRECATED_FOR(gimp_image_set_component_visible)
G_GNUC_INTERNAL gboolean _gimp_image_set_component_visible (gint32 image_ID,
GimpChannelType component,
gboolean visible);
gchar* gimp_image_get_filename (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_get_filename)
G_GNUC_INTERNAL gchar* _gimp_image_get_filename (gint32 image_ID);
gboolean gimp_image_set_filename (GimpImage *image,
const gchar *filename);
GIMP_DEPRECATED_FOR(gimp_image_set_filename)
G_GNUC_INTERNAL gboolean _gimp_image_set_filename (gint32 image_ID,
const gchar *filename);
gchar* gimp_image_get_uri (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_get_uri)
G_GNUC_INTERNAL gchar* _gimp_image_get_uri (gint32 image_ID);
gchar* gimp_image_get_xcf_uri (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_get_xcf_uri)
G_GNUC_INTERNAL gchar* _gimp_image_get_xcf_uri (gint32 image_ID);
gchar* gimp_image_get_imported_uri (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_get_imported_uri)
G_GNUC_INTERNAL gchar* _gimp_image_get_imported_uri (gint32 image_ID);
gchar* gimp_image_get_exported_uri (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_get_exported_uri)
G_GNUC_INTERNAL gchar* _gimp_image_get_exported_uri (gint32 image_ID);
gchar* gimp_image_get_name (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_get_name)
G_GNUC_INTERNAL gchar* _gimp_image_get_name (gint32 image_ID);
gboolean gimp_image_get_resolution (GimpImage *image,
gdouble *xresolution,
gdouble *yresolution);
GIMP_DEPRECATED_FOR(gimp_image_get_resolution)
G_GNUC_INTERNAL gboolean _gimp_image_get_resolution (gint32 image_ID,
gdouble *xresolution,
gdouble *yresolution);
gboolean gimp_image_set_resolution (GimpImage *image,
gdouble xresolution,
gdouble yresolution);
GIMP_DEPRECATED_FOR(gimp_image_set_resolution)
G_GNUC_INTERNAL gboolean _gimp_image_set_resolution (gint32 image_ID,
gdouble xresolution,
gdouble yresolution);
GimpUnit gimp_image_get_unit (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_get_unit)
G_GNUC_INTERNAL GimpUnit _gimp_image_get_unit (gint32 image_ID);
gboolean gimp_image_set_unit (GimpImage *image,
GimpUnit unit);
GIMP_DEPRECATED_FOR(gimp_image_set_unit)
G_GNUC_INTERNAL gboolean _gimp_image_set_unit (gint32 image_ID,
GimpUnit unit);
guint gimp_image_get_tattoo_state (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_get_tattoo_state)
G_GNUC_INTERNAL guint _gimp_image_get_tattoo_state (gint32 image_ID);
gboolean gimp_image_set_tattoo_state (GimpImage *image,
guint tattoo_state);
GIMP_DEPRECATED_FOR(gimp_image_set_tattoo_state)
G_GNUC_INTERNAL gboolean _gimp_image_set_tattoo_state (gint32 image_ID,
guint tattoo_state);
gint32 gimp_image_get_layer_by_tattoo (GimpImage *image,
guint tattoo);
GIMP_DEPRECATED_FOR(gimp_image_get_layer_by_tattoo)
G_GNUC_INTERNAL gint32 _gimp_image_get_layer_by_tattoo (gint32 image_ID,
guint tattoo);
gint32 gimp_image_get_channel_by_tattoo (GimpImage *image,
guint tattoo);
GIMP_DEPRECATED_FOR(gimp_image_get_channel_by_tattoo)
G_GNUC_INTERNAL gint32 _gimp_image_get_channel_by_tattoo (gint32 image_ID,
guint tattoo);
gint32 gimp_image_get_vectors_by_tattoo (GimpImage *image,
guint tattoo);
GIMP_DEPRECATED_FOR(gimp_image_get_vectors_by_tattoo)
G_GNUC_INTERNAL gint32 _gimp_image_get_vectors_by_tattoo (gint32 image_ID,
guint tattoo);
gint32 gimp_image_get_layer_by_name (GimpImage *image,
const gchar *name);
GIMP_DEPRECATED_FOR(gimp_image_get_layer_by_name)
G_GNUC_INTERNAL gint32 _gimp_image_get_layer_by_name (gint32 image_ID,
const gchar *name);
gint32 gimp_image_get_channel_by_name (GimpImage *image,
const gchar *name);
GIMP_DEPRECATED_FOR(gimp_image_get_channel_by_name)
G_GNUC_INTERNAL gint32 _gimp_image_get_channel_by_name (gint32 image_ID,
const gchar *name);
gint32 gimp_image_get_vectors_by_name (GimpImage *image,
const gchar *name);
GIMP_DEPRECATED_FOR(gimp_image_get_vectors_by_name)
G_GNUC_INTERNAL gint32 _gimp_image_get_vectors_by_name (gint32 image_ID,
const gchar *name);
gboolean gimp_image_attach_parasite (GimpImage *image,
const GimpParasite *parasite);
GIMP_DEPRECATED_FOR(gimp_image_attach_parasite)
G_GNUC_INTERNAL gboolean _gimp_image_attach_parasite (gint32 image_ID,
const GimpParasite *parasite);
gboolean gimp_image_detach_parasite (GimpImage *image,
const gchar *name);
GIMP_DEPRECATED_FOR(gimp_image_detach_parasite)
G_GNUC_INTERNAL gboolean _gimp_image_detach_parasite (gint32 image_ID,
const gchar *name);
GimpParasite* gimp_image_get_parasite (GimpImage *image,
const gchar *name);
GIMP_DEPRECATED_FOR(gimp_image_get_parasite)
G_GNUC_INTERNAL GimpParasite* _gimp_image_get_parasite (gint32 image_ID,
const gchar *name);
gchar** gimp_image_get_parasite_list (GimpImage *image,
gint *num_parasites);
GIMP_DEPRECATED_FOR(gimp_image_get_parasite_list)
G_GNUC_INTERNAL gchar** _gimp_image_get_parasite_list (gint32 image_ID,
gint *num_parasites);
G_END_DECLS G_END_DECLS

View File

@ -85,6 +85,56 @@ _gimp_image_get_color_profile (GimpImage *image,
return profile_data; return profile_data;
} }
/**
* __gimp_image_get_color_profile: (skip)
* @image_ID: The image.
* @num_bytes: (out): Number of bytes in the color_profile array.
*
* Returns the image's color profile
*
* This procedure returns the image's color profile, or NULL if the
* image has no color profile assigned.
*
* Returns: (array length=num_bytes): The image's serialized color profile.
* The returned value must be freed with g_free().
*
* Since: 2.10
**/
guint8 *
__gimp_image_get_color_profile (gint32 image_ID,
gint *num_bytes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
guint8 *profile_data = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-get-color-profile",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-get-color-profile",
args);
gimp_value_array_unref (args);
*num_bytes = 0;
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
{
*num_bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
profile_data = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
}
gimp_value_array_unref (return_vals);
return profile_data;
}
/** /**
* _gimp_image_get_effective_color_profile: * _gimp_image_get_effective_color_profile:
* @image: The image. * @image: The image.
@ -139,6 +189,59 @@ _gimp_image_get_effective_color_profile (GimpImage *image,
return profile_data; return profile_data;
} }
/**
* __gimp_image_get_effective_color_profile: (skip)
* @image_ID: The image.
* @num_bytes: (out): Number of bytes in the color_profile array.
*
* Returns the color profile that is used for the image
*
* This procedure returns the color profile that is actually used for
* this image, which is the profile returned by
* gimp_image_get_color_profile() if the image has a profile assigned,
* or a generated default RGB or grayscale profile, according to the
* image's type.
*
* Returns: (array length=num_bytes): The image's serialized color profile.
* The returned value must be freed with g_free().
*
* Since: 2.10
**/
guint8 *
__gimp_image_get_effective_color_profile (gint32 image_ID,
gint *num_bytes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
guint8 *profile_data = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-get-effective-color-profile",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-get-effective-color-profile",
args);
gimp_value_array_unref (args);
*num_bytes = 0;
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
{
*num_bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
profile_data = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
}
gimp_value_array_unref (return_vals);
return profile_data;
}
/** /**
* _gimp_image_set_color_profile: * _gimp_image_set_color_profile:
* @image: The image. * @image: The image.
@ -190,6 +293,57 @@ _gimp_image_set_color_profile (GimpImage *image,
return success; return success;
} }
/**
* __gimp_image_set_color_profile: (skip)
* @image_ID: The image.
* @num_bytes: Number of bytes in the color_profile array.
* @color_profile: (array length=num_bytes) (element-type guint8): The new serialized color profile.
*
* Sets the image's color profile
*
* This procedure sets the image's color profile, or unsets it if NULL
* is passed as 'color_profile'. This procedure does no color
* conversion. However, it will change the pixel format of all layers
* to contain the babl space matching the profile. You must call this
* procedure before adding layers to the image.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
__gimp_image_set_color_profile (gint32 image_ID,
gint num_bytes,
const guint8 *color_profile)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, num_bytes,
GIMP_TYPE_UINT8_ARRAY, NULL,
G_TYPE_NONE);
gimp_value_set_uint8_array (gimp_value_array_index (args, 2), color_profile, num_bytes);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-set-color-profile",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-set-color-profile",
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_image_set_color_profile_from_file: * gimp_image_set_color_profile_from_file:
* @image: The image. * @image: The image.
@ -238,6 +392,54 @@ gimp_image_set_color_profile_from_file (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_set_color_profile_from_file: (skip)
* @image_ID: The image.
* @uri: The URI of the file containing the new color profile.
*
* Sets the image's color profile from an ICC file
*
* This procedure sets the image's color profile from a file containing
* an ICC profile, or unsets it if NULL is passed as 'uri'. This
* procedure does no color conversion. However, it will change the
* pixel format of all layers to contain the babl space matching the
* profile. You must call this procedure before adding layers to the
* image.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
_gimp_image_set_color_profile_from_file (gint32 image_ID,
const gchar *uri)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, uri,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-set-color-profile-from-file",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-set-color-profile-from-file",
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_image_convert_color_profile: * _gimp_image_convert_color_profile:
* @image: The image. * @image: The image.
@ -294,6 +496,62 @@ _gimp_image_convert_color_profile (GimpImage *image,
return success; return success;
} }
/**
* __gimp_image_convert_color_profile: (skip)
* @image_ID: The image.
* @num_bytes: Number of bytes in the color_profile array.
* @color_profile: (array length=num_bytes) (element-type guint8): The serialized color profile.
* @intent: Rendering intent.
* @bpc: Black point compensation.
*
* Convert the image's layers to a color profile
*
* This procedure converts from the image's color profile (or the
* default RGB or grayscale profile if none is set) to the given color
* profile. Only RGB and grayscale color profiles are accepted,
* according to the image's type.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
__gimp_image_convert_color_profile (gint32 image_ID,
gint num_bytes,
const guint8 *color_profile,
GimpColorRenderingIntent intent,
gboolean bpc)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, num_bytes,
GIMP_TYPE_UINT8_ARRAY, NULL,
GIMP_TYPE_COLOR_RENDERING_INTENT, intent,
G_TYPE_BOOLEAN, bpc,
G_TYPE_NONE);
gimp_value_set_uint8_array (gimp_value_array_index (args, 2), color_profile, num_bytes);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-convert-color-profile",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-convert-color-profile",
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_image_convert_color_profile_from_file: * gimp_image_convert_color_profile_from_file:
* @image: The image. * @image: The image.
@ -345,3 +603,55 @@ gimp_image_convert_color_profile_from_file (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_convert_color_profile_from_file: (skip)
* @image_ID: The image.
* @uri: The URI of the file containing the new color profile.
* @intent: Rendering intent.
* @bpc: Black point compensation.
*
* Convert the image's layers to a color profile
*
* This procedure converts from the image's color profile (or the
* default RGB or grayscale profile if none is set) to an ICC profile
* specified by 'uri'. Only RGB and grayscale color profiles are
* accepted, according to the image's type.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
_gimp_image_convert_color_profile_from_file (gint32 image_ID,
const gchar *uri,
GimpColorRenderingIntent intent,
gboolean bpc)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, uri,
GIMP_TYPE_COLOR_RENDERING_INTENT, intent,
G_TYPE_BOOLEAN, bpc,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-convert-color-profile-from-file",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-convert-color-profile-from-file",
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;
}

View File

@ -32,24 +32,48 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
G_GNUC_INTERNAL guint8* _gimp_image_get_color_profile (GimpImage *image, G_GNUC_INTERNAL guint8* _gimp_image_get_color_profile (GimpImage *image,
gint *num_bytes); gint *num_bytes);
G_GNUC_INTERNAL guint8* _gimp_image_get_effective_color_profile (GimpImage *image, GIMP_DEPRECATED_FOR(_gimp_image_get_color_profile)
gint *num_bytes); G_GNUC_INTERNAL guint8* __gimp_image_get_color_profile (gint32 image_ID,
G_GNUC_INTERNAL gboolean _gimp_image_set_color_profile (GimpImage *image, gint *num_bytes);
gint num_bytes, G_GNUC_INTERNAL guint8* _gimp_image_get_effective_color_profile (GimpImage *image,
const guint8 *color_profile); gint *num_bytes);
gboolean gimp_image_set_color_profile_from_file (GimpImage *image, GIMP_DEPRECATED_FOR(_gimp_image_get_effective_color_profile)
const gchar *uri); G_GNUC_INTERNAL guint8* __gimp_image_get_effective_color_profile (gint32 image_ID,
G_GNUC_INTERNAL gboolean _gimp_image_convert_color_profile (GimpImage *image, gint *num_bytes);
gint num_bytes, G_GNUC_INTERNAL gboolean _gimp_image_set_color_profile (GimpImage *image,
const guint8 *color_profile, gint num_bytes,
GimpColorRenderingIntent intent, const guint8 *color_profile);
gboolean bpc); GIMP_DEPRECATED_FOR(_gimp_image_set_color_profile)
gboolean gimp_image_convert_color_profile_from_file (GimpImage *image, G_GNUC_INTERNAL gboolean __gimp_image_set_color_profile (gint32 image_ID,
const gchar *uri, gint num_bytes,
GimpColorRenderingIntent intent, const guint8 *color_profile);
gboolean bpc); gboolean gimp_image_set_color_profile_from_file (GimpImage *image,
const gchar *uri);
GIMP_DEPRECATED_FOR(gimp_image_set_color_profile_from_file)
G_GNUC_INTERNAL gboolean _gimp_image_set_color_profile_from_file (gint32 image_ID,
const gchar *uri);
G_GNUC_INTERNAL gboolean _gimp_image_convert_color_profile (GimpImage *image,
gint num_bytes,
const guint8 *color_profile,
GimpColorRenderingIntent intent,
gboolean bpc);
GIMP_DEPRECATED_FOR(_gimp_image_convert_color_profile)
G_GNUC_INTERNAL gboolean __gimp_image_convert_color_profile (gint32 image_ID,
gint num_bytes,
const guint8 *color_profile,
GimpColorRenderingIntent intent,
gboolean bpc);
gboolean gimp_image_convert_color_profile_from_file (GimpImage *image,
const gchar *uri,
GimpColorRenderingIntent intent,
gboolean bpc);
GIMP_DEPRECATED_FOR(gimp_image_convert_color_profile_from_file)
G_GNUC_INTERNAL gboolean _gimp_image_convert_color_profile_from_file (gint32 image_ID,
const gchar *uri,
GimpColorRenderingIntent intent,
gboolean bpc);
G_END_DECLS G_END_DECLS

View File

@ -75,6 +75,47 @@ gimp_image_convert_rgb (GimpImage *image)
return success; return success;
} }
/**
* _gimp_image_convert_rgb: (skip)
* @image_ID: The image.
*
* Convert specified image to RGB color
*
* This procedure converts the specified image to RGB color. This
* process requires an image in Grayscale or Indexed color mode. No
* image content is lost in this process aside from the colormap for an
* indexed image.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_convert_rgb (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-convert-rgb",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-convert-rgb",
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_image_convert_grayscale: * gimp_image_convert_grayscale:
* @image: The image. * @image: The image.
@ -114,6 +155,45 @@ gimp_image_convert_grayscale (GimpImage *image)
return success; return success;
} }
/**
* _gimp_image_convert_grayscale: (skip)
* @image_ID: The image.
*
* Convert specified image to grayscale
*
* This procedure converts the specified image to grayscale. This
* process requires an image in RGB or Indexed color mode.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_convert_grayscale (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-convert-grayscale",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-convert-grayscale",
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_image_convert_indexed: * gimp_image_convert_indexed:
* @image: The image. * @image: The image.
@ -182,6 +262,74 @@ gimp_image_convert_indexed (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_convert_indexed: (skip)
* @image_ID: The image.
* @dither_type: The dither type to use.
* @palette_type: The type of palette to use.
* @num_cols: The number of colors to quantize to, ignored unless (palette_type == GIMP_CONVERT_PALETTE_GENERATE).
* @alpha_dither: Dither transparency to fake partial opacity.
* @remove_unused: Remove unused or duplicate color entries from final palette, ignored if (palette_type == GIMP_CONVERT_PALETTE_GENERATE).
* @palette: The name of the custom palette to use, ignored unless (palette_type == GIMP_CONVERT_PALETTE_CUSTOM).
*
* Convert specified image to and Indexed image
*
* This procedure converts the specified image to 'indexed' color. This
* process requires an image in RGB or Grayscale mode. The
* 'palette_type' specifies what kind of palette to use, A type of '0'
* means to use an optimal palette of 'num_cols' generated from the
* colors in the image. A type of '1' means to re-use the previous
* palette (not currently implemented). A type of '2' means to use the
* so-called WWW-optimized palette. Type '3' means to use only black
* and white colors. A type of '4' means to use a palette from the gimp
* palettes directories. The 'dither type' specifies what kind of
* dithering to use. '0' means no dithering, '1' means standard
* Floyd-Steinberg error diffusion, '2' means Floyd-Steinberg error
* diffusion with reduced bleeding, '3' means dithering based on pixel
* location ('Fixed' dithering).
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_convert_indexed (gint32 image_ID,
GimpConvertDitherType dither_type,
GimpConvertPaletteType palette_type,
gint num_cols,
gboolean alpha_dither,
gboolean remove_unused,
const gchar *palette)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_CONVERT_DITHER_TYPE, dither_type,
GIMP_TYPE_CONVERT_PALETTE_TYPE, palette_type,
G_TYPE_INT, num_cols,
G_TYPE_BOOLEAN, alpha_dither,
G_TYPE_BOOLEAN, remove_unused,
G_TYPE_STRING, palette,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-convert-indexed",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-convert-indexed",
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_image_convert_set_dither_matrix: * gimp_image_convert_set_dither_matrix:
* @width: Width of the matrix (0 to reset to default matrix). * @width: Width of the matrix (0 to reset to default matrix).
@ -277,3 +425,48 @@ gimp_image_convert_precision (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_convert_precision: (skip)
* @image_ID: The image.
* @precision: The new precision.
*
* Convert the image to the specified precision
*
* This procedure converts the image to the specified precision. Note
* that indexed images cannot be converted and are always in
* GIMP_PRECISION_U8.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
_gimp_image_convert_precision (gint32 image_ID,
GimpPrecision precision)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_PRECISION, precision,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-convert-precision",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-convert-precision",
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;
}

View File

@ -32,21 +32,36 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gboolean gimp_image_convert_rgb (GimpImage *image); gboolean gimp_image_convert_rgb (GimpImage *image);
gboolean gimp_image_convert_grayscale (GimpImage *image); GIMP_DEPRECATED_FOR(gimp_image_convert_rgb)
gboolean gimp_image_convert_indexed (GimpImage *image, G_GNUC_INTERNAL gboolean _gimp_image_convert_rgb (gint32 image_ID);
GimpConvertDitherType dither_type, gboolean gimp_image_convert_grayscale (GimpImage *image);
GimpConvertPaletteType palette_type, GIMP_DEPRECATED_FOR(gimp_image_convert_grayscale)
gint num_cols, G_GNUC_INTERNAL gboolean _gimp_image_convert_grayscale (gint32 image_ID);
gboolean alpha_dither, gboolean gimp_image_convert_indexed (GimpImage *image,
gboolean remove_unused, GimpConvertDitherType dither_type,
const gchar *palette); GimpConvertPaletteType palette_type,
gboolean gimp_image_convert_set_dither_matrix (gint width, gint num_cols,
gint height, gboolean alpha_dither,
gint matrix_length, gboolean remove_unused,
const guint8 *matrix); const gchar *palette);
gboolean gimp_image_convert_precision (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_convert_indexed)
GimpPrecision precision); G_GNUC_INTERNAL gboolean _gimp_image_convert_indexed (gint32 image_ID,
GimpConvertDitherType dither_type,
GimpConvertPaletteType palette_type,
gint num_cols,
gboolean alpha_dither,
gboolean remove_unused,
const gchar *palette);
gboolean gimp_image_convert_set_dither_matrix (gint width,
gint height,
gint matrix_length,
const guint8 *matrix);
gboolean gimp_image_convert_precision (GimpImage *image,
GimpPrecision precision);
GIMP_DEPRECATED_FOR(gimp_image_convert_precision)
G_GNUC_INTERNAL gboolean _gimp_image_convert_precision (gint32 image_ID,
GimpPrecision precision);
G_END_DECLS G_END_DECLS

View File

@ -88,6 +88,60 @@ gimp_image_grid_get_spacing (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_grid_get_spacing: (skip)
* @image_ID: The image.
* @xspacing: (out): The image's grid horizontal spacing.
* @yspacing: (out): The image's grid vertical spacing.
*
* Gets the spacing of an image's grid.
*
* This procedure retrieves the horizontal and vertical spacing of an
* image's grid. It takes the image as parameter.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
_gimp_image_grid_get_spacing (gint32 image_ID,
gdouble *xspacing,
gdouble *yspacing)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-grid-get-spacing",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-grid-get-spacing",
args);
gimp_value_array_unref (args);
*xspacing = 0.0;
*yspacing = 0.0;
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
if (success)
{
*xspacing = g_value_get_double (gimp_value_array_index (return_vals, 1));
*yspacing = g_value_get_double (gimp_value_array_index (return_vals, 2));
}
gimp_value_array_unref (return_vals);
return success;
}
/** /**
* gimp_image_grid_set_spacing: * gimp_image_grid_set_spacing:
* @image: The image. * @image: The image.
@ -135,6 +189,53 @@ gimp_image_grid_set_spacing (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_grid_set_spacing: (skip)
* @image_ID: The image.
* @xspacing: The image's grid horizontal spacing.
* @yspacing: The image's grid vertical spacing.
*
* Sets the spacing of an image's grid.
*
* This procedure sets the horizontal and vertical spacing of an
* image's grid.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
_gimp_image_grid_set_spacing (gint32 image_ID,
gdouble xspacing,
gdouble yspacing)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_DOUBLE, xspacing,
G_TYPE_DOUBLE, yspacing,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-grid-set-spacing",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-grid-set-spacing",
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_image_grid_get_offset: * gimp_image_grid_get_offset:
* @image: The image. * @image: The image.
@ -189,6 +290,60 @@ gimp_image_grid_get_offset (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_grid_get_offset: (skip)
* @image_ID: The image.
* @xoffset: (out): The image's grid horizontal offset.
* @yoffset: (out): The image's grid vertical offset.
*
* Gets the offset of an image's grid.
*
* This procedure retrieves the horizontal and vertical offset of an
* image's grid. It takes the image as parameter.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
_gimp_image_grid_get_offset (gint32 image_ID,
gdouble *xoffset,
gdouble *yoffset)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-grid-get-offset",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-grid-get-offset",
args);
gimp_value_array_unref (args);
*xoffset = 0.0;
*yoffset = 0.0;
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
if (success)
{
*xoffset = g_value_get_double (gimp_value_array_index (return_vals, 1));
*yoffset = g_value_get_double (gimp_value_array_index (return_vals, 2));
}
gimp_value_array_unref (return_vals);
return success;
}
/** /**
* gimp_image_grid_set_offset: * gimp_image_grid_set_offset:
* @image: The image. * @image: The image.
@ -236,6 +391,53 @@ gimp_image_grid_set_offset (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_grid_set_offset: (skip)
* @image_ID: The image.
* @xoffset: The image's grid horizontal offset.
* @yoffset: The image's grid vertical offset.
*
* Sets the offset of an image's grid.
*
* This procedure sets the horizontal and vertical offset of an image's
* grid.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
_gimp_image_grid_set_offset (gint32 image_ID,
gdouble xoffset,
gdouble yoffset)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_DOUBLE, xoffset,
G_TYPE_DOUBLE, yoffset,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-grid-set-offset",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-grid-set-offset",
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_image_grid_get_foreground_color: * gimp_image_grid_get_foreground_color:
* @image: The image. * @image: The image.
@ -281,6 +483,51 @@ gimp_image_grid_get_foreground_color (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_grid_get_foreground_color: (skip)
* @image_ID: The image.
* @fgcolor: (out caller-allocates): The image's grid foreground color.
*
* Sets the foreground color of an image's grid.
*
* This procedure gets the foreground color of an image's grid.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
_gimp_image_grid_get_foreground_color (gint32 image_ID,
GimpRGB *fgcolor)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-grid-get-foreground-color",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-grid-get-foreground-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), &*fgcolor);
gimp_value_array_unref (return_vals);
return success;
}
/** /**
* gimp_image_grid_set_foreground_color: * gimp_image_grid_set_foreground_color:
* @image: The image. * @image: The image.
@ -324,6 +571,49 @@ gimp_image_grid_set_foreground_color (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_grid_set_foreground_color: (skip)
* @image_ID: The image.
* @fgcolor: The new foreground color.
*
* Gets the foreground color of an image's grid.
*
* This procedure sets the foreground color of an image's grid.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
_gimp_image_grid_set_foreground_color (gint32 image_ID,
const GimpRGB *fgcolor)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_RGB, fgcolor,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-grid-set-foreground-color",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-grid-set-foreground-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_image_grid_get_background_color: * gimp_image_grid_get_background_color:
* @image: The image. * @image: The image.
@ -369,6 +659,51 @@ gimp_image_grid_get_background_color (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_grid_get_background_color: (skip)
* @image_ID: The image.
* @bgcolor: (out caller-allocates): The image's grid background color.
*
* Sets the background color of an image's grid.
*
* This procedure gets the background color of an image's grid.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
_gimp_image_grid_get_background_color (gint32 image_ID,
GimpRGB *bgcolor)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-grid-get-background-color",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-grid-get-background-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), &*bgcolor);
gimp_value_array_unref (return_vals);
return success;
}
/** /**
* gimp_image_grid_set_background_color: * gimp_image_grid_set_background_color:
* @image: The image. * @image: The image.
@ -412,6 +747,49 @@ gimp_image_grid_set_background_color (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_grid_set_background_color: (skip)
* @image_ID: The image.
* @bgcolor: The new background color.
*
* Gets the background color of an image's grid.
*
* This procedure sets the background color of an image's grid.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
_gimp_image_grid_set_background_color (gint32 image_ID,
const GimpRGB *bgcolor)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_RGB, bgcolor,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-grid-set-background-color",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-grid-set-background-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_image_grid_get_style: * gimp_image_grid_get_style:
* @image: The image. * @image: The image.
@ -453,6 +831,47 @@ gimp_image_grid_get_style (GimpImage *image)
return style; return style;
} }
/**
* _gimp_image_grid_get_style: (skip)
* @image_ID: The image.
*
* Gets the style of an image's grid.
*
* This procedure retrieves the style of an image's grid.
*
* Returns: The image's grid style.
*
* Since: 2.4
**/
GimpGridStyle
_gimp_image_grid_get_style (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpGridStyle style = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-grid-get-style",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-grid-get-style",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
style = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return style;
}
/** /**
* gimp_image_grid_set_style: * gimp_image_grid_set_style:
* @image: The image. * @image: The image.
@ -496,3 +915,47 @@ gimp_image_grid_set_style (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_grid_set_style: (skip)
* @image_ID: The image.
* @style: The image's grid style.
*
* Sets the style unit of an image's grid.
*
* This procedure sets the style of an image's grid. It takes the image
* and the new style as parameters.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
_gimp_image_grid_set_style (gint32 image_ID,
GimpGridStyle style)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_GRID_STYLE, style,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-grid-set-style",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-grid-set-style",
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;
}

View File

@ -32,29 +32,62 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gboolean gimp_image_grid_get_spacing (GimpImage *image, gboolean gimp_image_grid_get_spacing (GimpImage *image,
gdouble *xspacing, gdouble *xspacing,
gdouble *yspacing); gdouble *yspacing);
gboolean gimp_image_grid_set_spacing (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_grid_get_spacing)
gdouble xspacing, G_GNUC_INTERNAL gboolean _gimp_image_grid_get_spacing (gint32 image_ID,
gdouble yspacing); gdouble *xspacing,
gboolean gimp_image_grid_get_offset (GimpImage *image, gdouble *yspacing);
gdouble *xoffset, gboolean gimp_image_grid_set_spacing (GimpImage *image,
gdouble *yoffset); gdouble xspacing,
gboolean gimp_image_grid_set_offset (GimpImage *image, gdouble yspacing);
gdouble xoffset, GIMP_DEPRECATED_FOR(gimp_image_grid_set_spacing)
gdouble yoffset); G_GNUC_INTERNAL gboolean _gimp_image_grid_set_spacing (gint32 image_ID,
gboolean gimp_image_grid_get_foreground_color (GimpImage *image, gdouble xspacing,
GimpRGB *fgcolor); gdouble yspacing);
gboolean gimp_image_grid_set_foreground_color (GimpImage *image, gboolean gimp_image_grid_get_offset (GimpImage *image,
const GimpRGB *fgcolor); gdouble *xoffset,
gboolean gimp_image_grid_get_background_color (GimpImage *image, gdouble *yoffset);
GimpRGB *bgcolor); GIMP_DEPRECATED_FOR(gimp_image_grid_get_offset)
gboolean gimp_image_grid_set_background_color (GimpImage *image, G_GNUC_INTERNAL gboolean _gimp_image_grid_get_offset (gint32 image_ID,
const GimpRGB *bgcolor); gdouble *xoffset,
GimpGridStyle gimp_image_grid_get_style (GimpImage *image); gdouble *yoffset);
gboolean gimp_image_grid_set_style (GimpImage *image, gboolean gimp_image_grid_set_offset (GimpImage *image,
GimpGridStyle style); gdouble xoffset,
gdouble yoffset);
GIMP_DEPRECATED_FOR(gimp_image_grid_set_offset)
G_GNUC_INTERNAL gboolean _gimp_image_grid_set_offset (gint32 image_ID,
gdouble xoffset,
gdouble yoffset);
gboolean gimp_image_grid_get_foreground_color (GimpImage *image,
GimpRGB *fgcolor);
GIMP_DEPRECATED_FOR(gimp_image_grid_get_foreground_color)
G_GNUC_INTERNAL gboolean _gimp_image_grid_get_foreground_color (gint32 image_ID,
GimpRGB *fgcolor);
gboolean gimp_image_grid_set_foreground_color (GimpImage *image,
const GimpRGB *fgcolor);
GIMP_DEPRECATED_FOR(gimp_image_grid_set_foreground_color)
G_GNUC_INTERNAL gboolean _gimp_image_grid_set_foreground_color (gint32 image_ID,
const GimpRGB *fgcolor);
gboolean gimp_image_grid_get_background_color (GimpImage *image,
GimpRGB *bgcolor);
GIMP_DEPRECATED_FOR(gimp_image_grid_get_background_color)
G_GNUC_INTERNAL gboolean _gimp_image_grid_get_background_color (gint32 image_ID,
GimpRGB *bgcolor);
gboolean gimp_image_grid_set_background_color (GimpImage *image,
const GimpRGB *bgcolor);
GIMP_DEPRECATED_FOR(gimp_image_grid_set_background_color)
G_GNUC_INTERNAL gboolean _gimp_image_grid_set_background_color (gint32 image_ID,
const GimpRGB *bgcolor);
GimpGridStyle gimp_image_grid_get_style (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_grid_get_style)
G_GNUC_INTERNAL GimpGridStyle _gimp_image_grid_get_style (gint32 image_ID);
gboolean gimp_image_grid_set_style (GimpImage *image,
GimpGridStyle style);
GIMP_DEPRECATED_FOR(gimp_image_grid_set_style)
G_GNUC_INTERNAL gboolean _gimp_image_grid_set_style (gint32 image_ID,
GimpGridStyle style);
G_END_DECLS G_END_DECLS

View File

@ -78,6 +78,50 @@ gimp_image_add_hguide (GimpImage *image,
return guide_ID; return guide_ID;
} }
/**
* _gimp_image_add_hguide: (skip)
* @image_ID: The image.
* @yposition: The guide's y-offset from top of image.
*
* Add a horizontal guide to an image.
*
* This procedure adds a horizontal guide to an image. It takes the
* input image and the y-position of the new guide as parameters. It
* returns the guide ID of the new guide.
*
* Returns: The new guide.
**/
gint32
_gimp_image_add_hguide (gint32 image_ID,
gint yposition)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 guide_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, yposition,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-add-hguide",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-add-hguide",
args);
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));
gimp_value_array_unref (return_vals);
return guide_ID;
}
/** /**
* gimp_image_add_vguide: * gimp_image_add_vguide:
* @image: The image. * @image: The image.
@ -122,6 +166,50 @@ gimp_image_add_vguide (GimpImage *image,
return guide_ID; return guide_ID;
} }
/**
* _gimp_image_add_vguide: (skip)
* @image_ID: The image.
* @xposition: The guide's x-offset from left of image.
*
* Add a vertical guide to an image.
*
* This procedure adds a vertical guide to an image. It takes the input
* image and the x-position of the new guide as parameters. It returns
* the guide ID of the new guide.
*
* Returns: The new guide.
**/
gint32
_gimp_image_add_vguide (gint32 image_ID,
gint xposition)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 guide_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, xposition,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-add-vguide",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-add-vguide",
args);
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));
gimp_value_array_unref (return_vals);
return guide_ID;
}
/** /**
* gimp_image_delete_guide: * gimp_image_delete_guide:
* @image: The image. * @image: The image.
@ -164,6 +252,48 @@ gimp_image_delete_guide (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_delete_guide: (skip)
* @image_ID: The image.
* @guide_ID: The ID of the guide to be removed.
*
* Deletes a guide from an image.
*
* This procedure takes an image and a guide ID as input and removes
* the specified guide from the specified image.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_delete_guide (gint32 image_ID,
gint32 guide_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_UINT, guide_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-delete-guide",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-delete-guide",
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_image_find_next_guide: * gimp_image_find_next_guide:
* @image: The image. * @image: The image.
@ -210,6 +340,52 @@ gimp_image_find_next_guide (GimpImage *image,
return next_guide_ID; return next_guide_ID;
} }
/**
* _gimp_image_find_next_guide: (skip)
* @image_ID: The image.
* @guide_ID: The ID of the current guide (0 if first invocation).
*
* Find next guide on an image.
*
* This procedure takes an image and a guide ID as input and finds the
* guide ID of the successor of the given guide ID in the image's guide
* list. If the supplied guide ID is 0, the procedure will return the
* first Guide. The procedure will return 0 if given the final guide ID
* as an argument or the image has no guides.
*
* Returns: The next guide's ID.
**/
gint32
_gimp_image_find_next_guide (gint32 image_ID,
gint32 guide_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 next_guide_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_UINT, guide_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-find-next-guide",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-find-next-guide",
args);
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));
gimp_value_array_unref (return_vals);
return next_guide_ID;
}
/** /**
* gimp_image_get_guide_orientation: * gimp_image_get_guide_orientation:
* @image: The image. * @image: The image.
@ -253,6 +429,49 @@ gimp_image_get_guide_orientation (GimpImage *image,
return orientation; return orientation;
} }
/**
* _gimp_image_get_guide_orientation: (skip)
* @image_ID: The image.
* @guide_ID: The guide.
*
* Get orientation of a guide on an image.
*
* This procedure takes an image and a guide ID as input and returns
* the orientations of the guide.
*
* Returns: The guide's orientation.
**/
GimpOrientationType
_gimp_image_get_guide_orientation (gint32 image_ID,
gint32 guide_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
GimpOrientationType orientation = GIMP_ORIENTATION_UNKNOWN;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_UINT, guide_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-get-guide-orientation",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-get-guide-orientation",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
orientation = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return orientation;
}
/** /**
* gimp_image_get_guide_position: * gimp_image_get_guide_position:
* @image: The image. * @image: The image.
@ -295,3 +514,46 @@ gimp_image_get_guide_position (GimpImage *image,
return position; return position;
} }
/**
* _gimp_image_get_guide_position: (skip)
* @image_ID: The image.
* @guide_ID: The guide.
*
* Get position of a guide on an image.
*
* This procedure takes an image and a guide ID as input and returns
* the position of the guide relative to the top or left of the image.
*
* Returns: The guide's position relative to top or left of image.
**/
gint
_gimp_image_get_guide_position (gint32 image_ID,
gint32 guide_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint position = G_MININT /* GIMP_GUIDE_POSITION_UNDEFINED */;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_UINT, guide_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-get-guide-position",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-get-guide-position",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
position = g_value_get_int (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return position;
}

View File

@ -32,18 +32,36 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gint32 gimp_image_add_hguide (GimpImage *image, gint32 gimp_image_add_hguide (GimpImage *image,
gint yposition); gint yposition);
gint32 gimp_image_add_vguide (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_add_hguide)
gint xposition); G_GNUC_INTERNAL gint32 _gimp_image_add_hguide (gint32 image_ID,
gboolean gimp_image_delete_guide (GimpImage *image, gint yposition);
gint32 guide_ID); gint32 gimp_image_add_vguide (GimpImage *image,
gint32 gimp_image_find_next_guide (GimpImage *image, gint xposition);
gint32 guide_ID); GIMP_DEPRECATED_FOR(gimp_image_add_vguide)
GimpOrientationType gimp_image_get_guide_orientation (GimpImage *image, G_GNUC_INTERNAL gint32 _gimp_image_add_vguide (gint32 image_ID,
gint32 guide_ID); gint xposition);
gint gimp_image_get_guide_position (GimpImage *image, gboolean gimp_image_delete_guide (GimpImage *image,
gint32 guide_ID); gint32 guide_ID);
GIMP_DEPRECATED_FOR(gimp_image_delete_guide)
G_GNUC_INTERNAL gboolean _gimp_image_delete_guide (gint32 image_ID,
gint32 guide_ID);
gint32 gimp_image_find_next_guide (GimpImage *image,
gint32 guide_ID);
GIMP_DEPRECATED_FOR(gimp_image_find_next_guide)
G_GNUC_INTERNAL gint32 _gimp_image_find_next_guide (gint32 image_ID,
gint32 guide_ID);
GimpOrientationType gimp_image_get_guide_orientation (GimpImage *image,
gint32 guide_ID);
GIMP_DEPRECATED_FOR(gimp_image_get_guide_orientation)
G_GNUC_INTERNAL GimpOrientationType _gimp_image_get_guide_orientation (gint32 image_ID,
gint32 guide_ID);
gint gimp_image_get_guide_position (GimpImage *image,
gint32 guide_ID);
GIMP_DEPRECATED_FOR(gimp_image_get_guide_position)
G_GNUC_INTERNAL gint _gimp_image_get_guide_position (gint32 image_ID,
gint32 guide_ID);
G_END_DECLS G_END_DECLS

View File

@ -83,6 +83,55 @@ gimp_image_add_sample_point (GimpImage *image,
return sample_point_ID; return sample_point_ID;
} }
/**
* _gimp_image_add_sample_point: (skip)
* @image_ID: The image.
* @position_x: The guide'sample points x-offset from left of image.
* @position_y: The guide'sample points y-offset from top of image.
*
* Add a sample point to an image.
*
* This procedure adds a sample point to an image. It takes the input
* image and the position of the new sample points as parameters. It
* returns the sample point ID of the new sample point.
*
* Returns: The new sample point.
*
* Since: 2.10
**/
gint32
_gimp_image_add_sample_point (gint32 image_ID,
gint position_x,
gint position_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 sample_point_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, position_x,
G_TYPE_INT, position_y,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-add-sample-point",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-add-sample-point",
args);
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));
gimp_value_array_unref (return_vals);
return sample_point_ID;
}
/** /**
* gimp_image_delete_sample_point: * gimp_image_delete_sample_point:
* @image: The image. * @image: The image.
@ -127,6 +176,50 @@ gimp_image_delete_sample_point (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_delete_sample_point: (skip)
* @image_ID: The image.
* @sample_point_ID: The ID of the sample point to be removed.
*
* Deletes a sample point from an image.
*
* This procedure takes an image and a sample point ID as input and
* removes the specified sample point from the specified image.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
_gimp_image_delete_sample_point (gint32 image_ID,
gint32 sample_point_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_UINT, sample_point_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-delete-sample-point",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-delete-sample-point",
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_image_find_next_sample_point: * gimp_image_find_next_sample_point:
* @image: The image. * @image: The image.
@ -176,6 +269,55 @@ gimp_image_find_next_sample_point (GimpImage *image,
return next_sample_point_ID; return next_sample_point_ID;
} }
/**
* _gimp_image_find_next_sample_point: (skip)
* @image_ID: The image.
* @sample_point_ID: The ID of the current sample point (0 if first invocation).
*
* Find next sample point on an image.
*
* This procedure takes an image and a sample point ID as input and
* finds the sample point ID of the successor of the given sample point
* ID in the image's sample point list. If the supplied sample point ID
* is 0, the procedure will return the first sample point. The
* procedure will return 0 if given the final sample point ID as an
* argument or the image has no sample points.
*
* Returns: The next sample point's ID.
*
* Since: 2.10
**/
gint32
_gimp_image_find_next_sample_point (gint32 image_ID,
gint32 sample_point_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 next_sample_point_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_UINT, sample_point_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-find-next-sample-point",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-find-next-sample-point",
args);
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));
gimp_value_array_unref (return_vals);
return next_sample_point_ID;
}
/** /**
* gimp_image_get_sample_point_position: * gimp_image_get_sample_point_position:
* @image: The image. * @image: The image.
@ -226,3 +368,54 @@ gimp_image_get_sample_point_position (GimpImage *image,
return position_x; return position_x;
} }
/**
* _gimp_image_get_sample_point_position: (skip)
* @image_ID: The image.
* @sample_point_ID: The guide.
* @position_y: (out): The sample points's position relative to top of image.
*
* Get position of a sample point on an image.
*
* This procedure takes an image and a sample point ID as input and
* returns the position of the sample point relative to the top and
* left of the image.
*
* Returns: The sample points's position relative to top of image.
*
* Since: 2.10
**/
gint
_gimp_image_get_sample_point_position (gint32 image_ID,
gint32 sample_point_ID,
gint *position_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint position_x = G_MININT;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_UINT, sample_point_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-get-sample-point-position",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-get-sample-point-position",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
{
position_x = g_value_get_int (gimp_value_array_index (return_vals, 1));
*position_y = g_value_get_int (gimp_value_array_index (return_vals, 2));
}
gimp_value_array_unref (return_vals);
return position_x;
}

View File

@ -32,16 +32,30 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gint32 gimp_image_add_sample_point (GimpImage *image, gint32 gimp_image_add_sample_point (GimpImage *image,
gint position_x, gint position_x,
gint position_y); gint position_y);
gboolean gimp_image_delete_sample_point (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_add_sample_point)
gint32 sample_point_ID); G_GNUC_INTERNAL gint32 _gimp_image_add_sample_point (gint32 image_ID,
gint32 gimp_image_find_next_sample_point (GimpImage *image, gint position_x,
gint32 sample_point_ID); gint position_y);
gint gimp_image_get_sample_point_position (GimpImage *image, gboolean gimp_image_delete_sample_point (GimpImage *image,
gint32 sample_point_ID, gint32 sample_point_ID);
gint *position_y); GIMP_DEPRECATED_FOR(gimp_image_delete_sample_point)
G_GNUC_INTERNAL gboolean _gimp_image_delete_sample_point (gint32 image_ID,
gint32 sample_point_ID);
gint32 gimp_image_find_next_sample_point (GimpImage *image,
gint32 sample_point_ID);
GIMP_DEPRECATED_FOR(gimp_image_find_next_sample_point)
G_GNUC_INTERNAL gint32 _gimp_image_find_next_sample_point (gint32 image_ID,
gint32 sample_point_ID);
gint gimp_image_get_sample_point_position (GimpImage *image,
gint32 sample_point_ID,
gint *position_y);
GIMP_DEPRECATED_FOR(gimp_image_get_sample_point_position)
G_GNUC_INTERNAL gint _gimp_image_get_sample_point_position (gint32 image_ID,
gint32 sample_point_ID,
gint *position_y);
G_END_DECLS G_END_DECLS

View File

@ -99,6 +99,71 @@ gimp_image_select_color (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_select_color: (skip)
* @image_ID: The affected image.
* @operation: The selection operation.
* @drawable_ID: The affected drawable.
* @color: The color to select.
*
* Create a selection by selecting all pixels (in the specified
* drawable) with the same (or similar) color to that specified.
*
* This tool creates a selection over the specified image. A by-color
* selection is determined by the supplied color under the constraints
* of the current context settings. Essentially, all pixels (in the
* drawable) that have color sufficiently close to the specified color
* (as determined by the threshold and criterion context values) are
* included in the selection. To select transparent regions, the color
* specified must also have minimum alpha.
*
* This procedure is affected by the following context setters:
* gimp_context_set_antialias(), gimp_context_set_feather(),
* gimp_context_set_feather_radius(), gimp_context_set_sample_merged(),
* gimp_context_set_sample_criterion(),
* gimp_context_set_sample_threshold(),
* gimp_context_set_sample_transparent().
*
* In the case of a merged sampling, the supplied drawable is ignored.
*
* Returns: TRUE on success.
*
* Since: 2.8
**/
gboolean
_gimp_image_select_color (gint32 image_ID,
GimpChannelOps operation,
gint32 drawable_ID,
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_IMAGE_ID, image_ID,
GIMP_TYPE_CHANNEL_OPS, operation,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
GIMP_TYPE_RGB, color,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-select-color",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-select-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_image_select_contiguous_color: * gimp_image_select_contiguous_color:
* @image: The affected image. * @image: The affected image.
@ -176,6 +241,83 @@ gimp_image_select_contiguous_color (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_select_contiguous_color: (skip)
* @image_ID: The affected image.
* @operation: The selection operation.
* @drawable_ID: The affected drawable.
* @x: x coordinate of initial seed fill point: (image coordinates).
* @y: y coordinate of initial seed fill point: (image coordinates).
*
* Create a selection by selecting all pixels around specified
* coordinates with the same (or similar) color to that at the
* coordinates.
*
* This tool creates a contiguous selection over the specified image. A
* contiguous color selection is determined by a seed fill under the
* constraints of the current context settings. Essentially, the color
* at the specified coordinates (in the drawable) is measured and the
* selection expands outwards from that point to any adjacent pixels
* which are not significantly different (as determined by the
* threshold and criterion context settings). This process continues
* until no more expansion is possible. If antialiasing is turned on,
* the final selection mask will contain intermediate values based on
* close misses to the threshold bar at pixels along the seed fill
* boundary.
*
* This procedure is affected by the following context setters:
* gimp_context_set_antialias(), gimp_context_set_feather(),
* gimp_context_set_feather_radius(), gimp_context_set_sample_merged(),
* gimp_context_set_sample_criterion(),
* gimp_context_set_sample_threshold(),
* gimp_context_set_sample_transparent(),
* gimp_context_set_diagonal_neighbors().
*
* In the case of a merged sampling, the supplied drawable is ignored.
* If the sample is merged, the specified coordinates are relative to
* the image origin; otherwise, they are relative to the drawable's
* origin.
*
* Returns: TRUE on success.
*
* Since: 2.8
**/
gboolean
_gimp_image_select_contiguous_color (gint32 image_ID,
GimpChannelOps operation,
gint32 drawable_ID,
gdouble x,
gdouble y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_CHANNEL_OPS, operation,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
G_TYPE_DOUBLE, x,
G_TYPE_DOUBLE, y,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-select-contiguous-color",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-select-contiguous-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_image_select_rectangle: * gimp_image_select_rectangle:
* @image: The image. * @image: The image.
@ -236,6 +378,66 @@ gimp_image_select_rectangle (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_select_rectangle: (skip)
* @image_ID: The image.
* @operation: The selection operation.
* @x: x coordinate of upper-left corner of rectangle.
* @y: y coordinate of upper-left corner of rectangle.
* @width: The width of the rectangle.
* @height: The height of the rectangle.
*
* Create a rectangular selection over the specified image;
*
* This tool creates a rectangular selection over the specified image.
* The rectangular region can be either added to, subtracted from, or
* replace the contents of the previous selection mask.
*
* This procedure is affected by the following context setters:
* gimp_context_set_feather(), gimp_context_set_feather_radius().
*
* Returns: TRUE on success.
*
* Since: 2.8
**/
gboolean
_gimp_image_select_rectangle (gint32 image_ID,
GimpChannelOps operation,
gdouble x,
gdouble y,
gdouble width,
gdouble height)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_CHANNEL_OPS, operation,
G_TYPE_DOUBLE, x,
G_TYPE_DOUBLE, y,
G_TYPE_DOUBLE, width,
G_TYPE_DOUBLE, height,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-select-rectangle",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-select-rectangle",
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_image_select_round_rectangle: * gimp_image_select_round_rectangle:
* @image: The image. * @image: The image.
@ -305,6 +507,75 @@ gimp_image_select_round_rectangle (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_select_round_rectangle: (skip)
* @image_ID: The image.
* @operation: The selection operation.
* @x: x coordinate of upper-left corner of rectangle.
* @y: y coordinate of upper-left corner of rectangle.
* @width: The width of the rectangle.
* @height: The height of the rectangle.
* @corner_radius_x: The corner radius in X direction.
* @corner_radius_y: The corner radius in Y direction.
*
* Create a rectangular selection with round corners over the specified
* image;
*
* This tool creates a rectangular selection with round corners over
* the specified image. The rectangular region can be either added to,
* subtracted from, or replace the contents of the previous selection
* mask.
*
* This procedure is affected by the following context setters:
* gimp_context_set_antialias(), gimp_context_set_feather(),
* gimp_context_set_feather_radius().
*
* Returns: TRUE on success.
*
* Since: 2.8
**/
gboolean
_gimp_image_select_round_rectangle (gint32 image_ID,
GimpChannelOps operation,
gdouble x,
gdouble y,
gdouble width,
gdouble height,
gdouble corner_radius_x,
gdouble corner_radius_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_CHANNEL_OPS, operation,
G_TYPE_DOUBLE, x,
G_TYPE_DOUBLE, y,
G_TYPE_DOUBLE, width,
G_TYPE_DOUBLE, height,
G_TYPE_DOUBLE, corner_radius_x,
G_TYPE_DOUBLE, corner_radius_y,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-select-round-rectangle",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-select-round-rectangle",
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_image_select_ellipse: * gimp_image_select_ellipse:
* @image: The image. * @image: The image.
@ -366,6 +637,67 @@ gimp_image_select_ellipse (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_select_ellipse: (skip)
* @image_ID: The image.
* @operation: The selection operation.
* @x: x coordinate of upper-left corner of ellipse bounding box.
* @y: y coordinate of upper-left corner of ellipse bounding box.
* @width: The width of the ellipse.
* @height: The height of the ellipse.
*
* Create an elliptical selection over the specified image.
*
* This tool creates an elliptical selection over the specified image.
* The elliptical region can be either added to, subtracted from, or
* replace the contents of the previous selection mask.
*
* This procedure is affected by the following context setters:
* gimp_context_set_antialias(), gimp_context_set_feather(),
* gimp_context_set_feather_radius().
*
* Returns: TRUE on success.
*
* Since: 2.8
**/
gboolean
_gimp_image_select_ellipse (gint32 image_ID,
GimpChannelOps operation,
gdouble x,
gdouble y,
gdouble width,
gdouble height)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_CHANNEL_OPS, operation,
G_TYPE_DOUBLE, x,
G_TYPE_DOUBLE, y,
G_TYPE_DOUBLE, width,
G_TYPE_DOUBLE, height,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-select-ellipse",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-select-ellipse",
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_image_select_polygon: * gimp_image_select_polygon:
* @image: The image. * @image: The image.
@ -427,6 +759,67 @@ gimp_image_select_polygon (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_select_polygon: (skip)
* @image_ID: The image.
* @operation: The selection operation.
* @num_segs: Number of points (count 1 coordinate as two points).
* @segs: (array length=num_segs) (element-type gdouble): Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}.
*
* Create a polygonal selection over the specified image.
*
* This tool creates a polygonal selection over the specified image.
* The polygonal region can be either added to, subtracted from, or
* replace the contents of the previous selection mask. The polygon is
* specified through an array of floating point numbers and its length.
* The length of array must be 2n, where n is the number of points.
* Each point is defined by 2 floating point values which correspond to
* the x and y coordinates. If the final point does not connect to the
* starting point, a connecting segment is automatically added.
*
* This procedure is affected by the following context setters:
* gimp_context_set_antialias(), gimp_context_set_feather(),
* gimp_context_set_feather_radius().
*
* Returns: TRUE on success.
*
* Since: 2.8
**/
gboolean
_gimp_image_select_polygon (gint32 image_ID,
GimpChannelOps operation,
gint num_segs,
const gdouble *segs)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_CHANNEL_OPS, operation,
G_TYPE_INT, num_segs,
GIMP_TYPE_FLOAT_ARRAY, NULL,
G_TYPE_NONE);
gimp_value_set_float_array (gimp_value_array_index (args, 3), segs, num_segs);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-select-polygon",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-select-polygon",
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_image_select_item: * gimp_image_select_item:
* @image: The image. * @image: The image.
@ -479,3 +872,56 @@ gimp_image_select_item (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_select_item: (skip)
* @image_ID: The image.
* @operation: The desired operation with current selection.
* @item_ID: The item to render to the selection.
*
* Transforms the specified item into a selection
*
* This procedure renders the item's outline into the current selection
* of the image the item belongs to. What exactly the item's outline is
* depends on the item type: for layers, it's the layer's alpha
* channel, for vectors the vector's shape.
*
* This procedure is affected by the following context setters:
* gimp_context_set_antialias(), gimp_context_set_feather(),
* gimp_context_set_feather_radius().
*
* Returns: TRUE on success.
*
* Since: 2.8
**/
gboolean
_gimp_image_select_item (gint32 image_ID,
GimpChannelOps operation,
gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_CHANNEL_OPS, operation,
GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-select-item",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-select-item",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}

View File

@ -32,42 +32,85 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gboolean gimp_image_select_color (GimpImage *image, gboolean gimp_image_select_color (GimpImage *image,
GimpChannelOps operation, GimpChannelOps operation,
gint32 drawable_ID, gint32 drawable_ID,
const GimpRGB *color); const GimpRGB *color);
gboolean gimp_image_select_contiguous_color (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_image_select_color)
GimpChannelOps operation, G_GNUC_INTERNAL gboolean _gimp_image_select_color (gint32 image_ID,
gint32 drawable_ID, GimpChannelOps operation,
gdouble x, gint32 drawable_ID,
gdouble y); const GimpRGB *color);
gboolean gimp_image_select_rectangle (GimpImage *image, gboolean gimp_image_select_contiguous_color (GimpImage *image,
GimpChannelOps operation, GimpChannelOps operation,
gdouble x, gint32 drawable_ID,
gdouble y, gdouble x,
gdouble width, gdouble y);
gdouble height); GIMP_DEPRECATED_FOR(gimp_image_select_contiguous_color)
gboolean gimp_image_select_round_rectangle (GimpImage *image, G_GNUC_INTERNAL gboolean _gimp_image_select_contiguous_color (gint32 image_ID,
GimpChannelOps operation, GimpChannelOps operation,
gdouble x, gint32 drawable_ID,
gdouble y, gdouble x,
gdouble width, gdouble y);
gdouble height, gboolean gimp_image_select_rectangle (GimpImage *image,
gdouble corner_radius_x, GimpChannelOps operation,
gdouble corner_radius_y); gdouble x,
gboolean gimp_image_select_ellipse (GimpImage *image, gdouble y,
GimpChannelOps operation, gdouble width,
gdouble x, gdouble height);
gdouble y, GIMP_DEPRECATED_FOR(gimp_image_select_rectangle)
gdouble width, G_GNUC_INTERNAL gboolean _gimp_image_select_rectangle (gint32 image_ID,
gdouble height); GimpChannelOps operation,
gboolean gimp_image_select_polygon (GimpImage *image, gdouble x,
GimpChannelOps operation, gdouble y,
gint num_segs, gdouble width,
const gdouble *segs); gdouble height);
gboolean gimp_image_select_item (GimpImage *image, gboolean gimp_image_select_round_rectangle (GimpImage *image,
GimpChannelOps operation, GimpChannelOps operation,
gint32 item_ID); gdouble x,
gdouble y,
gdouble width,
gdouble height,
gdouble corner_radius_x,
gdouble corner_radius_y);
GIMP_DEPRECATED_FOR(gimp_image_select_round_rectangle)
G_GNUC_INTERNAL gboolean _gimp_image_select_round_rectangle (gint32 image_ID,
GimpChannelOps operation,
gdouble x,
gdouble y,
gdouble width,
gdouble height,
gdouble corner_radius_x,
gdouble corner_radius_y);
gboolean gimp_image_select_ellipse (GimpImage *image,
GimpChannelOps operation,
gdouble x,
gdouble y,
gdouble width,
gdouble height);
GIMP_DEPRECATED_FOR(gimp_image_select_ellipse)
G_GNUC_INTERNAL gboolean _gimp_image_select_ellipse (gint32 image_ID,
GimpChannelOps operation,
gdouble x,
gdouble y,
gdouble width,
gdouble height);
gboolean gimp_image_select_polygon (GimpImage *image,
GimpChannelOps operation,
gint num_segs,
const gdouble *segs);
GIMP_DEPRECATED_FOR(gimp_image_select_polygon)
G_GNUC_INTERNAL gboolean _gimp_image_select_polygon (gint32 image_ID,
GimpChannelOps operation,
gint num_segs,
const gdouble *segs);
gboolean gimp_image_select_item (GimpImage *image,
GimpChannelOps operation,
gint32 item_ID);
GIMP_DEPRECATED_FOR(gimp_image_select_item)
G_GNUC_INTERNAL gboolean _gimp_image_select_item (gint32 image_ID,
GimpChannelOps operation,
gint32 item_ID);
G_END_DECLS G_END_DECLS

View File

@ -90,6 +90,62 @@ gimp_image_resize (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_resize: (skip)
* @image_ID: The image.
* @new_width: New image width.
* @new_height: New image height.
* @offx: x offset between upper left corner of old and new images: (new - old).
* @offy: y offset between upper left corner of old and new images: (new - old).
*
* Resize the image to the specified extents.
*
* This procedure resizes the image so that it's new width and height
* are equal to the supplied parameters. Offsets are also provided
* which describe the position of the previous image's content. All
* channels within the image are resized according to the specified
* parameters; this includes the image selection mask. All layers
* within the image are repositioned according to the specified
* offsets.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_resize (gint32 image_ID,
gint new_width,
gint new_height,
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_IMAGE_ID, image_ID,
G_TYPE_INT, new_width,
G_TYPE_INT, new_height,
G_TYPE_INT, offx,
G_TYPE_INT, offy,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-resize",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-resize",
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_image_resize_to_layers: * gimp_image_resize_to_layers:
* @image: The image. * @image: The image.
@ -133,6 +189,49 @@ gimp_image_resize_to_layers (GimpImage *image)
return success; return success;
} }
/**
* _gimp_image_resize_to_layers: (skip)
* @image_ID: The image.
*
* Resize the image to fit all layers.
*
* This procedure resizes the image to the bounding box of all layers
* of the image. All channels within the image are resized to the new
* size; this includes the image selection mask. All layers within the
* image are repositioned to the new image area.
*
* Returns: TRUE on success.
*
* Since: 2.2
**/
gboolean
_gimp_image_resize_to_layers (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-resize-to-layers",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-resize-to-layers",
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_image_scale: * gimp_image_scale:
* @image: The image. * @image: The image.
@ -181,6 +280,54 @@ gimp_image_scale (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_scale: (skip)
* @image_ID: The image.
* @new_width: New image width.
* @new_height: New image height.
*
* Scale the image using the default interpolation method.
*
* This procedure scales the image so that its new width and height are
* equal to the supplied parameters. All layers and channels within the
* image are scaled according to the specified parameters; this
* includes the image selection mask. The interpolation method used can
* be set with gimp_context_set_interpolation().
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_scale (gint32 image_ID,
gint new_width,
gint new_height)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, new_width,
G_TYPE_INT, new_height,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-scale",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-scale",
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_image_crop: * gimp_image_crop:
* @image: The image. * @image: The image.
@ -236,6 +383,61 @@ gimp_image_crop (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_crop: (skip)
* @image_ID: The image.
* @new_width: New image width: (0 < new_width <= width).
* @new_height: New image height: (0 < new_height <= height).
* @offx: X offset: (0 <= offx <= (width - new_width)).
* @offy: Y offset: (0 <= offy <= (height - new_height)).
*
* Crop the image to the specified extents.
*
* This procedure crops the image so that it's new width and height are
* equal to the supplied parameters. Offsets are also provided which
* describe the position of the previous image's content. All channels
* and layers within the image are cropped to the new image extents;
* this includes the image selection mask. If any parameters are out of
* range, an error is returned.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_crop (gint32 image_ID,
gint new_width,
gint new_height,
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_IMAGE_ID, image_ID,
G_TYPE_INT, new_width,
G_TYPE_INT, new_height,
G_TYPE_INT, offx,
G_TYPE_INT, offy,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-crop",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-crop",
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_image_flip: * gimp_image_flip:
* @image: The image. * @image: The image.
@ -277,6 +479,47 @@ gimp_image_flip (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_flip: (skip)
* @image_ID: The image.
* @flip_type: Type of flip.
*
* Flips the image horizontally or vertically.
*
* This procedure flips (mirrors) the image.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_flip (gint32 image_ID,
GimpOrientationType flip_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_ORIENTATION_TYPE, flip_type,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-flip",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-flip",
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_image_rotate: * gimp_image_rotate:
* @image: The image. * @image: The image.
@ -317,3 +560,44 @@ gimp_image_rotate (GimpImage *image,
return success; return success;
} }
/**
* _gimp_image_rotate: (skip)
* @image_ID: The image.
* @rotate_type: Angle of rotation.
*
* Rotates the image by the specified degrees.
*
* This procedure rotates the image.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_rotate (gint32 image_ID,
GimpRotationType rotate_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_ROTATION_TYPE, rotate_type,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-rotate",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-rotate",
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;
}

View File

@ -32,24 +32,48 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gboolean gimp_image_resize (GimpImage *image, gboolean gimp_image_resize (GimpImage *image,
gint new_width, gint new_width,
gint new_height, gint new_height,
gint offx, gint offx,
gint offy); gint offy);
gboolean gimp_image_resize_to_layers (GimpImage *image); GIMP_DEPRECATED_FOR(gimp_image_resize)
gboolean gimp_image_scale (GimpImage *image, G_GNUC_INTERNAL gboolean _gimp_image_resize (gint32 image_ID,
gint new_width, gint new_width,
gint new_height); gint new_height,
gboolean gimp_image_crop (GimpImage *image, gint offx,
gint new_width, gint offy);
gint new_height, gboolean gimp_image_resize_to_layers (GimpImage *image);
gint offx, GIMP_DEPRECATED_FOR(gimp_image_resize_to_layers)
gint offy); G_GNUC_INTERNAL gboolean _gimp_image_resize_to_layers (gint32 image_ID);
gboolean gimp_image_flip (GimpImage *image, gboolean gimp_image_scale (GimpImage *image,
GimpOrientationType flip_type); gint new_width,
gboolean gimp_image_rotate (GimpImage *image, gint new_height);
GimpRotationType rotate_type); GIMP_DEPRECATED_FOR(gimp_image_scale)
G_GNUC_INTERNAL gboolean _gimp_image_scale (gint32 image_ID,
gint new_width,
gint new_height);
gboolean gimp_image_crop (GimpImage *image,
gint new_width,
gint new_height,
gint offx,
gint offy);
GIMP_DEPRECATED_FOR(gimp_image_crop)
G_GNUC_INTERNAL gboolean _gimp_image_crop (gint32 image_ID,
gint new_width,
gint new_height,
gint offx,
gint offy);
gboolean gimp_image_flip (GimpImage *image,
GimpOrientationType flip_type);
GIMP_DEPRECATED_FOR(gimp_image_flip)
G_GNUC_INTERNAL gboolean _gimp_image_flip (gint32 image_ID,
GimpOrientationType flip_type);
gboolean gimp_image_rotate (GimpImage *image,
GimpRotationType rotate_type);
GIMP_DEPRECATED_FOR(gimp_image_rotate)
G_GNUC_INTERNAL gboolean _gimp_image_rotate (gint32 image_ID,
GimpRotationType rotate_type);
G_END_DECLS G_END_DECLS

View File

@ -75,6 +75,47 @@ gimp_image_undo_group_start (GimpImage *image)
return success; return success;
} }
/**
* _gimp_image_undo_group_start: (skip)
* @image_ID: The ID of the image in which to open an undo group.
*
* Starts a group undo.
*
* This function is used to start a group undo--necessary for logically
* combining two or more undo operations into a single operation. This
* call must be used in conjunction with a gimp_image_undo_group_end()
* call.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_undo_group_start (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-undo-group-start",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-undo-group-start",
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_image_undo_group_end: * gimp_image_undo_group_end:
* @image: The ID of the image in which to close an undo group. * @image: The ID of the image in which to close an undo group.
@ -114,6 +155,45 @@ gimp_image_undo_group_end (GimpImage *image)
return success; return success;
} }
/**
* _gimp_image_undo_group_end: (skip)
* @image_ID: The ID of the image in which to close an undo group.
*
* Finish a group undo.
*
* This function must be called once for each
* gimp_image_undo_group_start() call that is made.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_image_undo_group_end (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-undo-group-end",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-undo-group-end",
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_image_undo_is_enabled: * gimp_image_undo_is_enabled:
* @image: The image. * @image: The image.
@ -156,6 +236,48 @@ gimp_image_undo_is_enabled (GimpImage *image)
return enabled; return enabled;
} }
/**
* _gimp_image_undo_is_enabled: (skip)
* @image_ID: The image.
*
* Check if the image's undo stack is enabled.
*
* This procedure checks if the image's undo stack is currently enabled
* or disabled. This is useful when several plug-ins or scripts call
* each other and want to check if their caller has already used
* gimp_image_undo_disable() or gimp_image_undo_freeze().
*
* Returns: TRUE if undo is enabled for this image.
**/
gboolean
_gimp_image_undo_is_enabled (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean enabled = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-undo-is-enabled",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-undo-is-enabled",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
enabled = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return enabled;
}
/** /**
* gimp_image_undo_disable: * gimp_image_undo_disable:
* @image: The image. * @image: The image.
@ -199,6 +321,49 @@ gimp_image_undo_disable (GimpImage *image)
return disabled; return disabled;
} }
/**
* _gimp_image_undo_disable: (skip)
* @image_ID: The image.
*
* Disable the image's undo stack.
*
* This procedure disables the image's undo stack, allowing subsequent
* operations to ignore their undo steps. This is generally called in
* conjunction with gimp_image_undo_enable() to temporarily disable an
* image undo stack. This is advantageous because saving undo steps can
* be time and memory intensive.
*
* Returns: TRUE if the image undo has been disabled.
**/
gboolean
_gimp_image_undo_disable (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean disabled = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-undo-disable",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-undo-disable",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
disabled = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return disabled;
}
/** /**
* gimp_image_undo_enable: * gimp_image_undo_enable:
* @image: The image. * @image: The image.
@ -241,6 +406,48 @@ gimp_image_undo_enable (GimpImage *image)
return enabled; return enabled;
} }
/**
* _gimp_image_undo_enable: (skip)
* @image_ID: The image.
*
* Enable the image's undo stack.
*
* This procedure enables the image's undo stack, allowing subsequent
* operations to store their undo steps. This is generally called in
* conjunction with gimp_image_undo_disable() to temporarily disable an
* image undo stack.
*
* Returns: TRUE if the image undo has been enabled.
**/
gboolean
_gimp_image_undo_enable (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean enabled = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-undo-enable",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-undo-enable",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
enabled = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return enabled;
}
/** /**
* gimp_image_undo_freeze: * gimp_image_undo_freeze:
* @image: The image. * @image: The image.
@ -290,6 +497,55 @@ gimp_image_undo_freeze (GimpImage *image)
return frozen; return frozen;
} }
/**
* _gimp_image_undo_freeze: (skip)
* @image_ID: The image.
*
* Freeze the image's undo stack.
*
* This procedure freezes the image's undo stack, allowing subsequent
* operations to ignore their undo steps. This is generally called in
* conjunction with gimp_image_undo_thaw() to temporarily disable an
* image undo stack. This is advantageous because saving undo steps can
* be time and memory intensive. gimp_image_undo_freeze() /
* gimp_image_undo_thaw() and gimp_image_undo_disable() /
* gimp_image_undo_enable() differ in that the former does not free up
* all undo steps when undo is thawed, so is more suited to interactive
* in-situ previews. It is important in this case that the image is
* back to the same state it was frozen in before thawing, else 'undo'
* behaviour is undefined.
*
* Returns: TRUE if the image undo has been frozen.
**/
gboolean
_gimp_image_undo_freeze (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean frozen = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-undo-freeze",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-undo-freeze",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
frozen = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return frozen;
}
/** /**
* gimp_image_undo_thaw: * gimp_image_undo_thaw:
* @image: The image. * @image: The image.
@ -337,3 +593,51 @@ gimp_image_undo_thaw (GimpImage *image)
return thawed; return thawed;
} }
/**
* _gimp_image_undo_thaw: (skip)
* @image_ID: The image.
*
* Thaw the image's undo stack.
*
* This procedure thaws the image's undo stack, allowing subsequent
* operations to store their undo steps. This is generally called in
* conjunction with gimp_image_undo_freeze() to temporarily freeze an
* image undo stack. gimp_image_undo_thaw() does NOT free the undo
* stack as gimp_image_undo_enable() does, so is suited for situations
* where one wishes to leave the undo stack in the same state in which
* one found it despite non-destructively playing with the image in the
* meantime. An example would be in-situ plug-in previews. Balancing
* freezes and thaws and ensuring image consistency is the
* responsibility of the caller.
*
* Returns: TRUE if the image undo has been thawed.
**/
gboolean
_gimp_image_undo_thaw (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean thawed = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-image-undo-thaw",
args);
else
return_vals = gimp_run_procedure_array ("gimp-image-undo-thaw",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
thawed = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return thawed;
}

View File

@ -32,13 +32,27 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gboolean gimp_image_undo_group_start (GimpImage *image); gboolean gimp_image_undo_group_start (GimpImage *image);
gboolean gimp_image_undo_group_end (GimpImage *image); GIMP_DEPRECATED_FOR(gimp_image_undo_group_start)
gboolean gimp_image_undo_is_enabled (GimpImage *image); G_GNUC_INTERNAL gboolean _gimp_image_undo_group_start (gint32 image_ID);
gboolean gimp_image_undo_disable (GimpImage *image); gboolean gimp_image_undo_group_end (GimpImage *image);
gboolean gimp_image_undo_enable (GimpImage *image); GIMP_DEPRECATED_FOR(gimp_image_undo_group_end)
gboolean gimp_image_undo_freeze (GimpImage *image); G_GNUC_INTERNAL gboolean _gimp_image_undo_group_end (gint32 image_ID);
gboolean gimp_image_undo_thaw (GimpImage *image); gboolean gimp_image_undo_is_enabled (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_undo_is_enabled)
G_GNUC_INTERNAL gboolean _gimp_image_undo_is_enabled (gint32 image_ID);
gboolean gimp_image_undo_disable (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_undo_disable)
G_GNUC_INTERNAL gboolean _gimp_image_undo_disable (gint32 image_ID);
gboolean gimp_image_undo_enable (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_undo_enable)
G_GNUC_INTERNAL gboolean _gimp_image_undo_enable (gint32 image_ID);
gboolean gimp_image_undo_freeze (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_undo_freeze)
G_GNUC_INTERNAL gboolean _gimp_image_undo_freeze (gint32 image_ID);
gboolean gimp_image_undo_thaw (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_image_undo_thaw)
G_GNUC_INTERNAL gboolean _gimp_image_undo_thaw (gint32 image_ID);
G_END_DECLS G_END_DECLS

View File

@ -110,13 +110,54 @@ gimp_item_get_image (gint32 item_ID)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
image = gimp_image_new_by_id (g_value_get_int (gimp_value_array_index (return_vals, 1))); image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
return image; return image;
} }
/**
* _gimp_item_get_image: (skip)
* @item_ID: The item.
*
* Returns the item's image.
*
* This procedure returns the item's image.
*
* Returns: The item's image.
*
* Since: 2.8
**/
gint32
_gimp_item_get_image (gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 image_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-item-get-image",
args);
else
return_vals = gimp_run_procedure_array ("gimp-item-get-image",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
image_ID = gimp_value_get_image_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return image_ID;
}
/** /**
* gimp_item_delete: * gimp_item_delete:
* @item_ID: The item to delete. * @item_ID: The item to delete.

View File

@ -32,52 +32,54 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gboolean gimp_item_is_valid (gint32 item_ID); gboolean gimp_item_is_valid (gint32 item_ID);
GimpImage* gimp_item_get_image (gint32 item_ID); GimpImage* gimp_item_get_image (gint32 item_ID);
gboolean gimp_item_delete (gint32 item_ID); GIMP_DEPRECATED_FOR(gimp_item_get_image)
gboolean gimp_item_is_drawable (gint32 item_ID); G_GNUC_INTERNAL gint32 _gimp_item_get_image (gint32 item_ID);
gboolean gimp_item_is_layer (gint32 item_ID); gboolean gimp_item_delete (gint32 item_ID);
gboolean gimp_item_is_text_layer (gint32 item_ID); gboolean gimp_item_is_drawable (gint32 item_ID);
gboolean gimp_item_is_channel (gint32 item_ID); gboolean gimp_item_is_layer (gint32 item_ID);
gboolean gimp_item_is_layer_mask (gint32 item_ID); gboolean gimp_item_is_text_layer (gint32 item_ID);
gboolean gimp_item_is_selection (gint32 item_ID); gboolean gimp_item_is_channel (gint32 item_ID);
gboolean gimp_item_is_vectors (gint32 item_ID); gboolean gimp_item_is_layer_mask (gint32 item_ID);
gboolean gimp_item_is_group (gint32 item_ID); gboolean gimp_item_is_selection (gint32 item_ID);
gint32 gimp_item_get_parent (gint32 item_ID); gboolean gimp_item_is_vectors (gint32 item_ID);
gint* gimp_item_get_children (gint32 item_ID, gboolean gimp_item_is_group (gint32 item_ID);
gint *num_children); gint32 gimp_item_get_parent (gint32 item_ID);
gboolean gimp_item_get_expanded (gint32 item_ID); gint* gimp_item_get_children (gint32 item_ID,
gboolean gimp_item_set_expanded (gint32 item_ID, gint *num_children);
gboolean expanded); gboolean gimp_item_get_expanded (gint32 item_ID);
gchar* gimp_item_get_name (gint32 item_ID); gboolean gimp_item_set_expanded (gint32 item_ID,
gboolean gimp_item_set_name (gint32 item_ID, gboolean expanded);
const gchar *name); gchar* gimp_item_get_name (gint32 item_ID);
gboolean gimp_item_get_visible (gint32 item_ID); gboolean gimp_item_set_name (gint32 item_ID,
gboolean gimp_item_set_visible (gint32 item_ID, const gchar *name);
gboolean visible); gboolean gimp_item_get_visible (gint32 item_ID);
gboolean gimp_item_get_linked (gint32 item_ID); gboolean gimp_item_set_visible (gint32 item_ID,
gboolean gimp_item_set_linked (gint32 item_ID, gboolean visible);
gboolean linked); gboolean gimp_item_get_linked (gint32 item_ID);
gboolean gimp_item_get_lock_content (gint32 item_ID); gboolean gimp_item_set_linked (gint32 item_ID,
gboolean gimp_item_set_lock_content (gint32 item_ID, gboolean linked);
gboolean lock_content); gboolean gimp_item_get_lock_content (gint32 item_ID);
gboolean gimp_item_get_lock_position (gint32 item_ID); gboolean gimp_item_set_lock_content (gint32 item_ID,
gboolean gimp_item_set_lock_position (gint32 item_ID, gboolean lock_content);
gboolean lock_position); gboolean gimp_item_get_lock_position (gint32 item_ID);
GimpColorTag gimp_item_get_color_tag (gint32 item_ID); gboolean gimp_item_set_lock_position (gint32 item_ID,
gboolean gimp_item_set_color_tag (gint32 item_ID, gboolean lock_position);
GimpColorTag color_tag); GimpColorTag gimp_item_get_color_tag (gint32 item_ID);
guint gimp_item_get_tattoo (gint32 item_ID); gboolean gimp_item_set_color_tag (gint32 item_ID,
gboolean gimp_item_set_tattoo (gint32 item_ID, GimpColorTag color_tag);
guint tattoo); guint gimp_item_get_tattoo (gint32 item_ID);
gboolean gimp_item_attach_parasite (gint32 item_ID, gboolean gimp_item_set_tattoo (gint32 item_ID,
const GimpParasite *parasite); guint tattoo);
gboolean gimp_item_detach_parasite (gint32 item_ID, gboolean gimp_item_attach_parasite (gint32 item_ID,
const gchar *name); const GimpParasite *parasite);
GimpParasite* gimp_item_get_parasite (gint32 item_ID, gboolean gimp_item_detach_parasite (gint32 item_ID,
const gchar *name); const gchar *name);
gchar** gimp_item_get_parasite_list (gint32 item_ID, GimpParasite* gimp_item_get_parasite (gint32 item_ID,
gint *num_parasites); const gchar *name);
gchar** gimp_item_get_parasite_list (gint32 item_ID,
gint *num_parasites);
G_END_DECLS G_END_DECLS

View File

@ -96,6 +96,68 @@ _gimp_layer_new (GimpImage *image,
return layer_ID; return layer_ID;
} }
/**
* __gimp_layer_new: (skip)
* @image_ID: The image to which to add the layer.
* @width: The layer width.
* @height: The layer height.
* @type: The layer type.
* @name: The layer name.
* @opacity: The layer opacity.
* @mode: The layer combination mode.
*
* Create a new layer.
*
* This procedure creates a new layer with the specified width, height,
* and type. Name, opacity, and mode are also supplied parameters. The
* new layer still needs to be added to the image, as this is not
* automatic. Add the new layer with the gimp_image_insert_layer()
* command. Other attributes such as layer mask modes, and offsets
* should be set with explicit procedure calls.
*
* Returns: The newly created layer.
**/
gint32
__gimp_layer_new (gint32 image_ID,
gint width,
gint height,
GimpImageType type,
const gchar *name,
gdouble opacity,
GimpLayerMode mode)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, width,
G_TYPE_INT, height,
GIMP_TYPE_IMAGE_TYPE, type,
G_TYPE_STRING, name,
G_TYPE_DOUBLE, opacity,
GIMP_TYPE_LAYER_MODE, mode,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-layer-new",
args);
else
return_vals = gimp_run_procedure_array ("gimp-layer-new",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return layer_ID;
}
/** /**
* gimp_layer_new_from_visible: * gimp_layer_new_from_visible:
* @image: The source image from where the content is copied. * @image: The source image from where the content is copied.
@ -147,6 +209,57 @@ gimp_layer_new_from_visible (GimpImage *image,
return layer_ID; return layer_ID;
} }
/**
* _gimp_layer_new_from_visible: (skip)
* @image_ID: The source image from where the content is copied.
* @dest_image_ID: The destination image to which to add the layer.
* @name: The layer name.
*
* Create a new layer from what is visible in an image.
*
* This procedure creates a new layer from what is visible in the given
* image. The new layer still needs to be added to the destination
* image, as this is not automatic. Add the new layer with the
* gimp_image_insert_layer() command. Other attributes such as layer
* mask modes, and offsets should be set with explicit procedure calls.
*
* Returns: The newly created layer.
*
* Since: 2.6
**/
gint32
_gimp_layer_new_from_visible (gint32 image_ID,
gint32 dest_image_ID,
const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_IMAGE_ID, dest_image_ID,
G_TYPE_STRING, name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-layer-new-from-visible",
args);
else
return_vals = gimp_run_procedure_array ("gimp-layer-new-from-visible",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return layer_ID;
}
/** /**
* gimp_layer_new_from_drawable: * gimp_layer_new_from_drawable:
* @drawable_ID: The source drawable from where the new layer is copied. * @drawable_ID: The source drawable from where the new layer is copied.
@ -193,6 +306,52 @@ gimp_layer_new_from_drawable (gint32 drawable_ID,
return layer_copy_ID; return layer_copy_ID;
} }
/**
* _gimp_layer_new_from_drawable: (skip)
* @drawable_ID: The source drawable from where the new layer is copied.
* @dest_image_ID: The destination image to which to add the layer.
*
* Create a new layer by copying an existing drawable.
*
* This procedure creates a new layer as a copy of the specified
* drawable. The new layer still needs to be added to the image, as
* this is not automatic. Add the new layer with the
* gimp_image_insert_layer() command. Other attributes such as layer
* mask modes, and offsets should be set with explicit procedure calls.
*
* Returns: The newly copied layer.
**/
gint32
_gimp_layer_new_from_drawable (gint32 drawable_ID,
gint32 dest_image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_copy_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
GIMP_TYPE_IMAGE_ID, dest_image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-layer-new-from-drawable",
args);
else
return_vals = gimp_run_procedure_array ("gimp-layer-new-from-drawable",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_copy_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return layer_copy_ID;
}
/** /**
* gimp_layer_group_new: * gimp_layer_group_new:
* @image: The image to which to add the layer group. * @image: The image to which to add the layer group.
@ -240,6 +399,53 @@ gimp_layer_group_new (GimpImage *image)
return layer_group_ID; return layer_group_ID;
} }
/**
* _gimp_layer_group_new: (skip)
* @image_ID: The image to which to add the layer group.
*
* Create a new layer group.
*
* This procedure creates a new layer group. Attributes such as layer
* mode and opacity should be set with explicit procedure calls. Add
* the new layer group (which is a kind of layer) with the
* gimp_image_insert_layer() command.
* Other procedures useful with layer groups:
* gimp_image_reorder_item(), gimp_item_get_parent(),
* gimp_item_get_children(), gimp_item_is_group().
*
* Returns: The newly created layer group.
*
* Since: 2.8
**/
gint32
_gimp_layer_group_new (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_group_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-layer-group-new",
args);
else
return_vals = gimp_run_procedure_array ("gimp-layer-group-new",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_group_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return layer_group_ID;
}
/** /**
* _gimp_layer_copy: * _gimp_layer_copy:
* @layer_ID: The layer to copy. * @layer_ID: The layer to copy.

View File

@ -39,12 +39,29 @@ G_GNUC_INTERNAL gint32 _gimp_layer_new (GimpImage *
const gchar *name, const gchar *name,
gdouble opacity, gdouble opacity,
GimpLayerMode mode); GimpLayerMode mode);
GIMP_DEPRECATED_FOR(_gimp_layer_new)
G_GNUC_INTERNAL gint32 __gimp_layer_new (gint32 image_ID,
gint width,
gint height,
GimpImageType type,
const gchar *name,
gdouble opacity,
GimpLayerMode mode);
gint32 gimp_layer_new_from_visible (GimpImage *image, gint32 gimp_layer_new_from_visible (GimpImage *image,
GimpImage *dest_image, GimpImage *dest_image,
const gchar *name); const gchar *name);
GIMP_DEPRECATED_FOR(gimp_layer_new_from_visible)
G_GNUC_INTERNAL gint32 _gimp_layer_new_from_visible (gint32 image_ID,
gint32 dest_image_ID,
const gchar *name);
gint32 gimp_layer_new_from_drawable (gint32 drawable_ID, gint32 gimp_layer_new_from_drawable (gint32 drawable_ID,
GimpImage *dest_image); GimpImage *dest_image);
GIMP_DEPRECATED_FOR(gimp_layer_new_from_drawable)
G_GNUC_INTERNAL gint32 _gimp_layer_new_from_drawable (gint32 drawable_ID,
gint32 dest_image_ID);
gint32 gimp_layer_group_new (GimpImage *image); gint32 gimp_layer_group_new (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_layer_group_new)
G_GNUC_INTERNAL gint32 _gimp_layer_group_new (gint32 image_ID);
G_GNUC_INTERNAL gint32 _gimp_layer_copy (gint32 layer_ID, G_GNUC_INTERNAL gint32 _gimp_layer_copy (gint32 layer_ID,
gboolean add_alpha); gboolean add_alpha);
gboolean gimp_layer_add_alpha (gint32 layer_ID); gboolean gimp_layer_add_alpha (gint32 layer_ID);

View File

@ -104,6 +104,76 @@ gimp_selection_bounds (GimpImage *image,
return success; return success;
} }
/**
* _gimp_selection_bounds: (skip)
* @image_ID: The image.
* @non_empty: (out): TRUE if there is a selection.
* @x1: (out): x coordinate of upper left corner of selection bounds.
* @y1: (out): y coordinate of upper left corner of selection bounds.
* @x2: (out): x coordinate of lower right corner of selection bounds.
* @y2: (out): y coordinate of lower right corner of selection bounds.
*
* Find the bounding box of the current selection.
*
* This procedure returns whether there is a selection for the
* specified image. If there is one, the upper left and lower right
* corners of the bounding box are returned. These coordinates are
* relative to the image. Please note that the pixel specified by the
* lower right coordinate of the bounding box is not part of the
* selection. The selection ends at the upper left corner of this
* pixel. This means the width of the selection can be calculated as
* (x2 - x1), its height as (y2 - y1).
*
* Returns: TRUE on success.
**/
gboolean
_gimp_selection_bounds (gint32 image_ID,
gboolean *non_empty,
gint *x1,
gint *y1,
gint *x2,
gint *y2)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-bounds",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-bounds",
args);
gimp_value_array_unref (args);
*non_empty = FALSE;
*x1 = 0;
*y1 = 0;
*x2 = 0;
*y2 = 0;
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
if (success)
{
*non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
*x1 = g_value_get_int (gimp_value_array_index (return_vals, 2));
*y1 = g_value_get_int (gimp_value_array_index (return_vals, 3));
*x2 = g_value_get_int (gimp_value_array_index (return_vals, 4));
*y2 = g_value_get_int (gimp_value_array_index (return_vals, 5));
}
gimp_value_array_unref (return_vals);
return success;
}
/** /**
* gimp_selection_value: * gimp_selection_value:
* @image: The image. * @image: The image.
@ -150,6 +220,52 @@ gimp_selection_value (GimpImage *image,
return value; return value;
} }
/**
* _gimp_selection_value: (skip)
* @image_ID: The image.
* @x: x coordinate of value.
* @y: y coordinate of value.
*
* Find the value of the selection at the specified coordinates.
*
* This procedure returns the value of the selection at the specified
* coordinates. If the coordinates lie out of bounds, 0 is returned.
*
* Returns: Value of the selection.
**/
gint
_gimp_selection_value (gint32 image_ID,
gint x,
gint y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint value = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, x,
G_TYPE_INT, y,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-value",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-value",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
value = g_value_get_int (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return value;
}
/** /**
* gimp_selection_is_empty: * gimp_selection_is_empty:
* @image: The image. * @image: The image.
@ -190,6 +306,46 @@ gimp_selection_is_empty (GimpImage *image)
return is_empty; return is_empty;
} }
/**
* _gimp_selection_is_empty: (skip)
* @image_ID: The image.
*
* Determine whether the selection is empty.
*
* This procedure returns TRUE if the selection for the specified image
* is empty.
*
* Returns: Is the selection empty?
**/
gboolean
_gimp_selection_is_empty (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean is_empty = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-is-empty",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-is-empty",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
is_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return is_empty;
}
/** /**
* gimp_selection_translate: * gimp_selection_translate:
* @image: The image. * @image: The image.
@ -238,6 +394,54 @@ gimp_selection_translate (GimpImage *image,
return success; return success;
} }
/**
* _gimp_selection_translate: (skip)
* @image_ID: The image.
* @offx: x offset for translation.
* @offy: y offset for translation.
*
* Translate the selection by the specified offsets.
*
* This procedure actually translates the selection for the specified
* image by the specified offsets. Regions that are translated from
* beyond the bounds of the image are set to empty. Valid regions of
* the selection which are translated beyond the bounds of the image
* because of this call are lost.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_selection_translate (gint32 image_ID,
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_IMAGE_ID, image_ID,
G_TYPE_INT, offx,
G_TYPE_INT, offy,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-translate",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-translate",
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_selection_float: * _gimp_selection_float:
* @drawable_ID: The drawable from which to float selection. * @drawable_ID: The drawable from which to float selection.
@ -327,6 +531,45 @@ gimp_selection_invert (GimpImage *image)
return success; return success;
} }
/**
* _gimp_selection_invert: (skip)
* @image_ID: The image.
*
* Invert the selection mask.
*
* This procedure inverts the selection mask. For every pixel in the
* selection channel, its new value is calculated as (255 - old-value).
*
* Returns: TRUE on success.
**/
gboolean
_gimp_selection_invert (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-invert",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-invert",
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_selection_sharpen: * gimp_selection_sharpen:
* @image: The image. * @image: The image.
@ -368,6 +611,47 @@ gimp_selection_sharpen (GimpImage *image)
return success; return success;
} }
/**
* _gimp_selection_sharpen: (skip)
* @image_ID: The image.
*
* Sharpen the selection mask.
*
* This procedure sharpens the selection mask. For every pixel in the
* selection channel, if the value is &gt; 127, the new pixel is
* assigned a value of 255. This removes any \"anti-aliasing\" that
* might exist in the selection mask's boundary.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_selection_sharpen (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-sharpen",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-sharpen",
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_selection_all: * gimp_selection_all:
* @image: The image. * @image: The image.
@ -407,6 +691,45 @@ gimp_selection_all (GimpImage *image)
return success; return success;
} }
/**
* _gimp_selection_all: (skip)
* @image_ID: The image.
*
* Select all of the image.
*
* This procedure sets the selection mask to completely encompass the
* image. Every pixel in the selection channel is set to 255.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_selection_all (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-all",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-all",
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_selection_none: * gimp_selection_none:
* @image: The image. * @image: The image.
@ -446,6 +769,45 @@ gimp_selection_none (GimpImage *image)
return success; return success;
} }
/**
* _gimp_selection_none: (skip)
* @image_ID: The image.
*
* Deselect the entire image.
*
* This procedure deselects the entire image. Every pixel in the
* selection channel is set to 0.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_selection_none (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-none",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-none",
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_selection_feather: * gimp_selection_feather:
* @image: The image. * @image: The image.
@ -488,6 +850,48 @@ gimp_selection_feather (GimpImage *image,
return success; return success;
} }
/**
* _gimp_selection_feather: (skip)
* @image_ID: The image.
* @radius: Radius of feather (in pixels).
*
* Feather the image's selection
*
* This procedure feathers the selection. Feathering is implemented
* using a gaussian blur.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_selection_feather (gint32 image_ID,
gdouble radius)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_DOUBLE, radius,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-feather",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-feather",
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_selection_border: * gimp_selection_border:
* @image: The image. * @image: The image.
@ -531,6 +935,49 @@ gimp_selection_border (GimpImage *image,
return success; return success;
} }
/**
* _gimp_selection_border: (skip)
* @image_ID: The image.
* @radius: Radius of border (in pixels).
*
* Border the image's selection
*
* This procedure borders the selection. Bordering creates a new
* selection which is defined along the boundary of the previous
* selection at every point within the specified radius.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_selection_border (gint32 image_ID,
gint radius)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, radius,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-border",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-border",
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_selection_grow: * gimp_selection_grow:
* @image: The image. * @image: The image.
@ -573,6 +1020,48 @@ gimp_selection_grow (GimpImage *image,
return success; return success;
} }
/**
* _gimp_selection_grow: (skip)
* @image_ID: The image.
* @steps: Steps of grow (in pixels).
*
* Grow the image's selection
*
* This procedure grows the selection. Growing involves expanding the
* boundary in all directions by the specified pixel amount.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_selection_grow (gint32 image_ID,
gint steps)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, steps,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-grow",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-grow",
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_selection_shrink: * gimp_selection_shrink:
* @image: The image. * @image: The image.
@ -616,6 +1105,49 @@ gimp_selection_shrink (GimpImage *image,
return success; return success;
} }
/**
* _gimp_selection_shrink: (skip)
* @image_ID: The image.
* @steps: Steps of shrink (in pixels).
*
* Shrink the image's selection
*
* This procedure shrinks the selection. Shrinking involves trimming
* the existing selection boundary on all sides by the specified number
* of pixels.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_selection_shrink (gint32 image_ID,
gint steps)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, steps,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-shrink",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-shrink",
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_selection_flood: * gimp_selection_flood:
* @image: The image. * @image: The image.
@ -659,6 +1191,49 @@ gimp_selection_flood (GimpImage *image)
return success; return success;
} }
/**
* _gimp_selection_flood: (skip)
* @image_ID: The image.
*
* Remove holes from the image's selection
*
* This procedure removes holes from the selection, that can come from
* selecting a patchy area with the Fuzzy Select Tool. In technical
* terms this procedure floods the selection. See the Algorithms page
* in the developer wiki for details.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
_gimp_selection_flood (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-flood",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-flood",
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_selection_save: * gimp_selection_save:
* @image: The image. * @image: The image.
@ -699,3 +1274,44 @@ gimp_selection_save (GimpImage *image)
return channel_ID; return channel_ID;
} }
/**
* _gimp_selection_save: (skip)
* @image_ID: The image.
*
* Copy the selection mask to a new channel.
*
* This procedure copies the selection mask and stores the content in a
* new channel. The new channel is automatically inserted into the
* image's list of channels.
*
* Returns: The new channel.
**/
gint32
_gimp_selection_save (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 channel_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-selection-save",
args);
else
return_vals = gimp_run_procedure_array ("gimp-selection-save",
args);
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));
gimp_value_array_unref (return_vals);
return channel_ID;
}

View File

@ -32,36 +32,77 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gboolean gimp_selection_bounds (GimpImage *image, gboolean gimp_selection_bounds (GimpImage *image,
gboolean *non_empty, gboolean *non_empty,
gint *x1, gint *x1,
gint *y1, gint *y1,
gint *x2, gint *x2,
gint *y2); gint *y2);
gint gimp_selection_value (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_selection_bounds)
gint x, G_GNUC_INTERNAL gboolean _gimp_selection_bounds (gint32 image_ID,
gint y); gboolean *non_empty,
gboolean gimp_selection_is_empty (GimpImage *image); gint *x1,
gboolean gimp_selection_translate (GimpImage *image, gint *y1,
gint offx, gint *x2,
gint offy); gint *y2);
G_GNUC_INTERNAL gint32 _gimp_selection_float (gint32 drawable_ID, gint gimp_selection_value (GimpImage *image,
gint offx, gint x,
gint offy); gint y);
gboolean gimp_selection_invert (GimpImage *image); GIMP_DEPRECATED_FOR(gimp_selection_value)
gboolean gimp_selection_sharpen (GimpImage *image); G_GNUC_INTERNAL gint _gimp_selection_value (gint32 image_ID,
gboolean gimp_selection_all (GimpImage *image); gint x,
gboolean gimp_selection_none (GimpImage *image); gint y);
gboolean gimp_selection_feather (GimpImage *image, gboolean gimp_selection_is_empty (GimpImage *image);
gdouble radius); GIMP_DEPRECATED_FOR(gimp_selection_is_empty)
gboolean gimp_selection_border (GimpImage *image, G_GNUC_INTERNAL gboolean _gimp_selection_is_empty (gint32 image_ID);
gint radius); gboolean gimp_selection_translate (GimpImage *image,
gboolean gimp_selection_grow (GimpImage *image, gint offx,
gint steps); gint offy);
gboolean gimp_selection_shrink (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_selection_translate)
gint steps); G_GNUC_INTERNAL gboolean _gimp_selection_translate (gint32 image_ID,
gboolean gimp_selection_flood (GimpImage *image); gint offx,
gint32 gimp_selection_save (GimpImage *image); gint offy);
G_GNUC_INTERNAL gint32 _gimp_selection_float (gint32 drawable_ID,
gint offx,
gint offy);
gboolean gimp_selection_invert (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_selection_invert)
G_GNUC_INTERNAL gboolean _gimp_selection_invert (gint32 image_ID);
gboolean gimp_selection_sharpen (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_selection_sharpen)
G_GNUC_INTERNAL gboolean _gimp_selection_sharpen (gint32 image_ID);
gboolean gimp_selection_all (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_selection_all)
G_GNUC_INTERNAL gboolean _gimp_selection_all (gint32 image_ID);
gboolean gimp_selection_none (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_selection_none)
G_GNUC_INTERNAL gboolean _gimp_selection_none (gint32 image_ID);
gboolean gimp_selection_feather (GimpImage *image,
gdouble radius);
GIMP_DEPRECATED_FOR(gimp_selection_feather)
G_GNUC_INTERNAL gboolean _gimp_selection_feather (gint32 image_ID,
gdouble radius);
gboolean gimp_selection_border (GimpImage *image,
gint radius);
GIMP_DEPRECATED_FOR(gimp_selection_border)
G_GNUC_INTERNAL gboolean _gimp_selection_border (gint32 image_ID,
gint radius);
gboolean gimp_selection_grow (GimpImage *image,
gint steps);
GIMP_DEPRECATED_FOR(gimp_selection_grow)
G_GNUC_INTERNAL gboolean _gimp_selection_grow (gint32 image_ID,
gint steps);
gboolean gimp_selection_shrink (GimpImage *image,
gint steps);
GIMP_DEPRECATED_FOR(gimp_selection_shrink)
G_GNUC_INTERNAL gboolean _gimp_selection_shrink (gint32 image_ID,
gint steps);
gboolean gimp_selection_flood (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_selection_flood)
G_GNUC_INTERNAL gboolean _gimp_selection_flood (gint32 image_ID);
gint32 gimp_selection_save (GimpImage *image);
GIMP_DEPRECATED_FOR(gimp_selection_save)
G_GNUC_INTERNAL gint32 _gimp_selection_save (gint32 image_ID);
G_END_DECLS G_END_DECLS

View File

@ -92,6 +92,64 @@ gimp_text_layer_new (GimpImage *image,
return layer_ID; return layer_ID;
} }
/**
* _gimp_text_layer_new: (skip)
* @image_ID: The image.
* @text: The text to generate (in UTF-8 encoding).
* @fontname: The name of the font.
* @size: The size of text in either pixels or points.
* @unit: The units of specified size.
*
* Creates a new text layer.
*
* This procedure creates a new text layer. The arguments are kept as
* simple as necessary for the normal case. All text attributes,
* however, can be modified with the appropriate
* gimp_text_layer_set_*() procedures. The new layer still needs to be
* added to the image, as this is not automatic. Add the new layer
* using gimp_image_insert_layer().
*
* Returns: The new text layer.
*
* Since: 2.6
**/
gint32
_gimp_text_layer_new (gint32 image_ID,
const gchar *text,
const gchar *fontname,
gdouble size,
GimpUnit unit)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, text,
G_TYPE_STRING, fontname,
G_TYPE_DOUBLE, size,
GIMP_TYPE_UNIT, unit,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-text-layer-new",
args);
else
return_vals = gimp_run_procedure_array ("gimp-text-layer-new",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return layer_ID;
}
/** /**
* gimp_text_layer_get_text: * gimp_text_layer_get_text:
* @layer_ID: The text layer. * @layer_ID: The text layer.

View File

@ -32,57 +32,63 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gint32 gimp_text_layer_new (GimpImage *image, gint32 gimp_text_layer_new (GimpImage *image,
const gchar *text, const gchar *text,
const gchar *fontname, const gchar *fontname,
gdouble size, gdouble size,
GimpUnit unit); GimpUnit unit);
gchar* gimp_text_layer_get_text (gint32 layer_ID); GIMP_DEPRECATED_FOR(gimp_text_layer_new)
gboolean gimp_text_layer_set_text (gint32 layer_ID, G_GNUC_INTERNAL gint32 _gimp_text_layer_new (gint32 image_ID,
const gchar *text); const gchar *text,
gchar* gimp_text_layer_get_markup (gint32 layer_ID); const gchar *fontname,
gchar* gimp_text_layer_get_font (gint32 layer_ID); gdouble size,
gboolean gimp_text_layer_set_font (gint32 layer_ID, GimpUnit unit);
const gchar *font); gchar* gimp_text_layer_get_text (gint32 layer_ID);
gdouble gimp_text_layer_get_font_size (gint32 layer_ID, gboolean gimp_text_layer_set_text (gint32 layer_ID,
GimpUnit *unit); const gchar *text);
gboolean gimp_text_layer_set_font_size (gint32 layer_ID, gchar* gimp_text_layer_get_markup (gint32 layer_ID);
gdouble font_size, gchar* gimp_text_layer_get_font (gint32 layer_ID);
GimpUnit unit); gboolean gimp_text_layer_set_font (gint32 layer_ID,
gboolean gimp_text_layer_get_antialias (gint32 layer_ID); const gchar *font);
gboolean gimp_text_layer_set_antialias (gint32 layer_ID, gdouble gimp_text_layer_get_font_size (gint32 layer_ID,
gboolean antialias); GimpUnit *unit);
GimpTextHintStyle gimp_text_layer_get_hint_style (gint32 layer_ID); gboolean gimp_text_layer_set_font_size (gint32 layer_ID,
gboolean gimp_text_layer_set_hint_style (gint32 layer_ID, gdouble font_size,
GimpTextHintStyle style); GimpUnit unit);
gboolean gimp_text_layer_get_kerning (gint32 layer_ID); gboolean gimp_text_layer_get_antialias (gint32 layer_ID);
gboolean gimp_text_layer_set_kerning (gint32 layer_ID, gboolean gimp_text_layer_set_antialias (gint32 layer_ID,
gboolean kerning); gboolean antialias);
gchar* gimp_text_layer_get_language (gint32 layer_ID); GimpTextHintStyle gimp_text_layer_get_hint_style (gint32 layer_ID);
gboolean gimp_text_layer_set_language (gint32 layer_ID, gboolean gimp_text_layer_set_hint_style (gint32 layer_ID,
const gchar *language); GimpTextHintStyle style);
GimpTextDirection gimp_text_layer_get_base_direction (gint32 layer_ID); gboolean gimp_text_layer_get_kerning (gint32 layer_ID);
gboolean gimp_text_layer_set_base_direction (gint32 layer_ID, gboolean gimp_text_layer_set_kerning (gint32 layer_ID,
GimpTextDirection direction); gboolean kerning);
GimpTextJustification gimp_text_layer_get_justification (gint32 layer_ID); gchar* gimp_text_layer_get_language (gint32 layer_ID);
gboolean gimp_text_layer_set_justification (gint32 layer_ID, gboolean gimp_text_layer_set_language (gint32 layer_ID,
GimpTextJustification justify); const gchar *language);
gboolean gimp_text_layer_get_color (gint32 layer_ID, GimpTextDirection gimp_text_layer_get_base_direction (gint32 layer_ID);
GimpRGB *color); gboolean gimp_text_layer_set_base_direction (gint32 layer_ID,
gboolean gimp_text_layer_set_color (gint32 layer_ID, GimpTextDirection direction);
const GimpRGB *color); GimpTextJustification gimp_text_layer_get_justification (gint32 layer_ID);
gdouble gimp_text_layer_get_indent (gint32 layer_ID); gboolean gimp_text_layer_set_justification (gint32 layer_ID,
gboolean gimp_text_layer_set_indent (gint32 layer_ID, GimpTextJustification justify);
gdouble indent); gboolean gimp_text_layer_get_color (gint32 layer_ID,
gdouble gimp_text_layer_get_line_spacing (gint32 layer_ID); GimpRGB *color);
gboolean gimp_text_layer_set_line_spacing (gint32 layer_ID, gboolean gimp_text_layer_set_color (gint32 layer_ID,
gdouble line_spacing); const GimpRGB *color);
gdouble gimp_text_layer_get_letter_spacing (gint32 layer_ID); gdouble gimp_text_layer_get_indent (gint32 layer_ID);
gboolean gimp_text_layer_set_letter_spacing (gint32 layer_ID, gboolean gimp_text_layer_set_indent (gint32 layer_ID,
gdouble letter_spacing); gdouble indent);
gboolean gimp_text_layer_resize (gint32 layer_ID, gdouble gimp_text_layer_get_line_spacing (gint32 layer_ID);
gdouble width, gboolean gimp_text_layer_set_line_spacing (gint32 layer_ID,
gdouble height); gdouble line_spacing);
gdouble gimp_text_layer_get_letter_spacing (gint32 layer_ID);
gboolean gimp_text_layer_set_letter_spacing (gint32 layer_ID,
gdouble letter_spacing);
gboolean gimp_text_layer_resize (gint32 layer_ID,
gdouble width,
gdouble height);
G_END_DECLS G_END_DECLS

View File

@ -113,6 +113,85 @@ gimp_text_fontname (GimpImage *image,
return text_layer_ID; return text_layer_ID;
} }
/**
* _gimp_text_fontname: (skip)
* @image_ID: The image.
* @drawable_ID: The affected drawable: (-1 for a new text layer).
* @x: The x coordinate for the left of the text bounding box.
* @y: The y coordinate for the top of the text bounding box.
* @text: The text to generate (in UTF-8 encoding).
* @border: The size of the border.
* @antialias: Antialiasing.
* @size: The size of text in either pixels or points.
* @size_type: The units of specified size.
* @fontname: The name of the font.
*
* Add text at the specified location as a floating selection or a new
* layer.
*
* This tool requires a fontname matching an installed PangoFT2 font.
* You can specify the fontsize in units of pixels or points, and the
* appropriate metric is specified using the size_type argument. The x
* and y parameters together control the placement of the new text by
* specifying the upper left corner of the text bounding box. If the
* specified drawable parameter is valid, the text will be created as a
* floating selection attached to the drawable. If the drawable
* parameter is not valid (-1), the text will appear as a new layer.
* Finally, a border can be specified around the final rendered text.
* The border is measured in pixels. Parameter size-type is not used
* and is currently ignored. If you need to display a font in points,
* divide the size in points by 72.0 and multiply it by the image's
* vertical resolution.
*
* Returns: The new text layer or -1 if no layer was created.
**/
gint32
_gimp_text_fontname (gint32 image_ID,
gint32 drawable_ID,
gdouble x,
gdouble y,
const gchar *text,
gint border,
gboolean antialias,
gdouble size,
GimpSizeType size_type,
const gchar *fontname)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 text_layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
G_TYPE_DOUBLE, x,
G_TYPE_DOUBLE, y,
G_TYPE_STRING, text,
G_TYPE_INT, border,
G_TYPE_BOOLEAN, antialias,
G_TYPE_DOUBLE, size,
GIMP_TYPE_SIZE_TYPE, size_type,
G_TYPE_STRING, fontname,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-text-fontname",
args);
else
return_vals = gimp_run_procedure_array ("gimp-text-fontname",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
text_layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return text_layer_ID;
}
/** /**
* gimp_text_get_extents_fontname: * gimp_text_get_extents_fontname:
* @text: The text to generate (in UTF-8 encoding). * @text: The text to generate (in UTF-8 encoding).

View File

@ -32,24 +32,35 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gint32 gimp_text_fontname (GimpImage *image, gint32 gimp_text_fontname (GimpImage *image,
gint32 drawable_ID, gint32 drawable_ID,
gdouble x, gdouble x,
gdouble y, gdouble y,
const gchar *text, const gchar *text,
gint border, gint border,
gboolean antialias, gboolean antialias,
gdouble size, gdouble size,
GimpSizeType size_type, GimpSizeType size_type,
const gchar *fontname); const gchar *fontname);
gboolean gimp_text_get_extents_fontname (const gchar *text, GIMP_DEPRECATED_FOR(gimp_text_fontname)
gdouble size, G_GNUC_INTERNAL gint32 _gimp_text_fontname (gint32 image_ID,
GimpSizeType size_type, gint32 drawable_ID,
const gchar *fontname, gdouble x,
gint *width, gdouble y,
gint *height, const gchar *text,
gint *ascent, gint border,
gint *descent); gboolean antialias,
gdouble size,
GimpSizeType size_type,
const gchar *fontname);
gboolean gimp_text_get_extents_fontname (const gchar *text,
gdouble size,
GimpSizeType size_type,
const gchar *fontname,
gint *width,
gint *height,
gint *ascent,
gint *descent);
G_END_DECLS G_END_DECLS

View File

@ -79,6 +79,51 @@ gimp_vectors_new (GimpImage *image,
return vectors_ID; return vectors_ID;
} }
/**
* _gimp_vectors_new: (skip)
* @image_ID: The image.
* @name: the name of the new vector object.
*
* Creates a new empty vectors object.
*
* Creates a new empty vectors object. The vectors object needs to be
* added to the image using gimp_image_insert_vectors().
*
* Returns: the current vector object, 0 if no vector exists in the image.
*
* Since: 2.4
**/
gint32
_gimp_vectors_new (gint32 image_ID,
const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 vectors_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-vectors-new",
args);
else
return_vals = gimp_run_procedure_array ("gimp-vectors-new",
args);
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));
gimp_value_array_unref (return_vals);
return vectors_ID;
}
/** /**
* gimp_vectors_new_from_text_layer: * gimp_vectors_new_from_text_layer:
* @image: The image. * @image: The image.
@ -124,6 +169,51 @@ gimp_vectors_new_from_text_layer (GimpImage *image,
return vectors_ID; return vectors_ID;
} }
/**
* _gimp_vectors_new_from_text_layer: (skip)
* @image_ID: The image.
* @layer_ID: The text layer.
*
* Creates a new vectors object from a text layer.
*
* Creates a new vectors object from a text layer. The vectors object
* needs to be added to the image using gimp_image_insert_vectors().
*
* Returns: The vectors of the text layer.
*
* Since: 2.6
**/
gint32
_gimp_vectors_new_from_text_layer (gint32 image_ID,
gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 vectors_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_LAYER_ID, layer_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-vectors-new-from-text-layer",
args);
else
return_vals = gimp_run_procedure_array ("gimp-vectors-new-from-text-layer",
args);
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));
gimp_value_array_unref (return_vals);
return vectors_ID;
}
/** /**
* gimp_vectors_copy: * gimp_vectors_copy:
* @vectors_ID: The vectors object to copy. * @vectors_ID: The vectors object to copy.
@ -1194,6 +1284,69 @@ gimp_vectors_import_from_file (GimpImage *image,
return success; return success;
} }
/**
* _gimp_vectors_import_from_file: (skip)
* @image_ID: The image.
* @filename: The name of the SVG file to import.
* @merge: Merge paths into a single vectors object.
* @scale: Scale the SVG to image dimensions.
* @num_vectors: (out): The number of newly created vectors.
* @vectors_ids: (out) (array length=num_vectors): The list of newly created vectors.
*
* Import paths from an SVG file.
*
* This procedure imports paths from an SVG file. SVG elements other
* than paths and basic shapes are ignored.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
_gimp_vectors_import_from_file (gint32 image_ID,
const gchar *filename,
gboolean merge,
gboolean scale,
gint *num_vectors,
gint **vectors_ids)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, filename,
G_TYPE_BOOLEAN, merge,
G_TYPE_BOOLEAN, scale,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-vectors-import-from-file",
args);
else
return_vals = gimp_run_procedure_array ("gimp-vectors-import-from-file",
args);
gimp_value_array_unref (args);
*num_vectors = 0;
*vectors_ids = NULL;
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
if (success)
{
*num_vectors = g_value_get_int (gimp_value_array_index (return_vals, 1));
*vectors_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
}
gimp_value_array_unref (return_vals);
return success;
}
/** /**
* gimp_vectors_import_from_string: * gimp_vectors_import_from_string:
* @image: The image. * @image: The image.
@ -1261,6 +1414,73 @@ gimp_vectors_import_from_string (GimpImage *image,
return success; return success;
} }
/**
* _gimp_vectors_import_from_string: (skip)
* @image_ID: The image.
* @string: A string that must be a complete and valid SVG document.
* @length: Number of bytes in string or -1 if the string is NULL terminated.
* @merge: Merge paths into a single vectors object.
* @scale: Scale the SVG to image dimensions.
* @num_vectors: (out): The number of newly created vectors.
* @vectors_ids: (out) (array length=num_vectors): The list of newly created vectors.
*
* Import paths from an SVG string.
*
* This procedure works like gimp_vectors_import_from_file() but takes
* a string rather than reading the SVG from a file. This allows you to
* write scripts that generate SVG and feed it to GIMP.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
_gimp_vectors_import_from_string (gint32 image_ID,
const gchar *string,
gint length,
gboolean merge,
gboolean scale,
gint *num_vectors,
gint **vectors_ids)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, string,
G_TYPE_INT, length,
G_TYPE_BOOLEAN, merge,
G_TYPE_BOOLEAN, scale,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-vectors-import-from-string",
args);
else
return_vals = gimp_run_procedure_array ("gimp-vectors-import-from-string",
args);
gimp_value_array_unref (args);
*num_vectors = 0;
*vectors_ids = NULL;
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
if (success)
{
*num_vectors = g_value_get_int (gimp_value_array_index (return_vals, 1));
*vectors_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
}
gimp_value_array_unref (return_vals);
return success;
}
/** /**
* gimp_vectors_export_to_file: * gimp_vectors_export_to_file:
* @image: The image. * @image: The image.
@ -1310,6 +1530,55 @@ gimp_vectors_export_to_file (GimpImage *image,
return success; return success;
} }
/**
* _gimp_vectors_export_to_file: (skip)
* @image_ID: The image.
* @filename: The name of the SVG file to create.
* @vectors_ID: The vectors object to be saved, or 0 for all in the image.
*
* save a path as an SVG file.
*
* This procedure creates an SVG file to save a Vectors object, that
* is, a path. The resulting file can be edited using a vector graphics
* application, or later reloaded into GIMP. If you pass 0 as the
* 'vectors' argument, then all paths in the image will be exported.
*
* Returns: TRUE on success.
*
* Since: 2.6
**/
gboolean
_gimp_vectors_export_to_file (gint32 image_ID,
const gchar *filename,
gint32 vectors_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, filename,
GIMP_TYPE_VECTORS_ID, vectors_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-vectors-export-to-file",
args);
else
return_vals = gimp_run_procedure_array ("gimp-vectors-export-to-file",
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_vectors_export_to_string: * gimp_vectors_export_to_string:
* @image: The image. * @image: The image.
@ -1358,3 +1627,51 @@ gimp_vectors_export_to_string (GimpImage *image,
return string; return string;
} }
/**
* _gimp_vectors_export_to_string: (skip)
* @image_ID: The image.
* @vectors_ID: The vectors object to save, or 0 for all in the image.
*
* Save a path as an SVG string.
*
* This procedure works like gimp_vectors_export_to_file() but creates
* a string rather than a file. The contents are a NUL-terminated
* string that holds a complete XML document. If you pass 0 as the
* 'vectors' argument, then all paths in the image will be exported.
*
* Returns: A string whose contents are a complete SVG document.
* The returned value must be freed with g_free().
*
* Since: 2.6
**/
gchar *
_gimp_vectors_export_to_string (gint32 image_ID,
gint32 vectors_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
gchar *string = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_VECTORS_ID, vectors_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
"gimp-vectors-export-to-string",
args);
else
return_vals = gimp_run_procedure_array ("gimp-vectors-export-to-string",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
string = g_value_dup_string (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return string;
}

View File

@ -32,111 +32,139 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gint32 gimp_vectors_new (GimpImage *image, gint32 gimp_vectors_new (GimpImage *image,
const gchar *name); const gchar *name);
gint32 gimp_vectors_new_from_text_layer (GimpImage *image, GIMP_DEPRECATED_FOR(gimp_vectors_new)
gint32 layer_ID); G_GNUC_INTERNAL gint32 _gimp_vectors_new (gint32 image_ID,
gint32 gimp_vectors_copy (gint32 vectors_ID); const gchar *name);
gint* gimp_vectors_get_strokes (gint32 vectors_ID, gint32 gimp_vectors_new_from_text_layer (GimpImage *image,
gint *num_strokes); gint32 layer_ID);
gdouble gimp_vectors_stroke_get_length (gint32 vectors_ID, GIMP_DEPRECATED_FOR(gimp_vectors_new_from_text_layer)
gint stroke_id, G_GNUC_INTERNAL gint32 _gimp_vectors_new_from_text_layer (gint32 image_ID,
gdouble precision); gint32 layer_ID);
gboolean gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID, gint32 gimp_vectors_copy (gint32 vectors_ID);
gint stroke_id, gint* gimp_vectors_get_strokes (gint32 vectors_ID,
gdouble dist, gint *num_strokes);
gdouble precision, gdouble gimp_vectors_stroke_get_length (gint32 vectors_ID,
gdouble *x_point, gint stroke_id,
gdouble *y_point, gdouble precision);
gdouble *slope, gboolean gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID,
gboolean *valid); gint stroke_id,
gboolean gimp_vectors_remove_stroke (gint32 vectors_ID, gdouble dist,
gint stroke_id); gdouble precision,
gboolean gimp_vectors_stroke_close (gint32 vectors_ID, gdouble *x_point,
gint stroke_id); gdouble *y_point,
gboolean gimp_vectors_stroke_translate (gint32 vectors_ID, gdouble *slope,
gint stroke_id, gboolean *valid);
gint off_x, gboolean gimp_vectors_remove_stroke (gint32 vectors_ID,
gint off_y); gint stroke_id);
gboolean gimp_vectors_stroke_scale (gint32 vectors_ID, gboolean gimp_vectors_stroke_close (gint32 vectors_ID,
gint stroke_id, gint stroke_id);
gdouble scale_x, gboolean gimp_vectors_stroke_translate (gint32 vectors_ID,
gdouble scale_y); gint stroke_id,
gboolean gimp_vectors_stroke_rotate (gint32 vectors_ID, gint off_x,
gint stroke_id, gint off_y);
gdouble center_x, gboolean gimp_vectors_stroke_scale (gint32 vectors_ID,
gdouble center_y, gint stroke_id,
gdouble angle); gdouble scale_x,
gboolean gimp_vectors_stroke_flip (gint32 vectors_ID, gdouble scale_y);
gint stroke_id, gboolean gimp_vectors_stroke_rotate (gint32 vectors_ID,
GimpOrientationType flip_type, gint stroke_id,
gdouble axis); gdouble center_x,
gboolean gimp_vectors_stroke_flip_free (gint32 vectors_ID, gdouble center_y,
gint stroke_id, gdouble angle);
gdouble x1, gboolean gimp_vectors_stroke_flip (gint32 vectors_ID,
gdouble y1, gint stroke_id,
gdouble x2, GimpOrientationType flip_type,
gdouble y2); gdouble axis);
GimpVectorsStrokeType gimp_vectors_stroke_get_points (gint32 vectors_ID, gboolean gimp_vectors_stroke_flip_free (gint32 vectors_ID,
gint stroke_id, gint stroke_id,
gint *num_points, gdouble x1,
gdouble **controlpoints, gdouble y1,
gboolean *closed); gdouble x2,
gint gimp_vectors_stroke_new_from_points (gint32 vectors_ID, gdouble y2);
GimpVectorsStrokeType type, GimpVectorsStrokeType gimp_vectors_stroke_get_points (gint32 vectors_ID,
gint num_points, gint stroke_id,
const gdouble *controlpoints, gint *num_points,
gboolean closed); gdouble **controlpoints,
gdouble* gimp_vectors_stroke_interpolate (gint32 vectors_ID, gboolean *closed);
gint stroke_id, gint gimp_vectors_stroke_new_from_points (gint32 vectors_ID,
gdouble precision, GimpVectorsStrokeType type,
gint *num_coords, gint num_points,
gboolean *closed); const gdouble *controlpoints,
gint gimp_vectors_bezier_stroke_new_moveto (gint32 vectors_ID, gboolean closed);
gdouble x0, gdouble* gimp_vectors_stroke_interpolate (gint32 vectors_ID,
gdouble y0); gint stroke_id,
gboolean gimp_vectors_bezier_stroke_lineto (gint32 vectors_ID, gdouble precision,
gint stroke_id, gint *num_coords,
gdouble x0, gboolean *closed);
gdouble y0); gint gimp_vectors_bezier_stroke_new_moveto (gint32 vectors_ID,
gboolean gimp_vectors_bezier_stroke_conicto (gint32 vectors_ID, gdouble x0,
gint stroke_id, gdouble y0);
gdouble x0, gboolean gimp_vectors_bezier_stroke_lineto (gint32 vectors_ID,
gdouble y0, gint stroke_id,
gdouble x1, gdouble x0,
gdouble y1); gdouble y0);
gboolean gimp_vectors_bezier_stroke_cubicto (gint32 vectors_ID, gboolean gimp_vectors_bezier_stroke_conicto (gint32 vectors_ID,
gint stroke_id, gint stroke_id,
gdouble x0, gdouble x0,
gdouble y0, gdouble y0,
gdouble x1, gdouble x1,
gdouble y1, gdouble y1);
gdouble x2, gboolean gimp_vectors_bezier_stroke_cubicto (gint32 vectors_ID,
gdouble y2); gint stroke_id,
gint gimp_vectors_bezier_stroke_new_ellipse (gint32 vectors_ID, gdouble x0,
gdouble x0, gdouble y0,
gdouble y0, gdouble x1,
gdouble radius_x, gdouble y1,
gdouble radius_y, gdouble x2,
gdouble angle); gdouble y2);
gboolean gimp_vectors_import_from_file (GimpImage *image, gint gimp_vectors_bezier_stroke_new_ellipse (gint32 vectors_ID,
const gchar *filename, gdouble x0,
gboolean merge, gdouble y0,
gboolean scale, gdouble radius_x,
gint *num_vectors, gdouble radius_y,
gint **vectors_ids); gdouble angle);
gboolean gimp_vectors_import_from_string (GimpImage *image, gboolean gimp_vectors_import_from_file (GimpImage *image,
const gchar *string, const gchar *filename,
gint length, gboolean merge,
gboolean merge, gboolean scale,
gboolean scale, gint *num_vectors,
gint *num_vectors, gint **vectors_ids);
gint **vectors_ids); GIMP_DEPRECATED_FOR(gimp_vectors_import_from_file)
gboolean gimp_vectors_export_to_file (GimpImage *image, G_GNUC_INTERNAL gboolean _gimp_vectors_import_from_file (gint32 image_ID,
const gchar *filename, const gchar *filename,
gint32 vectors_ID); gboolean merge,
gchar* gimp_vectors_export_to_string (GimpImage *image, gboolean scale,
gint32 vectors_ID); 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);
GIMP_DEPRECATED_FOR(gimp_vectors_import_from_string)
G_GNUC_INTERNAL 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 (GimpImage *image,
const gchar *filename,
gint32 vectors_ID);
GIMP_DEPRECATED_FOR(gimp_vectors_export_to_file)
G_GNUC_INTERNAL gboolean _gimp_vectors_export_to_file (gint32 image_ID,
const gchar *filename,
gint32 vectors_ID);
gchar* gimp_vectors_export_to_string (GimpImage *image,
gint32 vectors_ID);
GIMP_DEPRECATED_FOR(gimp_vectors_export_to_string)
G_GNUC_INTERNAL gchar* _gimp_vectors_export_to_string (gint32 image_ID,
gint32 vectors_ID);
G_END_DECLS G_END_DECLS

View File

@ -45,17 +45,23 @@ sub desc_wrap {
return $wrapped; return $wrapped;
} }
sub generate { sub generate_fun {
my @procs = @{(shift)}; my ($proc, $out, $api_deprecated) = @_;
my %out; my @inargs = @{$proc->{inargs}} if (defined $proc->{inargs});
my @outargs = @{$proc->{outargs}} if (defined $proc->{outargs});
sub libtype { sub libtype {
my $arg = shift; my $arg = shift;
my $outarg = shift; my $outarg = shift;
my $api_deprecated = shift;
my ($type, $name) = &arg_parse($arg->{type}); my ($type, $name) = &arg_parse($arg->{type});
my $argtype = $arg_types{$type}; my $argtype = $arg_types{$type};
my $rettype = ''; my $rettype = '';
if ($api_deprecated && $argtype->{name} eq 'IMAGE') {
return 'gint32 ';
}
if (exists $argtype->{id}) { if (exists $argtype->{id}) {
return 'gint32 '; return 'gint32 ';
} }
@ -73,371 +79,393 @@ sub generate {
} }
$rettype .= $argtype->{const_type}; $rettype .= $argtype->{const_type};
} }
$rettype =~ s/int32/int/ unless exists $arg->{keep_size}; $rettype =~ s/int32/int/ unless exists $arg->{keep_size};
$rettype .= '*' if exists $argtype->{struct}; $rettype .= '*' if exists $argtype->{struct};
return $rettype; return $rettype;
} }
foreach $name (@procs) { my $funcname = "gimp_$name";
my $proc = $main::pdb{$name}; my $wrapped = "";
my $out = \%{$out{$proc->{group}}}; my %usednames;
my $retdesc = " * Returns:";
my $func_annotations = "";
my @inargs = @{$proc->{inargs}} if (defined $proc->{inargs}); if ($proc->{lib_private}) {
my @outargs = @{$proc->{outargs}} if (defined $proc->{outargs}); $wrapped = '_';
}
my $funcname = "gimp_$name"; if ($api_deprecated) {
my $wrapped = ""; push @{$out->{protos}}, "GIMP_DEPRECATED_FOR($wrapped$funcname)\n";
my %usednames; $func_annotations .= " (skip)";
my $retdesc = " * Returns:"; }
elsif ($proc->{deprecated}) {
if ($proc->{deprecated} eq 'NONE') {
push @{$out->{protos}}, "GIMP_DEPRECATED\n";
}
else {
my $underscores = $proc->{deprecated};
$underscores =~ s/-/_/g;
if ($proc->{lib_private}) { push @{$out->{protos}}, "GIMP_DEPRECATED_FOR($underscores)\n";
$wrapped = '_'; }
} }
if ($proc->{deprecated}) { # Add an underscore for deprecated API. If the original was already
if ($proc->{deprecated} eq 'NONE') { # private, this will be 2 underscores.
push @{$out->{protos}}, "GIMP_DEPRECATED\n"; if ($api_deprecated) {
} $wrapped .= '_';
else { }
my $underscores = $proc->{deprecated};
$underscores =~ s/-/_/g;
push @{$out->{protos}}, "GIMP_DEPRECATED_FOR($underscores)\n"; # Find the return argument (defaults to the first arg if not
} # explicitly set
} my $retarg = undef;
$retvoid = 0;
foreach (@outargs) {
$retarg = $_, last if exists $_->{retval};
}
# Find the return argument (defaults to the first arg if not unless ($retarg) {
# explicitly set if (scalar @outargs) {
my $retarg = undef; if (exists $outargs[0]->{void_ret}) {
$retvoid = 0; $retvoid = 1;
foreach (@outargs) {
$retarg = $_, last if exists $_->{retval};
}
unless ($retarg) {
if (scalar @outargs) {
if (exists $outargs[0]->{void_ret}) {
$retvoid = 1;
}
else {
$retarg = exists $outargs[0]->{num} ? $outargs[1]
: $outargs[0];
}
}
}
my $rettype;
if ($retarg) {
my ($type) = &arg_parse($retarg->{type});
my $argtype = $arg_types{$type};
my $annotate = "";
$rettype = &libtype($retarg, 1);
chop $rettype unless $rettype =~ /\*$/;
$retarg->{retval} = 1;
if (exists $argtype->{array}) {
$annotate = " (array length=$retarg->{array}->{name})";
}
if (exists $argtype->{out_annotate}) {
$annotate .= " $argtype->{out_annotate}";
}
if ($annotate eq "") {
$retdesc .= " $retarg->{desc}";
}
else {
if (exists $retarg->{desc}) {
if ((length ($annotate) +
length ($retarg->{desc})) > 65) {
$retdesc .= $annotate . ":\n * " . $retarg->{desc};
}
else {
$retdesc .= $annotate . ": " . $retarg->{desc};
}
}
}
unless ($retdesc =~ /[\.\!\?]$/) { $retdesc .= '.' }
if ($retarg->{type} eq 'string') {
$retdesc .= "\n * The returned value must be freed with g_free().";
}
elsif ($retarg->{type} eq 'stringarray') {
$retdesc .= "\n * The returned value must be freed with g_strfreev().";
}
elsif ($retarg->{type} eq 'param') {
$retdesc .= "\n * The returned value must be freed with g_param_spec_unref().";
}
elsif (exists $argtype->{array}) {
$retdesc .= "\n * The returned value must be freed with g_free().";
}
}
else {
# No return values
$rettype = 'void';
}
# The parameters to the function
my $arglist = "";
my $argdesc = "";
my $sincedesc = "";
my $value_array = "";
my $arg_array = "";
my $argc = 0;
foreach (@inargs) {
my ($type, @typeinfo) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
my $var = $_->{name};
my $desc = exists $_->{desc} ? $_->{desc} : "";
my $var_len;
my $value;
$var .= '_ID' if $arg->{id};
# This gets passed to gimp_value_array_new_with_types()
if ($type eq 'enum') {
$enum_type = $typeinfo[0];
$enum_type =~ s/([a-z])([A-Z])/$1_$2/g;
$enum_type =~ s/([A-Z]+)([A-Z])/$1_$2/g;
$enum_type =~ tr/[a-z]/[A-Z]/;
$enum_type =~ s/^GIMP/GIMP_TYPE/;
$enum_type =~ s/^GEGL/GEGL_TYPE/;
$value_array .= "$enum_type, ";
}
else {
$value_array .= "$arg->{gtype}, ";
}
if (exists $_->{array}) {
$value_array .= "NULL";
}
elsif (exists $arg->{convert_func}) {
$value_array .= eval qq/"$arg->{convert_func}"/;
} }
else { else {
$value_array .= "$var"; $retarg = exists $outargs[0]->{num} ? $outargs[1]
} : $outargs[0];
}
}
}
$value_array .= ",\n" . " " x 42; my $rettype;
if ($retarg) {
my ($type) = &arg_parse($retarg->{type});
my $argtype = $arg_types{$type};
my $annotate = "";
$rettype = &libtype($retarg, 1, $api_deprecated);
chop $rettype unless $rettype =~ /\*$/;
if (exists $_->{array}) { $retarg->{retval} = 1;
my $arrayarg = $_->{array};
$value = "gimp_value_array_index (args, $argc)"; if (exists $argtype->{array}) {
$annotate = " (array length=$retarg->{array}->{name})";
}
if (exists $arrayarg->{name}) { if ($api_deprecated) {
$var_len = $arrayarg->{name}; if (exists $argtype->{out_annotate_d}) {
} $annotate .= " $argtype->{out_annotate_d}";
else { }
$var_len = 'num_' . $_->{name}; }
} elsif (exists $argtype->{out_annotate}) {
$annotate .= " $argtype->{out_annotate}";
}
# This is the list of g_value_set_foo_array if ($annotate eq "") {
$arg_array .= eval qq/" $arg->{set_value_func};\n"/; $retdesc .= " $retarg->{desc}";
} }
else {
if (exists $retarg->{desc}) {
if ((length ($annotate) +
length ($retarg->{desc})) > 65) {
$retdesc .= $annotate . ":\n * " . $retarg->{desc};
}
else {
$retdesc .= $annotate . ": " . $retarg->{desc};
}
}
}
$usednames{$_->{name}}++; unless ($retdesc =~ /[\.\!\?]$/) { $retdesc .= '.' }
$arglist .= &libtype($_, 0); if ($retarg->{type} eq 'string') {
$arglist .= $_->{name}; $retdesc .= "\n * The returned value must be freed with g_free().";
$arglist .= '_ID' if $arg->{id}; }
$arglist .= ', '; elsif ($retarg->{type} eq 'stringarray') {
$retdesc .= "\n * The returned value must be freed with g_strfreev().";
}
elsif ($retarg->{type} eq 'param') {
$retdesc .= "\n * The returned value must be freed with g_param_spec_unref().";
}
elsif (exists $argtype->{array}) {
$retdesc .= "\n * The returned value must be freed with g_free().";
}
}
else {
# No return values
$rettype = 'void';
}
$argdesc .= " * \@$_->{name}"; # The parameters to the function
$argdesc .= '_ID' if $arg->{id}; my $arglist = "";
$argdesc .= ":"; my $argdesc = "";
my $sincedesc = "";
my $value_array = "";
my $arg_array = "";
my $argc = 0;
foreach (@inargs) {
my ($type, @typeinfo) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
my $var = $_->{name};
my $desc = exists $_->{desc} ? $_->{desc} : "";
my $var_len;
my $value;
my $is_id = ($arg->{id} || ($api_deprecated && $arg->{name} eq 'IMAGE'));
if (exists $arg->{array}) { $var .= '_ID' if $is_id;
$argdesc .= " (array length=@inargs[$argc - 1]->{name})";
}
if (exists $arg->{in_annotate}) { # This gets passed to gimp_value_array_new_with_types()
$argdesc .= " $arg->{in_annotate}"; if ($type eq 'enum') {
} $enum_type = $typeinfo[0];
$enum_type =~ s/([a-z])([A-Z])/$1_$2/g;
$enum_type =~ s/([A-Z]+)([A-Z])/$1_$2/g;
$enum_type =~ tr/[a-z]/[A-Z]/;
$enum_type =~ s/^GIMP/GIMP_TYPE/;
$enum_type =~ s/^GEGL/GEGL_TYPE/;
if (exists $arg->{array} || exists $arg->{in_annotate}) { $value_array .= "$enum_type, ";
$argdesc .= ":"; }
else {
$value_array .= "$arg->{gtype}, ";
}
if (exists $_->{array}) {
$value_array .= "NULL";
}
elsif (exists $arg->{convert_func} && ! $api_deprecated) {
$value_array .= eval qq/"$arg->{convert_func}"/;
}
else {
$value_array .= "$var";
}
$value_array .= ",\n" . " " x 42;
if (exists $_->{array}) {
my $arrayarg = $_->{array};
$value = "gimp_value_array_index (args, $argc)";
if (exists $arrayarg->{name}) {
$var_len = $arrayarg->{name};
}
else {
$var_len = 'num_' . $_->{name};
} }
$argdesc .= " $desc"; # This is the list of g_value_set_foo_array
$arg_array .= eval qq/" $arg->{set_value_func};\n"/;
}
unless ($argdesc =~ /[\.\!\?]$/) { $argdesc .= '.' } $usednames{$_->{name}}++;
$argdesc .= "\n";
$argc++; $arglist .= &libtype($_, 0, $api_deprecated);
} $arglist .= $_->{name};
$arglist .= '_ID' if $is_id;
$arglist .= ', ';
# This marshals the return value(s) $argdesc .= " * \@$_->{name}";
my $return_args = ""; $argdesc .= '_ID' if $is_id;
my $return_marshal = "gimp_value_array_unref (return_vals);"; $argdesc .= ":";
# return success/failure boolean if we don't have anything else if (exists $arg->{array}) {
if ($rettype eq 'void') { $argdesc .= " (array length=@inargs[$argc - 1]->{name})";
$return_args .= "\n" . ' ' x 2 . "gboolean success = TRUE;"; }
$retdesc .= " TRUE on success.";
}
# We only need to bother with this if we have to return a value if (exists $arg->{in_annotate}) {
if ($rettype ne 'void' || $retvoid) { $argdesc .= " $arg->{in_annotate}";
my $once = 0; }
my $firstvar;
my @initnums;
foreach (@outargs) { if (exists $arg->{array} || exists $arg->{in_annotate}) {
my ($type) = &arg_parse($_->{type}); $argdesc .= ":";
my $arg = $arg_types{$type}; }
my $var;
$return_marshal = "" unless $once++; $argdesc .= " $desc";
$_->{libname} = exists $usednames{$_->{name}} ? "ret_$_->{name}" unless ($argdesc =~ /[\.\!\?]$/) { $argdesc .= '.' }
: $_->{name}; $argdesc .= "\n";
if (exists $_->{num}) { $argc++;
if (!exists $_->{no_lib}) { }
push @initnums, $_;
}
}
elsif (exists $_->{retval}) {
$return_args .= "\n" . ' ' x 2;
$return_args .= &libtype($_, 1);
# The return value variable # This marshals the return value(s)
$var = $_->{libname}; my $return_args = "";
$var .= '_ID' if $arg->{id}; my $return_marshal = "gimp_value_array_unref (return_vals);";
$return_args .= $var;
# Save the first var to "return" it # return success/failure boolean if we don't have anything else
$firstvar = $var unless defined $firstvar; if ($rettype eq 'void') {
$return_args .= "\n" . ' ' x 2 . "gboolean success = TRUE;";
$retdesc .= " TRUE on success.";
}
if ($arg->{id}) { # We only need to bother with this if we have to return a value
# Initialize all IDs to -1 if ($rettype ne 'void' || $retvoid) {
$return_args .= " = -1"; my $once = 0;
} my $firstvar;
elsif ($_->{libdef}) { my @initnums;
$return_args .= " = $_->{libdef}";
}
else {
$return_args .= " = $arg->{init_value}";
}
$return_args .= ";"; foreach (@outargs) {
my ($type) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
my $var;
my $is_id = ($arg->{id} || ($api_deprecated && $arg->{name} eq 'IMAGE'));
if (exists $_->{array} && exists $_->{array}->{no_lib}) { $return_marshal = "" unless $once++;
$return_args .= "\n" . ' ' x 2 . "gint num_$var;";
}
}
elsif ($retvoid) {
push @initnums, $_ unless exists $arg->{struct};
}
}
if (scalar(@initnums)) { $_->{libname} = exists $usednames{$_->{name}} ? "ret_$_->{name}"
foreach (@initnums) { : $_->{name};
$return_marshal .= "\*$_->{libname} = ";
my ($type) = &arg_parse($_->{type});
for ($arg_types{$type}->{type}) {
/\*$/ && do { $return_marshal .= "NULL"; last };
/boolean/ && do { $return_marshal .= "FALSE"; last };
/double/ && do { $return_marshal .= "0.0"; last };
$return_marshal .= "0";
}
$return_marshal .= ";\n ";
}
$return_marshal =~ s/\n $/\n\n /s;
}
if ($rettype eq 'void') { if (exists $_->{num}) {
$return_marshal .= <<CODE; if (!exists $_->{no_lib}) {
push @initnums, $_;
}
}
elsif (exists $_->{retval}) {
$return_args .= "\n" . ' ' x 2;
$return_args .= &libtype($_, 1, $api_deprecated);
# The return value variable
$var = $_->{libname};
$var .= '_ID' if $is_id;
$return_args .= $var;
# Save the first var to "return" it
$firstvar = $var unless defined $firstvar;
if ($is_id) {
# Initialize all IDs to -1
$return_args .= " = -1";
}
elsif ($_->{libdef}) {
$return_args .= " = $_->{libdef}";
}
else {
$return_args .= " = $arg->{init_value}";
}
$return_args .= ";";
if (exists $_->{array} && exists $_->{array}->{no_lib}) {
$return_args .= "\n" . ' ' x 2 . "gint num_$var;";
}
}
elsif ($retvoid) {
push @initnums, $_ unless exists $arg->{struct};
}
}
if (scalar(@initnums)) {
foreach (@initnums) {
$return_marshal .= "\*$_->{libname} = ";
my ($type) = &arg_parse($_->{type});
for ($arg_types{$type}->{type}) {
/\*$/ && do { $return_marshal .= "NULL"; last };
/boolean/ && do { $return_marshal .= "FALSE"; last };
/double/ && do { $return_marshal .= "0.0"; last };
$return_marshal .= "0";
}
$return_marshal .= ";\n ";
}
$return_marshal =~ s/\n $/\n\n /s;
}
if ($rettype eq 'void') {
$return_marshal .= <<CODE;
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS; success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
if (success) if (success)
CODE CODE
} }
else { else {
$return_marshal .= <<CODE; $return_marshal .= <<CODE;
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
CODE CODE
} }
$return_marshal .= ' ' x 4 . "{\n" if $#outargs; $return_marshal .= ' ' x 4 . "{\n" if $#outargs;
my $argc = 1; my ($numpos, $numtype); my $argc = 1; my ($numpos, $numtype);
foreach (@outargs) { foreach (@outargs) {
my ($type) = &arg_parse($_->{type}); my ($type) = &arg_parse($_->{type});
my $desc = exists $_->{desc} ? $_->{desc} : ""; my $desc = exists $_->{desc} ? $_->{desc} : "";
my $arg = $arg_types{$type}; my $arg = $arg_types{$type};
my $var; my $is_id = ($arg->{id} || ($api_deprecated && $arg->{name} eq 'IMAGE'));
my $var;
# The return value variable # The return value variable
$var = ""; $var = "";
unless (exists $_->{retval}) { unless (exists $_->{retval}) {
$var .= '*'; $var .= '*';
$arglist .= &libtype($_, 1); $arglist .= &libtype($_, 1);
$arglist .= '*' unless exists $arg->{struct}; $arglist .= '*' unless exists $arg->{struct};
$arglist .= "$_->{libname}"; $arglist .= "$_->{libname}";
$arglist .= '_ID' if $arg->{id}; $arglist .= '_ID' if $is_id;
$arglist .= ', '; $arglist .= ', ';
$argdesc .= " * \@$_->{libname}"; $argdesc .= " * \@$_->{libname}";
$argdesc .= '_ID' if $arg->{id}; $argdesc .= '_ID' if $is_id;
if ($arg->{name} eq 'COLOR') { if ($arg->{name} eq 'COLOR') {
$argdesc .= ": (out caller-allocates)"; $argdesc .= ": (out caller-allocates)";
} }
else { else {
$argdesc .= ": (out)"; $argdesc .= ": (out)";
} }
if (exists $arg->{array}) { if (exists $arg->{array}) {
$argdesc .= " (array length=@outargs[$argc - 2]->{name})"; $argdesc .= " (array length=@outargs[$argc - 2]->{name})";
} }
if (exists $arg->{out_annotate}) { if ($api_deprecated) {
$argdesc .= " $arg->{out_annotate}"; if (exists $arg->{out_annotate_d}) {
} $argdesc .= " $arg->{out_annotate_d}";
}
}
elsif (exists $arg->{out_annotate}) {
$argdesc .= " $arg->{out_annotate}";
}
$argdesc .= ": $desc"; $argdesc .= ": $desc";
} }
$var = exists $_->{retval} ? "" : '*'; $var = exists $_->{retval} ? "" : '*';
$var .= $_->{libname}; $var .= $_->{libname};
$var .= '_ID' if $arg->{id}; $var .= '_ID' if $is_id;
$value = "gimp_value_array_index (return_vals, $argc)"; $value = "gimp_value_array_index (return_vals, $argc)";
$return_marshal .= ' ' x 2 if $#outargs; $return_marshal .= ' ' x 2 if $#outargs;
$return_marshal .= eval qq/" $arg->{dup_value_func};\n"/; if ($api_deprecated && $arg->{dup_value_func_d}) {
$return_marshal .= eval qq/" $arg->{dup_value_func_d};\n"/;
}
else {
$return_marshal .= eval qq/" $arg->{dup_value_func};\n"/;
}
if ($argdesc) { if ($argdesc) {
unless ($argdesc =~ /[\.\!\?]$/) { $argdesc .= '.' } unless ($argdesc =~ /[\.\!\?]$/) { $argdesc .= '.' }
unless ($argdesc =~ /\n$/) { $argdesc .= "\n" } unless ($argdesc =~ /\n$/) { $argdesc .= "\n" }
} }
$argc++; $argc++;
} }
$return_marshal .= ' ' x 4 . "}\n" if $#outargs; $return_marshal .= ' ' x 4 . "}\n" if $#outargs;
$return_marshal .= <<'CODE'; $return_marshal .= <<'CODE';
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
CODE CODE
unless ($retvoid) { unless ($retvoid) {
$return_marshal .= ' ' x 2 . "return $firstvar;"; $return_marshal .= ' ' x 2 . "return $firstvar;";
} }
else { else {
$return_marshal .= ' ' x 2 . "return success;"; $return_marshal .= ' ' x 2 . "return success;";
} }
} }
else { else {
$return_marshal = <<CODE; $return_marshal = <<CODE;
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS; success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
$return_marshal $return_marshal
@ -445,94 +473,93 @@ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB
return success; return success;
CODE CODE
chop $return_marshal; chop $return_marshal;
} }
if ($arglist) { if ($arglist) {
my @arglist = split(/, /, $arglist); my @arglist = split(/, /, $arglist);
my $longest = 0; my $seen = 0; my $longest = 0; my $seen = 0;
foreach (@arglist) { foreach (@arglist) {
/(const \w+) \S+/ || /(\w+) \S+/; /(const \w+) \S+/ || /(\w+) \S+/;
my $len = length($1); my $len = length($1);
my $num = scalar @{[ /\*/g ]}; my $num = scalar @{[ /\*/g ]};
$seen = $num if $seen < $num; $seen = $num if $seen < $num;
$longest = $len if $longest < $len; $longest = $len if $longest < $len;
} }
$longest += $seen; $longest += $seen;
my $once = 0; $arglist = ""; my $once = 0; $arglist = "";
foreach (@arglist) { foreach (@arglist) {
my $space = rindex($_, ' '); my $space = rindex($_, ' ');
my $len = $longest - $space + 1; my $len = $longest - $space + 1;
$len -= scalar @{[ /\*/g ]}; $len -= scalar @{[ /\*/g ]};
substr($_, $space, 1) = ' ' x $len if $space != -1 && $len > 1; substr($_, $space, 1) = ' ' x $len if $space != -1 && $len > 1;
$arglist .= "\t" if $once; $arglist .= "\t" if $once;
$arglist .= $_; $arglist .= $_;
$arglist .= ",\n"; $arglist .= ",\n";
$once++; $once++;
} }
$arglist =~ s/,\n$//; $arglist =~ s/,\n$//;
} }
else { else {
$arglist = "void"; $arglist = "void";
} }
$rettype = 'gboolean' if $rettype eq 'void';
# Our function prototype for the headers $rettype = 'gboolean' if $rettype eq 'void';
(my $hrettype = $rettype) =~ s/ //g;
my $proto = "$hrettype $wrapped$funcname ($arglist);\n"; # Our function prototype for the headers
$proto =~ s/ +/ /g; (my $hrettype = $rettype) =~ s/ //g;
push @{$out->{protos}}, $proto; my $proto = "$hrettype $wrapped$funcname ($arglist);\n";
$proto =~ s/ +/ /g;
my $clist = $arglist; push @{$out->{protos}}, $proto;
my $padlen = length($wrapped) + length($funcname) + 2;
my $padding = ' ' x $padlen;
$clist =~ s/\t/$padding/eg;
if ($proc->{since}) { my $clist = $arglist;
$sincedesc = "\n *\n * Since: $proc->{since}"; my $padlen = length($wrapped) + length($funcname) + 2;
} my $padding = ' ' x $padlen;
$clist =~ s/\t/$padding/eg;
my $procdesc = ''; if ($proc->{since}) {
$sincedesc = "\n *\n * Since: $proc->{since}";
}
if ($proc->{deprecated}) { my $procdesc = '';
if ($proc->{deprecated} eq 'NONE') {
if ($proc->{blurb}) {
$procdesc = &desc_wrap($proc->{blurb}) . "\n *\n";
}
if ($proc->{help}) {
$procdesc .= &desc_wrap($proc->{help}) . "\n *\n";
}
$procdesc .= &desc_wrap("Deprecated: There is no replacement " .
"for this procedure.");
}
else {
my $underscores = $proc->{deprecated};
$underscores =~ s/-/_/g;
if ($proc->{blurb}) { if ($proc->{deprecated}) {
$procdesc = &desc_wrap($proc->{blurb}) . "\n *\n"; if ($proc->{deprecated} eq 'NONE') {
} if ($proc->{blurb}) {
if ($proc->{help}) { $procdesc = &desc_wrap($proc->{blurb}) . "\n *\n";
$procdesc .= &desc_wrap($proc->{help}) . "\n *\n"; }
} if ($proc->{help}) {
$procdesc .= &desc_wrap("Deprecated: " . $procdesc .= &desc_wrap($proc->{help}) . "\n *\n";
"Use $underscores() instead."); }
} $procdesc .= &desc_wrap("Deprecated: There is no replacement " .
} "for this procedure.");
else { }
$procdesc = &desc_wrap($proc->{blurb}) . "\n *\n" . else {
&desc_wrap($proc->{help}); my $underscores = $proc->{deprecated};
} $underscores =~ s/-/_/g;
$out->{code} .= <<CODE; if ($proc->{blurb}) {
$procdesc = &desc_wrap($proc->{blurb}) . "\n *\n";
}
if ($proc->{help}) {
$procdesc .= &desc_wrap($proc->{help}) . "\n *\n";
}
$procdesc .= &desc_wrap("Deprecated: " .
"Use $underscores() instead.");
}
}
else {
$procdesc = &desc_wrap($proc->{blurb}) . "\n *\n" .
&desc_wrap($proc->{help});
}
return <<CODE;
/** /**
* $wrapped$funcname: * $wrapped$funcname:$func_annotations
$argdesc * $argdesc *
$procdesc $procdesc
* *
@ -560,6 +587,43 @@ $arg_array
$return_marshal $return_marshal
} }
CODE CODE
}
sub generate {
my @procs = @{(shift)};
my %out;
foreach $name (@procs) {
my $proc = $main::pdb{$name};
my $out = \%{$out{$proc->{group}}};
my @inargs = @{$proc->{inargs}} if (defined $proc->{inargs});
my @outargs = @{$proc->{outargs}} if (defined $proc->{outargs});
# Check if any of the argument or returned value is an image.
$has_image_arg = 0;
foreach (@outargs) {
my ($type, @typeinfo) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
if ($arg->{name} eq 'IMAGE') {
$has_image_arg = 1;
last;
}
}
unless ($has_image_arg) {
foreach (@inargs) {
my ($type, @typeinfo) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
if ($arg->{name} eq 'IMAGE') {
$has_image_arg = 1;
last;
}
}
}
$out->{code} .= generate_fun($proc, $out, 0);
if ($has_image_arg) {
$out->{code} .= generate_fun($proc, $out, 1);
}
} }
my $lgpl_top = <<'LGPL'; my $lgpl_top = <<'LGPL';

View File

@ -166,7 +166,8 @@ package Gimp::CodeGen::pdb;
init_value => 'NULL', init_value => 'NULL',
out_annotate => '(transfer full)', out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_image ($value, gimp)', get_value_func => '$var = gimp_value_get_image ($value, gimp)',
dup_value_func => '$var = gimp_image_new_by_id (g_value_get_int ($value))', dup_value_func => '$var = gimp_image_new_by_id (gimp_value_get_image_id ($value))',
dup_value_func_d=> '$var = gimp_value_get_image_id ($value)',
set_value_func => 'gimp_value_set_image_id ($value, gimp_image_get_id ($var))', set_value_func => 'gimp_value_set_image_id ($value, gimp_image_get_id ($var))',
take_value_func => 'gimp_value_set_image ($value, $var)', take_value_func => 'gimp_value_set_image ($value, $var)',
convert_func => 'gimp_image_get_id ($var)', convert_func => 'gimp_image_get_id ($var)',