2000-06-01 05:16:11 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2003-07-03 08:47:26 +08:00
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
2000-06-01 05:16:11 +08:00
|
|
|
*
|
|
|
|
* gimppatterns_pdb.c
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2000-06-01 05:16:11 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* 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-06-01 05:16:11 +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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
2000-06-01 05:16:11 +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"
|
|
|
|
|
2001-03-18 20:51:37 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2000-06-01 05:16:11 +08:00
|
|
|
#include "gimp.h"
|
2006-11-01 02:33:44 +08:00
|
|
|
#undef GIMP_DISABLE_DEPRECATED
|
|
|
|
#undef __GIMP_PATTERNS_PDB_H__
|
|
|
|
#include "gimppatterns_pdb.h"
|
2000-06-01 05:16:11 +08:00
|
|
|
|
2010-07-07 17:43:10 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION: gimppatterns
|
|
|
|
* @title: gimppatterns
|
|
|
|
* @short_description: Functions relating to patterns.
|
|
|
|
*
|
|
|
|
* Functions relating to patterns.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2002-03-13 23:29:59 +08:00
|
|
|
/**
|
|
|
|
* gimp_patterns_refresh:
|
|
|
|
*
|
2003-12-08 19:58:45 +08:00
|
|
|
* Refresh current patterns. This function always succeeds.
|
2002-03-13 23:29:59 +08:00
|
|
|
*
|
|
|
|
* This procedure retrieves all patterns currently in the user's
|
2004-09-23 23:05:48 +08:00
|
|
|
* pattern path and updates all pattern dialogs accordingly.
|
2002-03-13 23:29:59 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2002-03-13 23:29:59 +08:00
|
|
|
gboolean
|
|
|
|
gimp_patterns_refresh (void)
|
|
|
|
{
|
|
|
|
GimpParam *return_vals;
|
|
|
|
gint nreturn_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2005-08-03 06:52:23 +08:00
|
|
|
return_vals = gimp_run_procedure ("gimp-patterns-refresh",
|
2006-04-12 18:27:31 +08:00
|
|
|
&nreturn_vals,
|
|
|
|
GIMP_PDB_END);
|
2002-03-13 23:29:59 +08:00
|
|
|
|
|
|
|
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
|
|
|
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_patterns_get_list:
|
2003-09-05 01:04:36 +08:00
|
|
|
* @filter: An optional regular expression used to filter the list.
|
2002-03-13 23:29:59 +08:00
|
|
|
* @num_patterns: The number of patterns in the pattern list.
|
|
|
|
*
|
|
|
|
* Retrieve a complete listing of the available patterns.
|
|
|
|
*
|
|
|
|
* This procedure returns a complete listing of available GIMP
|
|
|
|
* patterns. Each name returned can be used as input to the
|
2006-06-14 16:32:08 +08:00
|
|
|
* gimp_context_set_pattern().
|
2002-03-13 23:29:59 +08:00
|
|
|
*
|
|
|
|
* Returns: The list of pattern names.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2002-03-13 23:29:59 +08:00
|
|
|
gchar **
|
2003-09-05 01:04:36 +08:00
|
|
|
gimp_patterns_get_list (const gchar *filter,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint *num_patterns)
|
2002-03-13 23:29:59 +08:00
|
|
|
{
|
|
|
|
GimpParam *return_vals;
|
|
|
|
gint nreturn_vals;
|
|
|
|
gchar **pattern_list = NULL;
|
|
|
|
gint i;
|
|
|
|
|
2005-08-03 06:52:23 +08:00
|
|
|
return_vals = gimp_run_procedure ("gimp-patterns-get-list",
|
2006-04-12 18:27:31 +08:00
|
|
|
&nreturn_vals,
|
|
|
|
GIMP_PDB_STRING, filter,
|
|
|
|
GIMP_PDB_END);
|
2002-03-13 23:29:59 +08:00
|
|
|
|
|
|
|
*num_patterns = 0;
|
|
|
|
|
|
|
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
|
|
|
{
|
|
|
|
*num_patterns = return_vals[1].data.d_int32;
|
|
|
|
pattern_list = g_new (gchar *, *num_patterns);
|
|
|
|
for (i = 0; i < *num_patterns; i++)
|
2006-04-12 18:38:15 +08:00
|
|
|
pattern_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
|
2002-03-13 23:29:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
|
|
|
|
return pattern_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_patterns_get_pattern:
|
|
|
|
* @width: The pattern width.
|
|
|
|
* @height: The pattern height.
|
|
|
|
*
|
2010-07-13 05:11:56 +08:00
|
|
|
* Deprecated: Use gimp_context_get_pattern() instead.
|
2002-03-13 23:29:59 +08:00
|
|
|
*
|
|
|
|
* Returns: The pattern name.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2002-03-13 23:29:59 +08:00
|
|
|
gchar *
|
|
|
|
gimp_patterns_get_pattern (gint *width,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint *height)
|
2002-03-13 23:29:59 +08:00
|
|
|
{
|
|
|
|
GimpParam *return_vals;
|
|
|
|
gint nreturn_vals;
|
|
|
|
gchar *name = NULL;
|
|
|
|
|
2005-08-03 06:52:23 +08:00
|
|
|
return_vals = gimp_run_procedure ("gimp-patterns-get-pattern",
|
2006-04-12 18:27:31 +08:00
|
|
|
&nreturn_vals,
|
|
|
|
GIMP_PDB_END);
|
2002-03-13 23:29:59 +08:00
|
|
|
|
|
|
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
|
|
|
{
|
|
|
|
name = g_strdup (return_vals[1].data.d_string);
|
|
|
|
*width = return_vals[2].data.d_int32;
|
|
|
|
*height = return_vals[3].data.d_int32;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_patterns_get_pattern_data:
|
2003-12-08 19:58:45 +08:00
|
|
|
* @name: The pattern name (\"\" means currently active pattern).
|
2000-08-25 07:06:53 +08:00
|
|
|
* @width: The pattern width.
|
|
|
|
* @height: The pattern height.
|
|
|
|
* @mask_bpp: Pattern bytes per pixel.
|
|
|
|
* @length: Length of pattern mask data.
|
|
|
|
* @mask_data: The pattern mask data.
|
|
|
|
*
|
2010-07-13 05:11:56 +08:00
|
|
|
* Deprecated: Use gimp_pattern_get_pixels() instead.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
|
|
|
* Returns: The pattern name.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-06-01 05:16:11 +08:00
|
|
|
gchar *
|
2003-07-02 09:20:08 +08:00
|
|
|
gimp_patterns_get_pattern_data (const gchar *name,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint *width,
|
|
|
|
gint *height,
|
|
|
|
gint *mask_bpp,
|
|
|
|
gint *length,
|
|
|
|
guint8 **mask_data)
|
2000-06-01 05:16:11 +08:00
|
|
|
{
|
2000-08-03 09:35:28 +08:00
|
|
|
GimpParam *return_vals;
|
2000-06-01 05:16:11 +08:00
|
|
|
gint nreturn_vals;
|
2006-03-15 20:49:25 +08:00
|
|
|
gchar *actual_name = NULL;
|
2000-08-22 02:59:12 +08:00
|
|
|
|
2005-08-03 06:52:23 +08:00
|
|
|
return_vals = gimp_run_procedure ("gimp-patterns-get-pattern-data",
|
2006-04-12 18:27:31 +08:00
|
|
|
&nreturn_vals,
|
|
|
|
GIMP_PDB_STRING, name,
|
|
|
|
GIMP_PDB_END);
|
2000-06-01 05:16:11 +08:00
|
|
|
|
2000-08-22 02:59:12 +08:00
|
|
|
*length = 0;
|
|
|
|
|
2000-08-03 09:35:28 +08:00
|
|
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
2000-06-01 05:16:11 +08:00
|
|
|
{
|
2006-03-15 20:49:25 +08:00
|
|
|
actual_name = g_strdup (return_vals[1].data.d_string);
|
2000-06-01 05:16:11 +08:00
|
|
|
*width = return_vals[2].data.d_int32;
|
|
|
|
*height = return_vals[3].data.d_int32;
|
|
|
|
*mask_bpp = return_vals[4].data.d_int32;
|
2000-08-22 02:59:12 +08:00
|
|
|
*length = return_vals[5].data.d_int32;
|
|
|
|
*mask_data = g_new (guint8, *length);
|
2006-04-12 18:34:30 +08:00
|
|
|
memcpy (*mask_data,
|
|
|
|
return_vals[6].data.d_int8array,
|
|
|
|
*length * sizeof (guint8));
|
2000-06-01 05:16:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
|
2006-03-15 20:49:25 +08:00
|
|
|
return actual_name;
|
2000-06-01 05:16:11 +08:00
|
|
|
}
|