2000-05-31 14:15:06 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2003-07-03 08:47:26 +08:00
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
2000-05-31 14:15:06 +08:00
|
|
|
*
|
|
|
|
* gimpdrawable_pdb.c
|
1998-01-25 18:26:47 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
1999-11-18 05:13:50 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1998-01-25 18:26:47 +08:00
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-18 06:28:01 +08:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2000-05-31 14:15:06 +08:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-06-01 22:59:22 +08:00
|
|
|
* Lesser General Public License for more details.
|
1998-01-25 18:26:47 +08:00
|
|
|
*
|
1999-11-18 05:13:50 +08:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-18 06:28:01 +08:00
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2000-05-31 14:15:06 +08:00
|
|
|
*/
|
|
|
|
|
2007-01-09 18:52:47 +08:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
2000-06-01 05:16:11 +08:00
|
|
|
|
2002-05-14 07:30:23 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
|
2010-07-07 17:43:10 +08:00
|
|
|
|
|
|
|
/**
|
2019-07-31 16:04:43 +08:00
|
|
|
* SECTION: gimpdrawable
|
2010-07-07 17:43:10 +08:00
|
|
|
* @title: gimpdrawable
|
|
|
|
* @short_description: Functions to manipulate drawables.
|
|
|
|
*
|
|
|
|
* Functions to manipulate drawables.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2012-04-25 03:45:35 +08:00
|
|
|
/**
|
|
|
|
* _gimp_drawable_get_format:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
*
|
|
|
|
* Returns the drawable's Babl format
|
|
|
|
*
|
|
|
|
* This procedure returns the drawable's Babl format.
|
2019-01-02 01:24:35 +08:00
|
|
|
* Note that the actual PDB procedure only transfers the format's
|
|
|
|
* encoding. In order to get to the real format, the libbgimp C wrapper
|
|
|
|
* must be used.
|
2012-04-25 03:45:35 +08:00
|
|
|
*
|
2019-07-31 18:54:51 +08:00
|
|
|
* Returns: (transfer full) The drawable's Babl format.
|
2012-04-25 03:45:35 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.10
|
2012-04-25 03:45:35 +08:00
|
|
|
**/
|
|
|
|
gchar *
|
|
|
|
_gimp_drawable_get_format (gint32 drawable_ID)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2012-04-25 03:45:35 +08:00
|
|
|
gchar *format = NULL;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-get-format",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2012-04-25 03:45:35 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
format = g_value_dup_string (gimp_value_array_index (return_vals, 1));
|
2012-04-25 03:45:35 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2012-04-25 03:45:35 +08:00
|
|
|
|
|
|
|
return format;
|
|
|
|
}
|
|
|
|
|
2019-07-10 21:10:03 +08:00
|
|
|
/**
|
|
|
|
* _gimp_drawable_get_thumbnail_format:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
*
|
|
|
|
* Returns the drawable's thumbnail Babl format
|
|
|
|
*
|
|
|
|
* This procedure returns the drawable's thumbnail Babl format.
|
|
|
|
* Thumbnails are always 8-bit images, see gimp_drawable_thumbnail()
|
|
|
|
* and gimp_drawable_sub_thmbnail().
|
|
|
|
*
|
2019-07-31 18:54:51 +08:00
|
|
|
* Returns: (transfer full) The drawable's thumbnail Babl format.
|
2019-07-10 21:10:03 +08:00
|
|
|
*
|
|
|
|
* Since: 2.10.14
|
|
|
|
**/
|
|
|
|
gchar *
|
|
|
|
_gimp_drawable_get_thumbnail_format (gint32 drawable_ID)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2019-07-10 21:10:03 +08:00
|
|
|
gchar *format = NULL;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-get-thumbnail-format",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2019-07-10 21:10:03 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
format = g_value_dup_string (gimp_value_array_index (return_vals, 1));
|
2019-07-10 21:10:03 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2019-07-10 21:10:03 +08:00
|
|
|
|
|
|
|
return format;
|
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
2003-12-09 01:26:55 +08:00
|
|
|
* gimp_drawable_type:
|
2000-08-25 07:06:53 +08:00
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
*
|
2003-12-09 01:26:55 +08:00
|
|
|
* Returns the drawable's type.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
2003-12-09 01:26:55 +08:00
|
|
|
* This procedure returns the drawable's type.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
2003-12-09 01:26:55 +08:00
|
|
|
* Returns: The drawable's type.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2003-12-09 01:26:55 +08:00
|
|
|
GimpImageType
|
|
|
|
gimp_drawable_type (gint32 drawable_ID)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2003-12-09 01:26:55 +08:00
|
|
|
GimpImageType type = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-type",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-12-09 01:26:55 +08:00
|
|
|
return type;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
2003-12-09 01:26:55 +08:00
|
|
|
* gimp_drawable_type_with_alpha:
|
2000-08-25 07:06:53 +08:00
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
*
|
2003-12-09 01:26:55 +08:00
|
|
|
* Returns the drawable's type with alpha.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
2004-11-27 02:16:48 +08:00
|
|
|
* This procedure returns the drawable's type as if had an alpha
|
|
|
|
* channel. If the type is currently Gray, for instance, the returned
|
2003-12-09 01:26:55 +08:00
|
|
|
* type would be GrayA. If the drawable already has an alpha channel,
|
|
|
|
* the drawable's type is simply returned.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
2003-12-09 01:26:55 +08:00
|
|
|
* Returns: The drawable's type with alpha.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2003-12-09 01:26:55 +08:00
|
|
|
GimpImageType
|
|
|
|
gimp_drawable_type_with_alpha (gint32 drawable_ID)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2003-12-09 01:26:55 +08:00
|
|
|
GimpImageType type_with_alpha = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-type-with-alpha",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
type_with_alpha = g_value_get_enum (gimp_value_array_index (return_vals, 1));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-12-09 01:26:55 +08:00
|
|
|
return type_with_alpha;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_has_alpha:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
*
|
2006-03-25 05:57:47 +08:00
|
|
|
* Returns TRUE if the drawable has an alpha channel.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
|
|
|
* This procedure returns whether the specified drawable has an alpha
|
|
|
|
* channel. This can only be true for layers, and the associated type
|
|
|
|
* will be one of: { RGBA , GRAYA, INDEXEDA }.
|
|
|
|
*
|
|
|
|
* Returns: Does the drawable have an alpha channel?
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-06-01 22:59:22 +08:00
|
|
|
gboolean
|
|
|
|
gimp_drawable_has_alpha (gint32 drawable_ID)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-06-23 04:06:02 +08:00
|
|
|
gboolean has_alpha = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-has-alpha",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
has_alpha = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-06-01 22:59:22 +08:00
|
|
|
return has_alpha;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_is_rgb:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
*
|
|
|
|
* Returns whether the drawable is an RGB type.
|
|
|
|
*
|
2006-03-25 05:57:47 +08:00
|
|
|
* This procedure returns TRUE if the specified drawable is of type {
|
|
|
|
* RGB, RGBA }.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
2006-03-25 05:57:47 +08:00
|
|
|
* Returns: TRUE if the drawable is an RGB type.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-03-26 02:49:05 +08:00
|
|
|
gboolean
|
1999-10-25 04:49:09 +08:00
|
|
|
gimp_drawable_is_rgb (gint32 drawable_ID)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2001-01-15 05:11:52 +08:00
|
|
|
gboolean is_rgb = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-is-rgb",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
is_rgb = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-01-15 05:11:52 +08:00
|
|
|
return is_rgb;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_is_gray:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
*
|
|
|
|
* Returns whether the drawable is a grayscale type.
|
|
|
|
*
|
2006-03-25 05:57:47 +08:00
|
|
|
* This procedure returns TRUE if the specified drawable is of type {
|
|
|
|
* Gray, GrayA }.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
2006-03-25 05:57:47 +08:00
|
|
|
* Returns: TRUE if the drawable is a grayscale type.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-03-26 02:49:05 +08:00
|
|
|
gboolean
|
1999-10-17 08:07:55 +08:00
|
|
|
gimp_drawable_is_gray (gint32 drawable_ID)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2001-01-15 05:11:52 +08:00
|
|
|
gboolean is_gray = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-is-gray",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
is_gray = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-01-15 05:11:52 +08:00
|
|
|
return is_gray;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_is_indexed:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
*
|
|
|
|
* Returns whether the drawable is an indexed type.
|
|
|
|
*
|
2006-03-25 05:57:47 +08:00
|
|
|
* This procedure returns TRUE if the specified drawable is of type {
|
|
|
|
* Indexed, IndexedA }.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
2006-03-25 05:57:47 +08:00
|
|
|
* Returns: TRUE if the drawable is an indexed type.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-03-26 02:49:05 +08:00
|
|
|
gboolean
|
2000-06-01 22:59:22 +08:00
|
|
|
gimp_drawable_is_indexed (gint32 drawable_ID)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2001-01-15 05:11:52 +08:00
|
|
|
gboolean is_indexed = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-is-indexed",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
is_indexed = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-01-15 05:11:52 +08:00
|
|
|
return is_indexed;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
2003-12-05 22:51:11 +08:00
|
|
|
* gimp_drawable_bpp:
|
2000-08-25 07:06:53 +08:00
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
*
|
|
|
|
* Returns the bytes per pixel.
|
|
|
|
*
|
2019-07-20 07:53:31 +08:00
|
|
|
* This procedure returns the number of bytes per pixel.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
|
|
|
* Returns: Bytes per pixel.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-06-01 22:59:22 +08:00
|
|
|
gint
|
2003-12-05 22:51:11 +08:00
|
|
|
gimp_drawable_bpp (gint32 drawable_ID)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2003-12-05 22:51:11 +08:00
|
|
|
gint bpp = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-bpp",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
bpp = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-12-05 22:51:11 +08:00
|
|
|
return bpp;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_width:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
*
|
|
|
|
* Returns the width of the drawable.
|
|
|
|
*
|
|
|
|
* This procedure returns the specified drawable's width in pixels.
|
|
|
|
*
|
|
|
|
* Returns: Width of drawable.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-06-01 22:59:22 +08:00
|
|
|
gint
|
|
|
|
gimp_drawable_width (gint32 drawable_ID)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-06-01 22:59:22 +08:00
|
|
|
gint width = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-width",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
width = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-06-01 22:59:22 +08:00
|
|
|
return width;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_height:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
*
|
|
|
|
* Returns the height of the drawable.
|
|
|
|
*
|
|
|
|
* This procedure returns the specified drawable's height in pixels.
|
|
|
|
*
|
|
|
|
* Returns: Height of drawable.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-06-01 22:59:22 +08:00
|
|
|
gint
|
|
|
|
gimp_drawable_height (gint32 drawable_ID)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-06-01 22:59:22 +08:00
|
|
|
gint height = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-height",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
height = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-06-01 22:59:22 +08:00
|
|
|
return height;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_offsets:
|
|
|
|
* @drawable_ID: The drawable.
|
2019-07-31 19:12:46 +08:00
|
|
|
* @offset_x: (out) x offset of drawable.
|
|
|
|
* @offset_y: (out) y offset of drawable.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
|
|
|
* Returns the offsets for the drawable.
|
|
|
|
*
|
|
|
|
* This procedure returns the specified drawable's offsets. This only
|
|
|
|
* makes sense if the drawable is a layer since channels are anchored.
|
|
|
|
* The offsets of a channel will be returned as 0.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-08-23 09:44:59 +08:00
|
|
|
gboolean
|
2000-06-01 22:59:22 +08:00
|
|
|
gimp_drawable_offsets (gint32 drawable_ID,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint *offset_x,
|
|
|
|
gint *offset_y)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-08-23 09:44:59 +08:00
|
|
|
gboolean success = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-offsets",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-06-23 04:06:02 +08:00
|
|
|
*offset_x = 0;
|
|
|
|
*offset_y = 0;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
2000-08-23 09:44:59 +08:00
|
|
|
|
|
|
|
if (success)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
*offset_x = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
|
|
|
*offset_y = g_value_get_int (gimp_value_array_index (return_vals, 2));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2000-08-23 09:44:59 +08:00
|
|
|
|
|
|
|
return success;
|
2000-06-01 22:59:22 +08:00
|
|
|
}
|
|
|
|
|
2003-12-09 01:26:55 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_mask_bounds:
|
|
|
|
* @drawable_ID: The drawable.
|
2019-07-31 19:12:46 +08:00
|
|
|
* @x1: (out) x coordinate of the upper left corner of selection bounds.
|
|
|
|
* @y1: (out) y coordinate of the upper left corner of selection bounds.
|
|
|
|
* @x2: (out) x coordinate of the lower right corner of selection bounds.
|
|
|
|
* @y2: (out) y coordinate of the lower right corner of selection bounds.
|
2003-12-09 01:26:55 +08:00
|
|
|
*
|
|
|
|
* Find the bounding box of the current selection in relation to the
|
|
|
|
* specified drawable.
|
|
|
|
*
|
2004-10-20 07:32:01 +08:00
|
|
|
* This procedure returns whether there is a selection. If there is
|
2007-01-09 22:00:55 +08:00
|
|
|
* one, the upper left and lower right-hand corners of its bounding box
|
2003-12-09 01:26:55 +08:00
|
|
|
* are returned. These coordinates are specified relative to the
|
|
|
|
* drawable's origin, and bounded by the drawable's extents. Please
|
2007-01-09 22:00:55 +08:00
|
|
|
* note that the pixel specified by the lower right-hand coordinate of
|
2003-12-09 01:26:55 +08:00
|
|
|
* 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).
|
2004-10-20 07:32:01 +08:00
|
|
|
* Note that the returned boolean does NOT correspond with the returned
|
|
|
|
* region being empty or not, it always returns whether the selection
|
|
|
|
* is non_empty. See gimp_drawable_mask_intersect() for a boolean
|
|
|
|
* return value which is more useful in most cases.
|
2003-12-09 01:26:55 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE if there is a selection.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2003-12-09 01:26:55 +08:00
|
|
|
gboolean
|
|
|
|
gimp_drawable_mask_bounds (gint32 drawable_ID,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint *x1,
|
|
|
|
gint *y1,
|
|
|
|
gint *x2,
|
|
|
|
gint *y2)
|
2003-12-09 01:26:55 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2003-12-09 01:26:55 +08:00
|
|
|
gboolean non_empty = FALSE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-mask-bounds",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2003-12-09 01:26:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
2003-12-09 01:26:55 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
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));
|
2003-12-09 01:26:55 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2003-12-09 01:26:55 +08:00
|
|
|
|
|
|
|
return non_empty;
|
|
|
|
}
|
|
|
|
|
2004-10-20 07:32:01 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_mask_intersect:
|
|
|
|
* @drawable_ID: The drawable.
|
2019-07-31 19:12:46 +08:00
|
|
|
* @x: (out) x coordinate of the upper left corner of the intersection.
|
|
|
|
* @y: (out) y coordinate of the upper left corner of the intersection.
|
|
|
|
* @width: (out) width of the intersection.
|
|
|
|
* @height: (out) height of the intersection.
|
2004-10-20 07:32:01 +08:00
|
|
|
*
|
|
|
|
* Find the bounding box of the current selection in relation to the
|
|
|
|
* specified drawable.
|
|
|
|
*
|
|
|
|
* This procedure returns whether there is an intersection between the
|
|
|
|
* drawable and the selection. Unlike gimp_drawable_mask_bounds(), the
|
2013-09-14 09:12:26 +08:00
|
|
|
* intersection's bounds are returned as x, y, width, height.
|
|
|
|
* If there is no selection this function returns TRUE and the returned
|
|
|
|
* bounds are the extents of the whole drawable.
|
2004-10-20 07:32:01 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE if the returned area is not empty.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-10-20 07:32:01 +08:00
|
|
|
gboolean
|
|
|
|
gimp_drawable_mask_intersect (gint32 drawable_ID,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint *x,
|
|
|
|
gint *y,
|
|
|
|
gint *width,
|
|
|
|
gint *height)
|
2004-10-20 07:32:01 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-10-20 07:32:01 +08:00
|
|
|
gboolean non_empty = FALSE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-mask-intersect",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2004-10-20 07:32:01 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
2004-10-20 07:32:01 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
|
|
|
|
*x = g_value_get_int (gimp_value_array_index (return_vals, 2));
|
|
|
|
*y = g_value_get_int (gimp_value_array_index (return_vals, 3));
|
|
|
|
*width = g_value_get_int (gimp_value_array_index (return_vals, 4));
|
|
|
|
*height = g_value_get_int (gimp_value_array_index (return_vals, 5));
|
2004-10-20 07:32:01 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-10-20 07:32:01 +08:00
|
|
|
|
|
|
|
return non_empty;
|
|
|
|
}
|
|
|
|
|
2003-12-09 01:26:55 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_merge_shadow:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
* @undo: Push merge to undo stack?
|
|
|
|
*
|
|
|
|
* Merge the shadow buffer with the specified drawable.
|
|
|
|
*
|
2008-04-22 01:20:51 +08:00
|
|
|
* This procedure combines the contents of the drawable's shadow buffer
|
2006-09-14 01:56:40 +08:00
|
|
|
* (for temporary processing) with the specified drawable. The 'undo'
|
2003-12-09 01:26:55 +08:00
|
|
|
* parameter specifies whether to add an undo step for the operation.
|
|
|
|
* Requesting no undo is useful for such applications as 'auto-apply'.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2003-12-09 01:26:55 +08:00
|
|
|
gboolean
|
|
|
|
gimp_drawable_merge_shadow (gint32 drawable_ID,
|
2006-04-12 18:27:31 +08:00
|
|
|
gboolean undo)
|
2003-12-09 01:26:55 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2003-12-09 01:26:55 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_BOOLEAN,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
g_value_set_boolean (gimp_value_array_index (args, 1), undo);
|
2003-12-09 01:26:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-merge-shadow",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2003-12-09 01:26:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2003-12-09 01:26:55 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2008-04-22 01:20:51 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_free_shadow:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
*
|
|
|
|
* Free the specified drawable's shadow data (if it exists).
|
|
|
|
*
|
|
|
|
* This procedure is intended as a memory saving device. If any shadow
|
|
|
|
* memory has been allocated, it will be freed automatically when the
|
|
|
|
* drawable is removed from the image, or when the plug-in procedure
|
|
|
|
* which allocated it returns.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.6
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2008-04-22 01:20:51 +08:00
|
|
|
gboolean
|
|
|
|
gimp_drawable_free_shadow (gint32 drawable_ID)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2008-04-22 01:20:51 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-free-shadow",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2008-04-22 01:20:51 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
2008-04-22 01:20:51 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2008-04-22 01:20:51 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2003-12-09 01:26:55 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_update:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
* @x: x coordinate of upper left corner of update region.
|
|
|
|
* @y: y coordinate of upper left corner of update region.
|
|
|
|
* @width: Width of update region.
|
|
|
|
* @height: Height of update region.
|
|
|
|
*
|
|
|
|
* Update the specified region of the drawable.
|
|
|
|
*
|
|
|
|
* This procedure updates the specified region of the drawable. The (x,
|
|
|
|
* y) coordinate pair is relative to the drawable's origin, not to the
|
2004-11-27 19:25:36 +08:00
|
|
|
* image origin. Therefore, the entire drawable can be updated using
|
|
|
|
* (0, 0, width, height).
|
2003-12-09 01:26:55 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2003-12-09 01:26:55 +08:00
|
|
|
gboolean
|
|
|
|
gimp_drawable_update (gint32 drawable_ID,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2003-12-09 01:26:55 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2003-12-09 01:26:55 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 1), x);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 2), y);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 3), width);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 4), height);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-update",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2003-12-09 01:26:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
2003-12-09 01:26:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2003-12-09 01:26:55 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2003-12-04 00:39:32 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_get_pixel:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
* @x_coord: The x coordinate.
|
|
|
|
* @y_coord: The y coordinate.
|
2019-07-31 19:12:46 +08:00
|
|
|
* @num_channels: (out) The number of channels for the pixel.
|
2003-12-04 00:39:32 +08:00
|
|
|
*
|
|
|
|
* Gets the value of the pixel at the specified coordinates.
|
|
|
|
*
|
|
|
|
* This procedure gets the pixel value at the specified coordinates.
|
|
|
|
* The 'num_channels' argument must always be equal to the
|
|
|
|
* bytes-per-pixel value for the specified drawable.
|
|
|
|
*
|
2019-07-31 19:08:19 +08:00
|
|
|
* Returns: (element-type guint8) (transfer full) The pixel value.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2003-12-04 00:39:32 +08:00
|
|
|
guint8 *
|
|
|
|
gimp_drawable_get_pixel (gint32 drawable_ID,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint x_coord,
|
|
|
|
gint y_coord,
|
|
|
|
gint *num_channels)
|
2003-12-04 00:39:32 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2003-12-04 00:39:32 +08:00
|
|
|
guint8 *pixel = NULL;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 1), x_coord);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 2), y_coord);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-get-pixel",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2003-12-04 00:39:32 +08:00
|
|
|
|
|
|
|
*num_channels = 0;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
2003-12-04 00:39:32 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
*num_channels = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
|
|
|
pixel = gimp_value_dup_int8_array (gimp_value_array_index (return_vals, 2));
|
2003-12-04 00:39:32 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2003-12-04 00:39:32 +08:00
|
|
|
|
|
|
|
return pixel;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_drawable_set_pixel:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
* @x_coord: The x coordinate.
|
|
|
|
* @y_coord: The y coordinate.
|
|
|
|
* @num_channels: The number of channels for the pixel.
|
2019-08-01 01:08:01 +08:00
|
|
|
* @pixel: (array length=num_channels) (element-type guint8) The pixel value.
|
2003-12-04 00:39:32 +08:00
|
|
|
*
|
|
|
|
* Sets the value of the pixel at the specified coordinates.
|
|
|
|
*
|
|
|
|
* This procedure sets the pixel value at the specified coordinates.
|
|
|
|
* The 'num_channels' argument must always be equal to the
|
2005-03-03 19:10:37 +08:00
|
|
|
* bytes-per-pixel value for the specified drawable. Note that this
|
2003-12-04 00:39:32 +08:00
|
|
|
* function is not undoable, you should use it only on drawables you
|
|
|
|
* just created yourself.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2003-12-04 00:39:32 +08:00
|
|
|
gboolean
|
|
|
|
gimp_drawable_set_pixel (gint32 drawable_ID,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint x_coord,
|
|
|
|
gint y_coord,
|
|
|
|
gint num_channels,
|
|
|
|
const guint8 *pixel)
|
2003-12-04 00:39:32 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2003-12-04 00:39:32 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT8_ARRAY,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 1), x_coord);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 2), y_coord);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 3), num_channels);
|
|
|
|
gimp_value_set_int8_array (gimp_value_array_index (args, 4), pixel, num_channels);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-set-pixel",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2003-12-04 00:39:32 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
2003-12-04 00:39:32 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2003-12-04 00:39:32 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
2003-12-09 01:26:55 +08:00
|
|
|
* gimp_drawable_fill:
|
2000-08-25 07:06:53 +08:00
|
|
|
* @drawable_ID: The drawable.
|
2003-12-09 01:26:55 +08:00
|
|
|
* @fill_type: The type of fill.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
2003-12-09 01:26:55 +08:00
|
|
|
* Fill the drawable with the specified fill mode.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
2006-04-03 20:59:12 +08:00
|
|
|
* This procedure fills the drawable. If the fill mode is foreground
|
|
|
|
* the current foreground color is used. If the fill mode is
|
|
|
|
* background, the current background color is used. If the fill type
|
|
|
|
* is white, then white is used. Transparent fill only affects layers
|
|
|
|
* with an alpha channel, in which case the alpha channel is set to
|
|
|
|
* transparent. If the drawable has no alpha channel, it is filled to
|
2013-09-14 09:12:26 +08:00
|
|
|
* white. No fill leaves the drawable's contents undefined.
|
|
|
|
* This procedure is unlike gimp_edit_fill() or the bucket fill tool
|
|
|
|
* because it fills regardless of a selection. Its main purpose is to
|
|
|
|
* fill a newly created drawable before adding it to the image. This
|
|
|
|
* operation cannot be undone.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-08-23 09:44:59 +08:00
|
|
|
gboolean
|
2003-12-09 01:26:55 +08:00
|
|
|
gimp_drawable_fill (gint32 drawable_ID,
|
2006-04-12 18:27:31 +08:00
|
|
|
GimpFillType fill_type)
|
1999-06-24 07:01:14 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-08-23 09:44:59 +08:00
|
|
|
gboolean success = TRUE;
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
2019-07-31 00:45:10 +08:00
|
|
|
GIMP_TYPE_FILL_TYPE,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
g_value_set_enum (gimp_value_array_index (args, 1), fill_type);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-fill",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
2000-08-23 09:44:59 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2000-08-23 09:44:59 +08:00
|
|
|
|
|
|
|
return success;
|
1999-06-24 07:01:14 +08:00
|
|
|
}
|
2001-04-19 04:41:15 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_drawable_offset:
|
|
|
|
* @drawable_ID: The drawable to offset.
|
|
|
|
* @wrap_around: wrap image around or fill vacated regions.
|
|
|
|
* @fill_type: fill vacated regions of drawable with background or transparent.
|
|
|
|
* @offset_x: offset by this amount in X direction.
|
|
|
|
* @offset_y: offset by this amount in Y direction.
|
|
|
|
*
|
|
|
|
* Offset the drawable by the specified amounts in the X and Y
|
|
|
|
* directions
|
|
|
|
*
|
|
|
|
* This procedure offsets the specified drawable by the amounts
|
|
|
|
* specified by 'offset_x' and 'offset_y'. If 'wrap_around' is set to
|
|
|
|
* TRUE, then portions of the drawable which are offset out of bounds
|
|
|
|
* are wrapped around. Alternatively, the undefined regions of the
|
|
|
|
* drawable can be filled with transparency or the background color, as
|
2006-09-14 01:56:40 +08:00
|
|
|
* specified by the 'fill-type' parameter.
|
2001-04-19 04:41:15 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2001-04-19 04:41:15 +08:00
|
|
|
gboolean
|
|
|
|
gimp_drawable_offset (gint32 drawable_ID,
|
2006-04-12 18:27:31 +08:00
|
|
|
gboolean wrap_around,
|
|
|
|
GimpOffsetType fill_type,
|
|
|
|
gint offset_x,
|
|
|
|
gint offset_y)
|
2001-04-19 04:41:15 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2001-04-19 04:41:15 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_BOOLEAN,
|
2019-07-31 00:45:10 +08:00
|
|
|
GIMP_TYPE_OFFSET_TYPE,
|
2019-07-30 16:51:16 +08:00
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
g_value_set_boolean (gimp_value_array_index (args, 1), wrap_around);
|
|
|
|
g_value_set_enum (gimp_value_array_index (args, 2), fill_type);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 3), offset_x);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 4), offset_y);
|
2001-04-19 04:41:15 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-offset",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2001-04-19 04:41:15 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2001-04-19 04:41:15 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
2003-12-04 01:47:15 +08:00
|
|
|
|
|
|
|
/**
|
2003-12-09 01:26:55 +08:00
|
|
|
* _gimp_drawable_thumbnail:
|
|
|
|
* @drawable_ID: The drawable.
|
2006-03-15 23:00:01 +08:00
|
|
|
* @width: The requested thumbnail width.
|
|
|
|
* @height: The requested thumbnail height.
|
2019-07-31 19:12:46 +08:00
|
|
|
* @actual_width: (out) The previews width.
|
|
|
|
* @actual_height: (out) The previews height.
|
|
|
|
* @bpp: (out) The previews bpp.
|
|
|
|
* @thumbnail_data_count: (out) The number of bytes in thumbnail data.
|
|
|
|
* @thumbnail_data: (out) (element-type guint8) (transfer full) The thumbnail data.
|
2003-12-04 01:47:15 +08:00
|
|
|
*
|
2003-12-09 01:26:55 +08:00
|
|
|
* Get a thumbnail of a drawable.
|
2003-12-04 01:47:15 +08:00
|
|
|
*
|
2003-12-09 01:26:55 +08:00
|
|
|
* This function gets data from which a thumbnail of a drawable preview
|
2006-08-08 22:45:40 +08:00
|
|
|
* can be created. Maximum x or y dimension is 1024 pixels. The pixels
|
2004-09-10 17:30:06 +08:00
|
|
|
* are returned in RGB[A] or GRAY[A] format. The bpp return value gives
|
|
|
|
* the number of bytes in the image.
|
2003-12-04 01:47:15 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2003-12-04 01:47:15 +08:00
|
|
|
gboolean
|
2003-12-09 01:26:55 +08:00
|
|
|
_gimp_drawable_thumbnail (gint32 drawable_ID,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint *actual_width,
|
|
|
|
gint *actual_height,
|
|
|
|
gint *bpp,
|
|
|
|
gint *thumbnail_data_count,
|
|
|
|
guint8 **thumbnail_data)
|
2003-12-04 01:47:15 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2003-12-04 01:47:15 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 1), width);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 2), height);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-thumbnail",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2003-12-04 01:47:15 +08:00
|
|
|
|
2006-03-15 23:00:01 +08:00
|
|
|
*actual_width = 0;
|
|
|
|
*actual_height = 0;
|
2003-12-09 01:26:55 +08:00
|
|
|
*bpp = 0;
|
|
|
|
*thumbnail_data_count = 0;
|
|
|
|
*thumbnail_data = NULL;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
2003-12-04 01:47:15 +08:00
|
|
|
|
2003-12-09 01:26:55 +08:00
|
|
|
if (success)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
*actual_width = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
|
|
|
*actual_height = g_value_get_int (gimp_value_array_index (return_vals, 2));
|
|
|
|
*bpp = g_value_get_int (gimp_value_array_index (return_vals, 3));
|
|
|
|
*thumbnail_data_count = g_value_get_int (gimp_value_array_index (return_vals, 4));
|
|
|
|
*thumbnail_data = gimp_value_dup_int8_array (gimp_value_array_index (return_vals, 5));
|
2003-12-09 01:26:55 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2003-12-04 01:47:15 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
2004-12-14 07:36:17 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* _gimp_drawable_sub_thumbnail:
|
|
|
|
* @drawable_ID: The drawable.
|
|
|
|
* @src_x: The x coordinate of the area.
|
|
|
|
* @src_y: The y coordinate of the area.
|
|
|
|
* @src_width: The width of the area.
|
|
|
|
* @src_height: The height of the area.
|
|
|
|
* @dest_width: The thumbnail width.
|
|
|
|
* @dest_height: The thumbnail height.
|
2019-07-31 19:12:46 +08:00
|
|
|
* @width: (out) The previews width.
|
|
|
|
* @height: (out) The previews height.
|
|
|
|
* @bpp: (out) The previews bpp.
|
|
|
|
* @thumbnail_data_count: (out) The number of bytes in thumbnail data.
|
|
|
|
* @thumbnail_data: (out) (element-type guint8) (transfer full) The thumbnail data.
|
2004-12-14 07:36:17 +08:00
|
|
|
*
|
|
|
|
* Get a thumbnail of a sub-area of a drawable drawable.
|
|
|
|
*
|
|
|
|
* This function gets data from which a thumbnail of a drawable preview
|
2006-08-08 22:45:40 +08:00
|
|
|
* can be created. Maximum x or y dimension is 1024 pixels. The pixels
|
2004-12-14 07:36:17 +08:00
|
|
|
* are returned in RGB[A] or GRAY[A] format. The bpp return value gives
|
|
|
|
* the number of bytes in the image.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-12-14 07:36:17 +08:00
|
|
|
gboolean
|
|
|
|
_gimp_drawable_sub_thumbnail (gint32 drawable_ID,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint src_x,
|
|
|
|
gint src_y,
|
|
|
|
gint src_width,
|
|
|
|
gint src_height,
|
|
|
|
gint dest_width,
|
|
|
|
gint dest_height,
|
|
|
|
gint *width,
|
|
|
|
gint *height,
|
|
|
|
gint *bpp,
|
|
|
|
gint *thumbnail_data_count,
|
|
|
|
guint8 **thumbnail_data)
|
2004-12-14 07:36:17 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-12-14 07:36:17 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 1), src_x);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 2), src_y);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 3), src_width);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 4), src_height);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 5), dest_width);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 6), dest_height);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-sub-thumbnail",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2004-12-14 07:36:17 +08:00
|
|
|
|
|
|
|
*width = 0;
|
|
|
|
*height = 0;
|
|
|
|
*bpp = 0;
|
|
|
|
*thumbnail_data_count = 0;
|
|
|
|
*thumbnail_data = NULL;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
2004-12-14 07:36:17 +08:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
*width = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
|
|
|
*height = g_value_get_int (gimp_value_array_index (return_vals, 2));
|
|
|
|
*bpp = g_value_get_int (gimp_value_array_index (return_vals, 3));
|
|
|
|
*thumbnail_data_count = g_value_get_int (gimp_value_array_index (return_vals, 4));
|
|
|
|
*thumbnail_data = gimp_value_dup_int8_array (gimp_value_array_index (return_vals, 5));
|
2004-12-14 07:36:17 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-12-14 07:36:17 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
2005-07-10 06:44:26 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_drawable_foreground_extract:
|
|
|
|
* @drawable_ID: The drawable.
|
2005-07-29 10:35:12 +08:00
|
|
|
* @mode: The algorithm to use.
|
2005-07-10 06:44:26 +08:00
|
|
|
* @mask_ID: Tri-Map.
|
|
|
|
*
|
|
|
|
* Extract the foreground of a drawable using a given trimap.
|
|
|
|
*
|
|
|
|
* Image Segmentation by Uniform Color Clustering, see
|
2018-07-14 20:13:22 +08:00
|
|
|
* https://www.inf.fu-berlin.de/inst/pubs/tr-b-05-07.pdf
|
2005-07-10 06:44:26 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-07-10 06:44:26 +08:00
|
|
|
gboolean
|
2005-07-29 10:35:12 +08:00
|
|
|
gimp_drawable_foreground_extract (gint32 drawable_ID,
|
2006-04-12 18:27:31 +08:00
|
|
|
GimpForegroundExtractMode mode,
|
|
|
|
gint32 mask_ID)
|
2005-07-10 06:44:26 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-07-10 06:44:26 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_DRAWABLE_ID,
|
2019-07-31 00:45:10 +08:00
|
|
|
GIMP_TYPE_FOREGROUND_EXTRACT_MODE,
|
2019-07-30 16:51:16 +08:00
|
|
|
GIMP_TYPE_DRAWABLE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 0), drawable_ID);
|
|
|
|
g_value_set_enum (gimp_value_array_index (args, 1), mode);
|
|
|
|
gimp_value_set_drawable_id (gimp_value_array_index (args, 2), mask_ID);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-drawable-foreground-extract",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2005-07-10 06:44:26 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
2005-07-10 06:44:26 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-07-10 06:44:26 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|