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

  1. /* LIBGIMP - The GIMP Library
  2.  * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
  3.  *
  4.  * gimpbrushes_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_brushes_get_brush_data:
  28.  * @name: the brush name (\"\" means current active pattern).
  29.  * @opacity: The brush opacity.
  30.  * @spacing: The brush spacing.
  31.  * @paint_mode: The paint mode.
  32.  * @width: The brush width.
  33.  * @height: The brush height.
  34.  * @length: Length of brush mask data.
  35.  * @mask_data: The brush mask data.
  36.  *
  37.  * Retrieve information about the currently active brush (including
  38.  * data).
  39.  *
  40.  * This procedure retrieves information about the currently active
  41.  * brush. This includes the brush name, and the brush extents (width
  42.  * and height). It also returns the brush data.
  43.  *
  44.  * Returns: The brush name.
  45.  */
  46. gchar *
  47. gimp_brushes_get_brush_data (gchar                 *name,
  48.                  gdouble               *opacity,
  49.                  gint                  *spacing,
  50.                  GimpLayerModeEffects  *paint_mode,
  51.                  gint                  *width,
  52.                  gint                  *height,
  53.                  gint                  *length,
  54.                  guint8               **mask_data)
  55. {
  56.   GimpParam *return_vals;
  57.   gint nreturn_vals;
  58.   gchar *ret_name = NULL;
  59.  
  60.   return_vals = gimp_run_procedure ("gimp_brushes_get_brush_data",
  61.                     &nreturn_vals,
  62.                     GIMP_PDB_STRING, name,
  63.                     GIMP_PDB_END);
  64.  
  65.   *length = 0;
  66.  
  67.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  68.     {
  69.       ret_name = g_strdup (return_vals[1].data.d_string);
  70.       *opacity = return_vals[2].data.d_float;
  71.       *spacing = return_vals[3].data.d_int32;
  72.       *paint_mode = return_vals[4].data.d_int32;
  73.       *width = return_vals[5].data.d_int32;
  74.       *height = return_vals[6].data.d_int32;
  75.       *length = return_vals[7].data.d_int32;
  76.       *mask_data = g_new (guint8, *length);
  77.       memcpy (*mask_data, return_vals[8].data.d_int8array,
  78.           *length * sizeof (guint8));
  79.     }
  80.  
  81.   gimp_destroy_params (return_vals, nreturn_vals);
  82.  
  83.   return ret_name;
  84. }
  85.