home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / libgimp / gimppatterns_pdb.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-25  |  2.5 KB  |  79 lines

  1. /* LIBGIMP - The GIMP Library
  2.  * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
  3.  *
  4.  * gimppatterns_pdb.c
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Lesser General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public
  17.  * License along with this library; if not, write to the
  18.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.  * Boston, MA 02111-1307, USA.
  20.  */
  21.  
  22. /* NOTE: This file is autogenerated by pdbgen.pl */
  23.  
  24. #include "gimp.h"
  25.  
  26. /**
  27.  * gimp_patterns_get_pattern_data:
  28.  * @name: the pattern name (\"\" means current active pattern).
  29.  * @width: The pattern width.
  30.  * @height: The pattern height.
  31.  * @mask_bpp: Pattern bytes per pixel.
  32.  * @length: Length of pattern mask data.
  33.  * @mask_data: The pattern mask data.
  34.  *
  35.  * Retrieve information about the currently active pattern (including
  36.  * data).
  37.  *
  38.  * This procedure retrieves information about the currently active
  39.  * pattern. This includes the pattern name, and the pattern extents
  40.  * (width and height). It also returns the pattern data.
  41.  *
  42.  * Returns: The pattern name.
  43.  */
  44. gchar *
  45. gimp_patterns_get_pattern_data (gchar   *name,
  46.                 gint    *width,
  47.                 gint    *height,
  48.                 gint    *mask_bpp,
  49.                 gint    *length,
  50.                 guint8 **mask_data)
  51. {
  52.   GimpParam *return_vals;
  53.   gint nreturn_vals;
  54.   gchar *ret_name = NULL;
  55.  
  56.   return_vals = gimp_run_procedure ("gimp_patterns_get_pattern_data",
  57.                     &nreturn_vals,
  58.                     GIMP_PDB_STRING, name,
  59.                     GIMP_PDB_END);
  60.  
  61.   *length = 0;
  62.  
  63.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  64.     {
  65.       ret_name = g_strdup (return_vals[1].data.d_string);
  66.       *width = return_vals[2].data.d_int32;
  67.       *height = return_vals[3].data.d_int32;
  68.       *mask_bpp = return_vals[4].data.d_int32;
  69.       *length = return_vals[5].data.d_int32;
  70.       *mask_data = g_new (guint8, *length);
  71.       memcpy (*mask_data, return_vals[6].data.d_int8array,
  72.           *length * sizeof (guint8));
  73.     }
  74.  
  75.   gimp_destroy_params (return_vals, nreturn_vals);
  76.  
  77.   return ret_name;
  78. }
  79.