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

  1. /* LIBGIMP - The GIMP Library
  2.  * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
  3.  *
  4.  * gimptools_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_airbrush:
  28.  * @drawable_ID: The affected drawable.
  29.  * @pressure: The pressure of the airbrush strokes.
  30.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  31.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  32.  *
  33.  * Paint in the current brush with varying pressure. Paint application
  34.  * is time-dependent.
  35.  *
  36.  * This tool simulates the use of an airbrush. Paint pressure
  37.  * represents the relative intensity of the paint application. High
  38.  * pressure results in a thicker layer of paint while low pressure
  39.  * results in a thinner layer.
  40.  *
  41.  * Returns: TRUE on success.
  42.  */
  43. gboolean
  44. gimp_airbrush (gint32   drawable_ID,
  45.            gdouble  pressure,
  46.            gint     num_strokes,
  47.            gdouble *strokes)
  48. {
  49.   GimpParam *return_vals;
  50.   gint nreturn_vals;
  51.   gboolean success = TRUE;
  52.  
  53.   return_vals = gimp_run_procedure ("gimp_airbrush",
  54.                     &nreturn_vals,
  55.                     GIMP_PDB_DRAWABLE, drawable_ID,
  56.                     GIMP_PDB_FLOAT, pressure,
  57.                     GIMP_PDB_INT32, num_strokes,
  58.                     GIMP_PDB_FLOATARRAY, strokes,
  59.                     GIMP_PDB_END);
  60.  
  61.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  62.  
  63.   gimp_destroy_params (return_vals, nreturn_vals);
  64.  
  65.   return success;
  66. }
  67.  
  68. /**
  69.  * gimp_airbrush_default:
  70.  * @drawable_ID: The affected drawable.
  71.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  72.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  73.  *
  74.  * Paint in the current brush with varying pressure. Paint application
  75.  * is time-dependent.
  76.  *
  77.  * This tool simulates the use of an airbrush. It is similar to
  78.  * gimp_airbrush except that the pressure is derived from the airbrush
  79.  * tools options box. It the option has not been set the default for
  80.  * the option will be used.
  81.  *
  82.  * Returns: TRUE on success.
  83.  */
  84. gboolean
  85. gimp_airbrush_default (gint32   drawable_ID,
  86.                gint     num_strokes,
  87.                gdouble *strokes)
  88. {
  89.   GimpParam *return_vals;
  90.   gint nreturn_vals;
  91.   gboolean success = TRUE;
  92.  
  93.   return_vals = gimp_run_procedure ("gimp_airbrush_default",
  94.                     &nreturn_vals,
  95.                     GIMP_PDB_DRAWABLE, drawable_ID,
  96.                     GIMP_PDB_INT32, num_strokes,
  97.                     GIMP_PDB_FLOATARRAY, strokes,
  98.                     GIMP_PDB_END);
  99.  
  100.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  101.  
  102.   gimp_destroy_params (return_vals, nreturn_vals);
  103.  
  104.   return success;
  105. }
  106.  
  107. /**
  108.  * gimp_blend:
  109.  * @drawable_ID: The affected drawable.
  110.  * @blend_mode: The type of blend.
  111.  * @paint_mode: The paint application mode.
  112.  * @gradient_type: The type of gradient.
  113.  * @opacity: The opacity of the final blend.
  114.  * @offset: Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.
  115.  * @repeat: Repeat mode.
  116.  * @supersample: Do adaptive supersampling.
  117.  * @max_depth: Maximum recursion levels for supersampling.
  118.  * @threshold: Supersampling threshold.
  119.  * @x1: The x coordinate of this blend's starting point.
  120.  * @y1: The y coordinate of this blend's starting point.
  121.  * @x2: The x coordinate of this blend's ending point.
  122.  * @y2: The y coordinate of this blend's ending point.
  123.  *
  124.  * Blend between the starting and ending coordinates with the specified
  125.  * blend mode and gradient type.
  126.  *
  127.  * This tool requires information on the paint application mode, the
  128.  * blend mode, and the gradient type. It creates the specified variety
  129.  * of blend using the starting and ending coordinates as defined for
  130.  * each gradient type.
  131.  *
  132.  * Returns: TRUE on success.
  133.  */
  134. gboolean
  135. gimp_blend (gint32               drawable_ID,
  136.         GimpBlendMode        blend_mode,
  137.         GimpLayerModeEffects paint_mode,
  138.         GimpGradientType     gradient_type,
  139.         gdouble              opacity,
  140.         gdouble              offset,
  141.         GimpRepeatMode       repeat,
  142.         gboolean             supersample,
  143.         gint                 max_depth,
  144.         gdouble              threshold,
  145.         gdouble              x1,
  146.         gdouble              y1,
  147.         gdouble              x2,
  148.         gdouble              y2)
  149. {
  150.   GimpParam *return_vals;
  151.   gint nreturn_vals;
  152.   gboolean success = TRUE;
  153.  
  154.   return_vals = gimp_run_procedure ("gimp_blend",
  155.                     &nreturn_vals,
  156.                     GIMP_PDB_DRAWABLE, drawable_ID,
  157.                     GIMP_PDB_INT32, blend_mode,
  158.                     GIMP_PDB_INT32, paint_mode,
  159.                     GIMP_PDB_INT32, gradient_type,
  160.                     GIMP_PDB_FLOAT, opacity,
  161.                     GIMP_PDB_FLOAT, offset,
  162.                     GIMP_PDB_INT32, repeat,
  163.                     GIMP_PDB_INT32, supersample,
  164.                     GIMP_PDB_INT32, max_depth,
  165.                     GIMP_PDB_FLOAT, threshold,
  166.                     GIMP_PDB_FLOAT, x1,
  167.                     GIMP_PDB_FLOAT, y1,
  168.                     GIMP_PDB_FLOAT, x2,
  169.                     GIMP_PDB_FLOAT, y2,
  170.                     GIMP_PDB_END);
  171.  
  172.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  173.  
  174.   gimp_destroy_params (return_vals, nreturn_vals);
  175.  
  176.   return success;
  177. }
  178.  
  179. /**
  180.  * gimp_bucket_fill:
  181.  * @drawable_ID: The affected drawable.
  182.  * @fill_mode: The type of fill.
  183.  * @paint_mode: The paint application mode.
  184.  * @opacity: The opacity of the final bucket fill.
  185.  * @threshold: The threshold determines how extensive the seed fill will be. It's value is specified in terms of intensity levels . This parameter is only valid when there is no selection in the specified image.
  186.  * @sample_merged: Use the composite image, not the drawable.
  187.  * @x: The x coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.
  188.  * @y: The y coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.
  189.  *
  190.  * Fill the area specified either by the current selection if there is
  191.  * one, or by a seed fill starting at the specified coordinates.
  192.  *
  193.  * This tool requires information on the paint application mode, and
  194.  * the fill mode, which can either be in the foreground color, or in
  195.  * the currently active pattern. If there is no selection, a seed fill
  196.  * is executed at the specified coordinates and extends outward in
  197.  * keeping with the threshold parameter. If there is a selection in the
  198.  * target image, the threshold, sample merged, x, and y arguments are
  199.  * unused. If the sample_merged parameter is non-zero, the data of the
  200.  * composite image will be used instead of that for the specified
  201.  * drawable. This is equivalent to sampling for colors after merging
  202.  * all visible layers. In the case of merged sampling, the x,y
  203.  * coordinates are relative to the image's origin; otherwise, they are
  204.  * relative to the drawable's origin.
  205.  *
  206.  * Returns: TRUE on success.
  207.  */
  208. gboolean
  209. gimp_bucket_fill (gint32               drawable_ID,
  210.           GimpBucketFillMode   fill_mode,
  211.           GimpLayerModeEffects paint_mode,
  212.           gdouble              opacity,
  213.           gdouble              threshold,
  214.           gboolean             sample_merged,
  215.           gdouble              x,
  216.           gdouble              y)
  217. {
  218.   GimpParam *return_vals;
  219.   gint nreturn_vals;
  220.   gboolean success = TRUE;
  221.  
  222.   return_vals = gimp_run_procedure ("gimp_bucket_fill",
  223.                     &nreturn_vals,
  224.                     GIMP_PDB_DRAWABLE, drawable_ID,
  225.                     GIMP_PDB_INT32, fill_mode,
  226.                     GIMP_PDB_INT32, paint_mode,
  227.                     GIMP_PDB_FLOAT, opacity,
  228.                     GIMP_PDB_FLOAT, threshold,
  229.                     GIMP_PDB_INT32, sample_merged,
  230.                     GIMP_PDB_FLOAT, x,
  231.                     GIMP_PDB_FLOAT, y,
  232.                     GIMP_PDB_END);
  233.  
  234.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  235.  
  236.   gimp_destroy_params (return_vals, nreturn_vals);
  237.  
  238.   return success;
  239. }
  240.  
  241. /**
  242.  * gimp_by_color_select:
  243.  * @drawable_ID: The affected drawable.
  244.  * @red:
  245.  * @green:
  246.  * @blue: The color to select.
  247.  * @threshold: Threshold in intensity levels %%desc%%.
  248.  * @operation: The selection operation.
  249.  * @antialias: Antialiasing.
  250.  * @feather: Feather option for selections.
  251.  * @feather_radius: Radius for feather operation.
  252.  * @sample_merged: Use the composite image, not the drawable.
  253.  *
  254.  * Create a selection by selecting all pixels (in the specified
  255.  * drawable) with the same (or similar) color to that specified.
  256.  *
  257.  * This tool creates a selection over the specified image. A by-color
  258.  * selection is determined by the supplied color under the constraints
  259.  * of the specified threshold. Essentially, all pixels (in the
  260.  * drawable) that have color sufficiently close to the specified color
  261.  * (as determined by the threshold value) are included in the
  262.  * selection. The antialiasing parameter allows the final selection
  263.  * mask to contain intermediate values based on close misses to the
  264.  * threshold bar. Feathering can be enabled optionally and is
  265.  * controlled with the \"feather_radius\" parameter. If the
  266.  * sample_merged parameter is non-zero, the data of the composite image
  267.  * will be used instead of that for the specified drawable. This is
  268.  * equivalent to sampling for colors after merging all visible layers.
  269.  * In the case of a merged sampling, the supplied drawable is ignored.
  270.  *
  271.  * Returns: TRUE on success.
  272.  */
  273. gboolean
  274. gimp_by_color_select (gint32         drawable_ID,
  275.               guchar         red,
  276.               guchar         green,
  277.               guchar         blue,
  278.               gint           threshold,
  279.               GimpChannelOps operation,
  280.               gboolean       antialias,
  281.               gboolean       feather,
  282.               gdouble        feather_radius,
  283.               gboolean       sample_merged)
  284. {
  285.   GimpParam *return_vals;
  286.   gint nreturn_vals;
  287.   gboolean success = TRUE;
  288.   guchar color[3];
  289.  
  290.   color[0] = red;
  291.   color[1] = green;
  292.   color[2] = blue;
  293.  
  294.   return_vals = gimp_run_procedure ("gimp_by_color_select",
  295.                     &nreturn_vals,
  296.                     GIMP_PDB_DRAWABLE, drawable_ID,
  297.                     GIMP_PDB_COLOR, color,
  298.                     GIMP_PDB_INT32, threshold,
  299.                     GIMP_PDB_INT32, operation,
  300.                     GIMP_PDB_INT32, antialias,
  301.                     GIMP_PDB_INT32, feather,
  302.                     GIMP_PDB_FLOAT, feather_radius,
  303.                     GIMP_PDB_INT32, sample_merged,
  304.                     GIMP_PDB_END);
  305.  
  306.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  307.  
  308.   gimp_destroy_params (return_vals, nreturn_vals);
  309.  
  310.   return success;
  311. }
  312.  
  313. /**
  314.  * gimp_clone:
  315.  * @drawable_ID: The affected drawable.
  316.  * @src_drawable_ID: The source drawable.
  317.  * @clone_type: The type of clone.
  318.  * @src_x: The x coordinate in the source image.
  319.  * @src_y: The y coordinate in the source image.
  320.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  321.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  322.  *
  323.  * Clone from the source to the dest drawable using the current brush
  324.  *
  325.  * This tool clones (copies) from the source drawable starting at the
  326.  * specified source coordinates to the dest drawable. If the
  327.  * \"clone_type\" argument is set to PATTERN-CLONE, then the current
  328.  * pattern is used as the source and the \"src_drawable\" argument is
  329.  * ignored. Pattern cloning assumes a tileable pattern and mods the sum
  330.  * of the src coordinates and subsequent stroke offsets with the width
  331.  * and height of the pattern. For image cloning, if the sum of the src
  332.  * coordinates and subsequent stroke offsets exceeds the extents of the
  333.  * src drawable, then no paint is transferred. The clone tool is
  334.  * capable of transforming between any image types including
  335.  * RGB->Indexed--although converting from any type to indexed is
  336.  * significantly slower.
  337.  *
  338.  * Returns: TRUE on success.
  339.  */
  340. gboolean
  341. gimp_clone (gint32         drawable_ID,
  342.         gint32         src_drawable_ID,
  343.         GimpCloneType  clone_type,
  344.         gdouble        src_x,
  345.         gdouble        src_y,
  346.         gint           num_strokes,
  347.         gdouble       *strokes)
  348. {
  349.   GimpParam *return_vals;
  350.   gint nreturn_vals;
  351.   gboolean success = TRUE;
  352.  
  353.   return_vals = gimp_run_procedure ("gimp_clone",
  354.                     &nreturn_vals,
  355.                     GIMP_PDB_DRAWABLE, drawable_ID,
  356.                     GIMP_PDB_DRAWABLE, src_drawable_ID,
  357.                     GIMP_PDB_INT32, clone_type,
  358.                     GIMP_PDB_FLOAT, src_x,
  359.                     GIMP_PDB_FLOAT, src_y,
  360.                     GIMP_PDB_INT32, num_strokes,
  361.                     GIMP_PDB_FLOATARRAY, strokes,
  362.                     GIMP_PDB_END);
  363.  
  364.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  365.  
  366.   gimp_destroy_params (return_vals, nreturn_vals);
  367.  
  368.   return success;
  369. }
  370.  
  371. /**
  372.  * gimp_clone_default:
  373.  * @drawable_ID: The affected drawable.
  374.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  375.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  376.  *
  377.  * Clone from the source to the dest drawable using the current brush
  378.  *
  379.  * This tool clones (copies) from the source drawable starting at the
  380.  * specified source coordinates to the dest drawable. This function
  381.  * performs exactly the same as the gimp_clone function except that the
  382.  * tools arguments are obtained from the clones option dialog. It this
  383.  * dialog has not been activated then the dialogs default values will
  384.  * be used.
  385.  *
  386.  * Returns: TRUE on success.
  387.  */
  388. gboolean
  389. gimp_clone_default (gint32   drawable_ID,
  390.             gint     num_strokes,
  391.             gdouble *strokes)
  392. {
  393.   GimpParam *return_vals;
  394.   gint nreturn_vals;
  395.   gboolean success = TRUE;
  396.  
  397.   return_vals = gimp_run_procedure ("gimp_clone_default",
  398.                     &nreturn_vals,
  399.                     GIMP_PDB_DRAWABLE, drawable_ID,
  400.                     GIMP_PDB_INT32, num_strokes,
  401.                     GIMP_PDB_FLOATARRAY, strokes,
  402.                     GIMP_PDB_END);
  403.  
  404.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  405.  
  406.   gimp_destroy_params (return_vals, nreturn_vals);
  407.  
  408.   return success;
  409. }
  410.  
  411. /**
  412.  * gimp_color_picker:
  413.  * @image_ID: The image.
  414.  * @drawable_ID: The affected drawable.
  415.  * @x: x coordinate of upper-left corner of rectangle.
  416.  * @y: y coordinate of upper-left corner of rectangle.
  417.  * @sample_merged: Use the composite image, not the drawable.
  418.  * @sample_average: Average the color of all the pixels in a specified radius.
  419.  * @average_radius: The radius of pixels to average.
  420.  * @save_color: Save the color to the active palette.
  421.  * @red:
  422.  * @green:
  423.  * @blue: The return color.
  424.  *
  425.  * Determine the color at the given drawable coordinates
  426.  *
  427.  * This tool determines the color at the specified coordinates. The
  428.  * returned color is an RGB triplet even for grayscale and indexed
  429.  * drawables. If the coordinates lie outside of the extents of the
  430.  * specified drawable, then an error is returned. If the drawable has
  431.  * an alpha channel, the algorithm examines the alpha value of the
  432.  * drawable at the coordinates. If the alpha value is completely
  433.  * transparent (0), then an error is returned. If the sample_merged
  434.  * parameter is non-zero, the data of the composite image will be used
  435.  * instead of that for the specified drawable. This is equivalent to
  436.  * sampling for colors after merging all visible layers. In the case of
  437.  * a merged sampling, the supplied drawable is ignored.
  438.  *
  439.  * Returns: TRUE on success.
  440.  */
  441. gboolean
  442. gimp_color_picker (gint32    image_ID,
  443.            gint32    drawable_ID,
  444.            gdouble   x,
  445.            gdouble   y,
  446.            gboolean  sample_merged,
  447.            gboolean  sample_average,
  448.            gdouble   average_radius,
  449.            gboolean  save_color,
  450.            guchar   *red,
  451.            guchar   *green,
  452.            guchar   *blue)
  453. {
  454.   GimpParam *return_vals;
  455.   gint nreturn_vals;
  456.   gboolean success = TRUE;
  457.  
  458.   return_vals = gimp_run_procedure ("gimp_color_picker",
  459.                     &nreturn_vals,
  460.                     GIMP_PDB_IMAGE, image_ID,
  461.                     GIMP_PDB_DRAWABLE, drawable_ID,
  462.                     GIMP_PDB_FLOAT, x,
  463.                     GIMP_PDB_FLOAT, y,
  464.                     GIMP_PDB_INT32, sample_merged,
  465.                     GIMP_PDB_INT32, sample_average,
  466.                     GIMP_PDB_FLOAT, average_radius,
  467.                     GIMP_PDB_INT32, save_color,
  468.                     GIMP_PDB_END);
  469.  
  470.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  471.  
  472.   if (success)
  473.     {
  474.       *red = return_vals[1].data.d_color.red;
  475.       *green = return_vals[1].data.d_color.green;
  476.       *blue = return_vals[1].data.d_color.blue;
  477.     }
  478.  
  479.   gimp_destroy_params (return_vals, nreturn_vals);
  480.  
  481.   return success;
  482. }
  483.  
  484. /**
  485.  * gimp_convolve:
  486.  * @drawable_ID: The affected drawable.
  487.  * @pressure: The pressure.
  488.  * @convolve_type: Convolve type.
  489.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  490.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  491.  *
  492.  * Convolve (Blur, Sharpen) using the current brush.
  493.  *
  494.  * This tool convolves the specified drawable with either a sharpening
  495.  * or blurring kernel. The pressure parameter controls the magnitude of
  496.  * the operation. Like the paintbrush, this tool linearly interpolates
  497.  * between the specified stroke coordinates.
  498.  *
  499.  * Returns: TRUE on success.
  500.  */
  501. gboolean
  502. gimp_convolve (gint32            drawable_ID,
  503.            gdouble           pressure,
  504.            GimpConvolveType  convolve_type,
  505.            gint              num_strokes,
  506.            gdouble          *strokes)
  507. {
  508.   GimpParam *return_vals;
  509.   gint nreturn_vals;
  510.   gboolean success = TRUE;
  511.  
  512.   return_vals = gimp_run_procedure ("gimp_convolve",
  513.                     &nreturn_vals,
  514.                     GIMP_PDB_DRAWABLE, drawable_ID,
  515.                     GIMP_PDB_FLOAT, pressure,
  516.                     GIMP_PDB_INT32, convolve_type,
  517.                     GIMP_PDB_INT32, num_strokes,
  518.                     GIMP_PDB_FLOATARRAY, strokes,
  519.                     GIMP_PDB_END);
  520.  
  521.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  522.  
  523.   gimp_destroy_params (return_vals, nreturn_vals);
  524.  
  525.   return success;
  526. }
  527.  
  528. /**
  529.  * gimp_convolve_default:
  530.  * @drawable_ID: The affected drawable.
  531.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  532.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  533.  *
  534.  * Convolve (Blur, Sharpen) using the current brush.
  535.  *
  536.  * This tool convolves the specified drawable with either a sharpening
  537.  * or blurring kernel. This function performs exactly the same as the
  538.  * gimp_convolve function except that the tools arguments are obtained
  539.  * from the convolve option dialog. It this dialog has not been
  540.  * activated then the dialogs default values will be used.
  541.  *
  542.  * Returns: TRUE on success.
  543.  */
  544. gboolean
  545. gimp_convolve_default (gint32   drawable_ID,
  546.                gint     num_strokes,
  547.                gdouble *strokes)
  548. {
  549.   GimpParam *return_vals;
  550.   gint nreturn_vals;
  551.   gboolean success = TRUE;
  552.  
  553.   return_vals = gimp_run_procedure ("gimp_convolve_default",
  554.                     &nreturn_vals,
  555.                     GIMP_PDB_DRAWABLE, drawable_ID,
  556.                     GIMP_PDB_INT32, num_strokes,
  557.                     GIMP_PDB_FLOATARRAY, strokes,
  558.                     GIMP_PDB_END);
  559.  
  560.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  561.  
  562.   gimp_destroy_params (return_vals, nreturn_vals);
  563.  
  564.   return success;
  565. }
  566.  
  567. /**
  568.  * gimp_crop:
  569.  * @image_ID: The image.
  570.  * @new_width: New image width: (0 < new_width <= width).
  571.  * @new_height: New image height: (0 < new_height <= height).
  572.  * @offx: x offset: (0 <= offx <= (width - new_width)).
  573.  * @offy: y offset: (0 <= offy <= (height - new_height)).
  574.  *
  575.  * Crop the image to the specified extents.
  576.  *
  577.  * This procedure crops the image so that it's new width and height are
  578.  * equal to the supplied parameters. Offsets are also provided which
  579.  * describe the position of the previous image's content. All channels
  580.  * and layers within the image are cropped to the new image extents;
  581.  * this includes the image selection mask. If any parameters are out of
  582.  * range, an error is returned.
  583.  *
  584.  * Returns: TRUE on success.
  585.  */
  586. gboolean
  587. gimp_crop (gint32 image_ID,
  588.        gint   new_width,
  589.        gint   new_height,
  590.        gint   offx,
  591.        gint   offy)
  592. {
  593.   GimpParam *return_vals;
  594.   gint nreturn_vals;
  595.   gboolean success = TRUE;
  596.  
  597.   return_vals = gimp_run_procedure ("gimp_crop",
  598.                     &nreturn_vals,
  599.                     GIMP_PDB_IMAGE, image_ID,
  600.                     GIMP_PDB_INT32, new_width,
  601.                     GIMP_PDB_INT32, new_height,
  602.                     GIMP_PDB_INT32, offx,
  603.                     GIMP_PDB_INT32, offy,
  604.                     GIMP_PDB_END);
  605.  
  606.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  607.  
  608.   gimp_destroy_params (return_vals, nreturn_vals);
  609.  
  610.   return success;
  611. }
  612.  
  613. /**
  614.  * gimp_dodgeburn:
  615.  * @drawable_ID: The affected drawable.
  616.  * @exposure: The exposer of the strokes.
  617.  * @dodgeburn_type: The type either dodge or burn.
  618.  * @dodgeburn_mode: The mode.
  619.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  620.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  621.  *
  622.  * Dodgeburn image with varying exposure.
  623.  *
  624.  * Dodgebure. More details here later.
  625.  *
  626.  * Returns: TRUE on success.
  627.  */
  628. gboolean
  629. gimp_dodgeburn (gint32             drawable_ID,
  630.         gdouble            exposure,
  631.         GimpDodgeBurnType  dodgeburn_type,
  632.         GimpDodgeBurnMode  dodgeburn_mode,
  633.         gint               num_strokes,
  634.         gdouble           *strokes)
  635. {
  636.   GimpParam *return_vals;
  637.   gint nreturn_vals;
  638.   gboolean success = TRUE;
  639.  
  640.   return_vals = gimp_run_procedure ("gimp_dodgeburn",
  641.                     &nreturn_vals,
  642.                     GIMP_PDB_DRAWABLE, drawable_ID,
  643.                     GIMP_PDB_FLOAT, exposure,
  644.                     GIMP_PDB_INT32, dodgeburn_type,
  645.                     GIMP_PDB_INT32, dodgeburn_mode,
  646.                     GIMP_PDB_INT32, num_strokes,
  647.                     GIMP_PDB_FLOATARRAY, strokes,
  648.                     GIMP_PDB_END);
  649.  
  650.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  651.  
  652.   gimp_destroy_params (return_vals, nreturn_vals);
  653.  
  654.   return success;
  655. }
  656.  
  657. /**
  658.  * gimp_dodgeburn_default:
  659.  * @drawable_ID: The affected drawable.
  660.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  661.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  662.  *
  663.  * Dodgeburn image with varying exposure. This is the same as the
  664.  * gimp_dodgeburn function except that the exposure, type and mode are
  665.  * taken from the tools option dialog. If the dialog has not been
  666.  * activated then the defaults as used by the dialog will be used.
  667.  *
  668.  * Dodgebure. More details here later.
  669.  *
  670.  * Returns: TRUE on success.
  671.  */
  672. gboolean
  673. gimp_dodgeburn_default (gint32   drawable_ID,
  674.             gint     num_strokes,
  675.             gdouble *strokes)
  676. {
  677.   GimpParam *return_vals;
  678.   gint nreturn_vals;
  679.   gboolean success = TRUE;
  680.  
  681.   return_vals = gimp_run_procedure ("gimp_dodgeburn_default",
  682.                     &nreturn_vals,
  683.                     GIMP_PDB_DRAWABLE, drawable_ID,
  684.                     GIMP_PDB_INT32, num_strokes,
  685.                     GIMP_PDB_FLOATARRAY, strokes,
  686.                     GIMP_PDB_END);
  687.  
  688.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  689.  
  690.   gimp_destroy_params (return_vals, nreturn_vals);
  691.  
  692.   return success;
  693. }
  694.  
  695. /**
  696.  * gimp_ellipse_select:
  697.  * @image_ID: The image.
  698.  * @x: x coordinate of upper-left corner of ellipse bounding box.
  699.  * @y: y coordinate of upper-left corner of ellipse bounding box.
  700.  * @width: The width of the ellipse.
  701.  * @height: The height of the ellipse.
  702.  * @operation: The selection operation.
  703.  * @antialias: Antialiasing.
  704.  * @feather: Feather option for selections.
  705.  * @feather_radius: Radius for feather operation.
  706.  *
  707.  * Create an elliptical selection over the specified image.
  708.  *
  709.  * This tool creates an elliptical selection over the specified image.
  710.  * The elliptical region can be either added to, subtracted from, or
  711.  * replace the contents of the previous selection mask. If antialiasing
  712.  * is turned on, the edges of the elliptical region will contain
  713.  * intermediate values which give the appearance of a sharper, less
  714.  * pixelized edge. This should be set as TRUE most of the time. If the
  715.  * feather option is enabled, the resulting selection is blurred before
  716.  * combining. The blur is a gaussian blur with the specified feather
  717.  * radius.
  718.  *
  719.  * Returns: TRUE on success.
  720.  */
  721. gboolean
  722. gimp_ellipse_select (gint32         image_ID,
  723.              gdouble        x,
  724.              gdouble        y,
  725.              gdouble        width,
  726.              gdouble        height,
  727.              GimpChannelOps operation,
  728.              gboolean       antialias,
  729.              gboolean       feather,
  730.              gdouble        feather_radius)
  731. {
  732.   GimpParam *return_vals;
  733.   gint nreturn_vals;
  734.   gboolean success = TRUE;
  735.  
  736.   return_vals = gimp_run_procedure ("gimp_ellipse_select",
  737.                     &nreturn_vals,
  738.                     GIMP_PDB_IMAGE, image_ID,
  739.                     GIMP_PDB_FLOAT, x,
  740.                     GIMP_PDB_FLOAT, y,
  741.                     GIMP_PDB_FLOAT, width,
  742.                     GIMP_PDB_FLOAT, height,
  743.                     GIMP_PDB_INT32, operation,
  744.                     GIMP_PDB_INT32, antialias,
  745.                     GIMP_PDB_INT32, feather,
  746.                     GIMP_PDB_FLOAT, feather_radius,
  747.                     GIMP_PDB_END);
  748.  
  749.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  750.  
  751.   gimp_destroy_params (return_vals, nreturn_vals);
  752.  
  753.   return success;
  754. }
  755.  
  756. /**
  757.  * gimp_eraser:
  758.  * @drawable_ID: The affected drawable.
  759.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  760.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  761.  * @hardness: %%desc%%.
  762.  * @method: %%desc%%.
  763.  *
  764.  * Erase using the current brush.
  765.  *
  766.  * This tool erases using the current brush mask. If the specified
  767.  * drawable contains an alpha channel, then the erased pixels will
  768.  * become transparent. Otherwise, the eraser tool replaces the contents
  769.  * of the drawable with the background color. Like paintbrush, this
  770.  * tool linearly interpolates between the specified stroke coordinates.
  771.  *
  772.  * Returns: TRUE on success.
  773.  */
  774. gboolean
  775. gimp_eraser (gint32                    drawable_ID,
  776.          gint                      num_strokes,
  777.          gdouble                  *strokes,
  778.          GimpBrushApplicationMode  hardness,
  779.          GimpPaintApplicationMode  method)
  780. {
  781.   GimpParam *return_vals;
  782.   gint nreturn_vals;
  783.   gboolean success = TRUE;
  784.  
  785.   return_vals = gimp_run_procedure ("gimp_eraser",
  786.                     &nreturn_vals,
  787.                     GIMP_PDB_DRAWABLE, drawable_ID,
  788.                     GIMP_PDB_INT32, num_strokes,
  789.                     GIMP_PDB_FLOATARRAY, strokes,
  790.                     GIMP_PDB_INT32, hardness,
  791.                     GIMP_PDB_INT32, method,
  792.                     GIMP_PDB_END);
  793.  
  794.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  795.  
  796.   gimp_destroy_params (return_vals, nreturn_vals);
  797.  
  798.   return success;
  799. }
  800.  
  801. /**
  802.  * gimp_eraser_default:
  803.  * @drawable_ID: The affected drawable.
  804.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  805.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  806.  *
  807.  * Erase using the current brush.
  808.  *
  809.  * This tool erases using the current brush mask. This function
  810.  * performs exactly the same as the gimp_eraser function except that
  811.  * the tools arguments are obtained from the eraser option dialog. It
  812.  * this dialog has not been activated then the dialogs default values
  813.  * will be used.
  814.  *
  815.  * Returns: TRUE on success.
  816.  */
  817. gboolean
  818. gimp_eraser_default (gint32   drawable_ID,
  819.              gint     num_strokes,
  820.              gdouble *strokes)
  821. {
  822.   GimpParam *return_vals;
  823.   gint nreturn_vals;
  824.   gboolean success = TRUE;
  825.  
  826.   return_vals = gimp_run_procedure ("gimp_eraser_default",
  827.                     &nreturn_vals,
  828.                     GIMP_PDB_DRAWABLE, drawable_ID,
  829.                     GIMP_PDB_INT32, num_strokes,
  830.                     GIMP_PDB_FLOATARRAY, strokes,
  831.                     GIMP_PDB_END);
  832.  
  833.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  834.  
  835.   gimp_destroy_params (return_vals, nreturn_vals);
  836.  
  837.   return success;
  838. }
  839.  
  840. /**
  841.  * gimp_flip:
  842.  * @drawable_ID: The affected drawable.
  843.  * @flip_type: Type of flip.
  844.  *
  845.  * Flip the specified drawable about its center either vertically or
  846.  * horizontally.
  847.  *
  848.  * This tool flips the specified drawable if no selection exists. If a
  849.  * selection exists, the portion of the drawable which lies under the
  850.  * selection is cut from the drawable and made into a floating
  851.  * selection which is then flipd by the specified amount. The return
  852.  * value is the ID of the flipped drawable. If there was no selection,
  853.  * this will be equal to the drawable ID supplied as input. Otherwise,
  854.  * this will be the newly created and flipped drawable. The flip type
  855.  * parameter indicates whether the flip will be applied horizontally or
  856.  * vertically.
  857.  *
  858.  * Returns: The flipped drawable.
  859.  */
  860. gint32
  861. gimp_flip (gint32              drawable_ID,
  862.        GimpOrientationType flip_type)
  863. {
  864.   GimpParam *return_vals;
  865.   gint nreturn_vals;
  866.   gint32 ret_drawable_ID = -1;
  867.  
  868.   return_vals = gimp_run_procedure ("gimp_flip",
  869.                     &nreturn_vals,
  870.                     GIMP_PDB_DRAWABLE, drawable_ID,
  871.                     GIMP_PDB_INT32, flip_type,
  872.                     GIMP_PDB_END);
  873.  
  874.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  875.     ret_drawable_ID = return_vals[1].data.d_drawable;
  876.  
  877.   gimp_destroy_params (return_vals, nreturn_vals);
  878.  
  879.   return ret_drawable_ID;
  880. }
  881.  
  882. /**
  883.  * gimp_free_select:
  884.  * @image_ID: The image.
  885.  * @num_segs: Number of points (count 1 coordinate as two points).
  886.  * @segs: Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}.
  887.  * @operation: The selection operation.
  888.  * @antialias: Antialiasing.
  889.  * @feather: Feather option for selections.
  890.  * @feather_radius: Radius for feather operation.
  891.  *
  892.  * Create a polygonal selection over the specified image.
  893.  *
  894.  * This tool creates a polygonal selection over the specified image.
  895.  * The polygonal region can be either added to, subtracted from, or
  896.  * replace the contents of the previous selection mask. The polygon is
  897.  * specified through an array of floating point numbers and its length.
  898.  * The length of array must be 2n, where n is the number of points.
  899.  * Each point is defined by 2 floating point values which correspond to
  900.  * the x and y coordinates. If the final point does not connect to the
  901.  * starting point, a connecting segment is automatically added. If the
  902.  * feather option is enabled, the resulting selection is blurred before
  903.  * combining. The blur is a gaussian blur with the specified feather
  904.  * radius.
  905.  *
  906.  * Returns: TRUE on success.
  907.  */
  908. gboolean
  909. gimp_free_select (gint32          image_ID,
  910.           gint            num_segs,
  911.           gdouble        *segs,
  912.           GimpChannelOps  operation,
  913.           gboolean        antialias,
  914.           gboolean        feather,
  915.           gdouble         feather_radius)
  916. {
  917.   GimpParam *return_vals;
  918.   gint nreturn_vals;
  919.   gboolean success = TRUE;
  920.  
  921.   return_vals = gimp_run_procedure ("gimp_free_select",
  922.                     &nreturn_vals,
  923.                     GIMP_PDB_IMAGE, image_ID,
  924.                     GIMP_PDB_INT32, num_segs,
  925.                     GIMP_PDB_FLOATARRAY, segs,
  926.                     GIMP_PDB_INT32, operation,
  927.                     GIMP_PDB_INT32, antialias,
  928.                     GIMP_PDB_INT32, feather,
  929.                     GIMP_PDB_FLOAT, feather_radius,
  930.                     GIMP_PDB_END);
  931.  
  932.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  933.  
  934.   gimp_destroy_params (return_vals, nreturn_vals);
  935.  
  936.   return success;
  937. }
  938.  
  939. /**
  940.  * gimp_fuzzy_select:
  941.  * @drawable_ID: The affected drawable.
  942.  * @x: x coordinate of initial seed fill point: (image coordinates).
  943.  * @y: y coordinate of initial seed fill point: (image coordinates).
  944.  * @threshold: Threshold in intensity levels %%desc%%.
  945.  * @operation: The selection operation.
  946.  * @antialias: Antialiasing.
  947.  * @feather: Feather option for selections.
  948.  * @feather_radius: Radius for feather operation.
  949.  * @sample_merged: Use the composite image, not the drawable.
  950.  *
  951.  * Create a fuzzy selection starting at the specified coordinates on
  952.  * the specified drawable.
  953.  *
  954.  * This tool creates a fuzzy selection over the specified image. A
  955.  * fuzzy selection is determined by a seed fill under the constraints
  956.  * of the specified threshold. Essentially, the color at the specified
  957.  * coordinates (in the drawable) is measured and the selection expands
  958.  * outwards from that point to any adjacent pixels which are not
  959.  * significantly different (as determined by the threshold value). This
  960.  * process continues until no more expansion is possible. The
  961.  * antialiasing parameter allows the final selection mask to contain
  962.  * intermediate values based on close misses to the threshold bar at
  963.  * pixels along the seed fill boundary. Feathering can be enabled
  964.  * optionally and is controlled with the \"feather_radius\" paramter.
  965.  * If the sample_merged parameter is non-zero, the data of the
  966.  * composite image will be used instead of that for the specified
  967.  * drawable. This is equivalent to sampling for colors after merging
  968.  * all visible layers. In the case of a merged sampling, the supplied
  969.  * drawable is ignored. If the sample is merged, the specified
  970.  * coordinates are relative to the image origin; otherwise, they are
  971.  * relative to the drawable's origin.
  972.  *
  973.  * Returns: TRUE on success.
  974.  */
  975. gboolean
  976. gimp_fuzzy_select (gint32         drawable_ID,
  977.            gdouble        x,
  978.            gdouble        y,
  979.            gint           threshold,
  980.            GimpChannelOps operation,
  981.            gboolean       antialias,
  982.            gboolean       feather,
  983.            gdouble        feather_radius,
  984.            gboolean       sample_merged)
  985. {
  986.   GimpParam *return_vals;
  987.   gint nreturn_vals;
  988.   gboolean success = TRUE;
  989.  
  990.   return_vals = gimp_run_procedure ("gimp_fuzzy_select",
  991.                     &nreturn_vals,
  992.                     GIMP_PDB_DRAWABLE, drawable_ID,
  993.                     GIMP_PDB_FLOAT, x,
  994.                     GIMP_PDB_FLOAT, y,
  995.                     GIMP_PDB_INT32, threshold,
  996.                     GIMP_PDB_INT32, operation,
  997.                     GIMP_PDB_INT32, antialias,
  998.                     GIMP_PDB_INT32, feather,
  999.                     GIMP_PDB_FLOAT, feather_radius,
  1000.                     GIMP_PDB_INT32, sample_merged,
  1001.                     GIMP_PDB_END);
  1002.  
  1003.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  1004.  
  1005.   gimp_destroy_params (return_vals, nreturn_vals);
  1006.  
  1007.   return success;
  1008. }
  1009.  
  1010. /**
  1011.  * gimp_paintbrush:
  1012.  * @drawable_ID: The affected drawable.
  1013.  * @fade_out: Fade out parameter.
  1014.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  1015.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  1016.  * @method: %%desc%%.
  1017.  * @gradient_length: Length of gradient to draw.
  1018.  *
  1019.  * Paint in the current brush with optional fade out parameter and pull
  1020.  * colors from a gradient.
  1021.  *
  1022.  * This tool is the standard paintbrush. It draws linearly interpolated
  1023.  * lines through the specified stroke coordinates. It operates on the
  1024.  * specified drawable in the foreground color with the active brush.
  1025.  * The \"fade_out\" parameter is measured in pixels and allows the
  1026.  * brush stroke to linearly fall off. The pressure is set to the
  1027.  * maximum at the beginning of the stroke. As the distance of the
  1028.  * stroke nears the fade_out value, the pressure will approach zero.
  1029.  * The gradient_length is the distance to spread the gradient over. It
  1030.  * is measured in pixels. If the gradient_length is 0, no gradient is
  1031.  * used.
  1032.  *
  1033.  * Returns: TRUE on success.
  1034.  */
  1035. gboolean
  1036. gimp_paintbrush (gint32                    drawable_ID,
  1037.          gdouble                   fade_out,
  1038.          gint                      num_strokes,
  1039.          gdouble                  *strokes,
  1040.          GimpPaintApplicationMode  method,
  1041.          gdouble                   gradient_length)
  1042. {
  1043.   GimpParam *return_vals;
  1044.   gint nreturn_vals;
  1045.   gboolean success = TRUE;
  1046.  
  1047.   return_vals = gimp_run_procedure ("gimp_paintbrush",
  1048.                     &nreturn_vals,
  1049.                     GIMP_PDB_DRAWABLE, drawable_ID,
  1050.                     GIMP_PDB_FLOAT, fade_out,
  1051.                     GIMP_PDB_INT32, num_strokes,
  1052.                     GIMP_PDB_FLOATARRAY, strokes,
  1053.                     GIMP_PDB_INT32, method,
  1054.                     GIMP_PDB_FLOAT, gradient_length,
  1055.                     GIMP_PDB_END);
  1056.  
  1057.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  1058.  
  1059.   gimp_destroy_params (return_vals, nreturn_vals);
  1060.  
  1061.   return success;
  1062. }
  1063.  
  1064. /**
  1065.  * gimp_paintbrush_default:
  1066.  * @drawable_ID: The affected drawable.
  1067.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  1068.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  1069.  *
  1070.  * Paint in the current brush. The fade out parameter and pull colors
  1071.  * from a gradient parameter are set from the paintbrush options
  1072.  * dialog. If this dialog has not been activated then the dialog
  1073.  * defaults will be used.
  1074.  *
  1075.  * This tool is similar to the standard paintbrush. It draws linearly
  1076.  * interpolated lines through the specified stroke coordinates. It
  1077.  * operates on the specified drawable in the foreground color with the
  1078.  * active brush. The \"fade_out\" parameter is measured in pixels and
  1079.  * allows the brush stroke to linearly fall off (value obtained from
  1080.  * the option dialog). The pressure is set to the maximum at the
  1081.  * beginning of the stroke. As the distance of the stroke nears the
  1082.  * fade_out value, the pressure will approach zero. The gradient_length
  1083.  * (value obtained from the option dialog) is the distance to spread
  1084.  * the gradient over. It is measured in pixels. If the gradient_length
  1085.  * is 0, no gradient is used.
  1086.  *
  1087.  * Returns: TRUE on success.
  1088.  */
  1089. gboolean
  1090. gimp_paintbrush_default (gint32   drawable_ID,
  1091.              gint     num_strokes,
  1092.              gdouble *strokes)
  1093. {
  1094.   GimpParam *return_vals;
  1095.   gint nreturn_vals;
  1096.   gboolean success = TRUE;
  1097.  
  1098.   return_vals = gimp_run_procedure ("gimp_paintbrush_default",
  1099.                     &nreturn_vals,
  1100.                     GIMP_PDB_DRAWABLE, drawable_ID,
  1101.                     GIMP_PDB_INT32, num_strokes,
  1102.                     GIMP_PDB_FLOATARRAY, strokes,
  1103.                     GIMP_PDB_END);
  1104.  
  1105.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  1106.  
  1107.   gimp_destroy_params (return_vals, nreturn_vals);
  1108.  
  1109.   return success;
  1110. }
  1111.  
  1112. /**
  1113.  * gimp_pencil:
  1114.  * @drawable_ID: The affected drawable.
  1115.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  1116.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  1117.  *
  1118.  * Paint in the current brush without sub-pixel sampling.
  1119.  *
  1120.  * This tool is the standard pencil. It draws linearly interpolated
  1121.  * lines through the specified stroke coordinates. It operates on the
  1122.  * specified drawable in the foreground color with the active brush.
  1123.  * The brush mask is treated as though it contains only black and white
  1124.  * values. Any value below half is treated as black; any above half, as
  1125.  * white.
  1126.  *
  1127.  * Returns: TRUE on success.
  1128.  */
  1129. gboolean
  1130. gimp_pencil (gint32   drawable_ID,
  1131.          gint     num_strokes,
  1132.          gdouble *strokes)
  1133. {
  1134.   GimpParam *return_vals;
  1135.   gint nreturn_vals;
  1136.   gboolean success = TRUE;
  1137.  
  1138.   return_vals = gimp_run_procedure ("gimp_pencil",
  1139.                     &nreturn_vals,
  1140.                     GIMP_PDB_DRAWABLE, drawable_ID,
  1141.                     GIMP_PDB_INT32, num_strokes,
  1142.                     GIMP_PDB_FLOATARRAY, strokes,
  1143.                     GIMP_PDB_END);
  1144.  
  1145.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  1146.  
  1147.   gimp_destroy_params (return_vals, nreturn_vals);
  1148.  
  1149.   return success;
  1150. }
  1151.  
  1152. /**
  1153.  * gimp_perspective:
  1154.  * @drawable_ID: The affected drawable.
  1155.  * @interpolation: Whether to use interpolation.
  1156.  * @x0: The new x coordinate of upper-left corner of original bounding box.
  1157.  * @y0: The new y coordinate of upper-left corner of original bounding box.
  1158.  * @x1: The new x coordinate of upper-right corner of original bounding box.
  1159.  * @y1: The new y coordinate of upper-right corner of original bounding box.
  1160.  * @x2: The new x coordinate of lower-left corner of original bounding box.
  1161.  * @y2: The new y coordinate of lower-left corner of original bounding box.
  1162.  * @x3: The new x coordinate of lower-right corner of original bounding box.
  1163.  * @y3: The new y coordinate of lower-right corner of original bounding box.
  1164.  *
  1165.  * Perform a possibly non-affine transformation on the specified
  1166.  * drawable.
  1167.  *
  1168.  * This tool performs a possibly non-affine transformation on the
  1169.  * specified drawable by allowing the corners of the original bounding
  1170.  * box to be arbitrarily remapped to any values. The specified drawable
  1171.  * is remapped if no selection exists. However, if a selection exists,
  1172.  * the portion of the drawable which lies under the selection is cut
  1173.  * from the drawable and made into a floating selection which is then
  1174.  * remapped as specified. The interpolation parameter can be set to
  1175.  * TRUE to indicate that either linear or cubic interpolation should be
  1176.  * used to smooth the resulting remapped drawable. The return value is
  1177.  * the ID of the remapped drawable. If there was no selection, this
  1178.  * will be equal to the drawable ID supplied as input. Otherwise, this
  1179.  * will be the newly created and remapped drawable. The 4 coordinates
  1180.  * specify the new locations of each corner of the original bounding
  1181.  * box. By specifying these values, any affine transformation
  1182.  * (rotation, scaling, translation) can be affected. Additionally,
  1183.  * these values can be specified such that the resulting transformed
  1184.  * drawable will appear to have been projected via a perspective
  1185.  * transform.
  1186.  *
  1187.  * Returns: The newly mapped drawable.
  1188.  */
  1189. gint32
  1190. gimp_perspective (gint32   drawable_ID,
  1191.           gboolean interpolation,
  1192.           gdouble  x0,
  1193.           gdouble  y0,
  1194.           gdouble  x1,
  1195.           gdouble  y1,
  1196.           gdouble  x2,
  1197.           gdouble  y2,
  1198.           gdouble  x3,
  1199.           gdouble  y3)
  1200. {
  1201.   GimpParam *return_vals;
  1202.   gint nreturn_vals;
  1203.   gint32 ret_drawable_ID = -1;
  1204.  
  1205.   return_vals = gimp_run_procedure ("gimp_perspective",
  1206.                     &nreturn_vals,
  1207.                     GIMP_PDB_DRAWABLE, drawable_ID,
  1208.                     GIMP_PDB_INT32, interpolation,
  1209.                     GIMP_PDB_FLOAT, x0,
  1210.                     GIMP_PDB_FLOAT, y0,
  1211.                     GIMP_PDB_FLOAT, x1,
  1212.                     GIMP_PDB_FLOAT, y1,
  1213.                     GIMP_PDB_FLOAT, x2,
  1214.                     GIMP_PDB_FLOAT, y2,
  1215.                     GIMP_PDB_FLOAT, x3,
  1216.                     GIMP_PDB_FLOAT, y3,
  1217.                     GIMP_PDB_END);
  1218.  
  1219.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  1220.     ret_drawable_ID = return_vals[1].data.d_drawable;
  1221.  
  1222.   gimp_destroy_params (return_vals, nreturn_vals);
  1223.  
  1224.   return ret_drawable_ID;
  1225. }
  1226.  
  1227. /**
  1228.  * gimp_rect_select:
  1229.  * @image_ID: The image.
  1230.  * @x: x coordinate of upper-left corner of rectangle.
  1231.  * @y: y coordinate of upper-left corner of rectangle.
  1232.  * @width: The width of the rectangle.
  1233.  * @height: The height of the rectangle.
  1234.  * @operation: The selection operation.
  1235.  * @feather: Feather option for selections.
  1236.  * @feather_radius: Radius for feather operation.
  1237.  *
  1238.  * Create a rectangular selection over the specified image;
  1239.  *
  1240.  * This tool creates a rectangular selection over the specified image.
  1241.  * The rectangular region can be either added to, subtracted from, or
  1242.  * replace the contents of the previous selection mask. If the feather
  1243.  * option is enabled, the resulting selection is blurred before
  1244.  * combining. The blur is a gaussian blur with the specified feather
  1245.  * radius.
  1246.  *
  1247.  * Returns: TRUE on success.
  1248.  */
  1249. gboolean
  1250. gimp_rect_select (gint32         image_ID,
  1251.           gdouble        x,
  1252.           gdouble        y,
  1253.           gdouble        width,
  1254.           gdouble        height,
  1255.           GimpChannelOps operation,
  1256.           gboolean       feather,
  1257.           gdouble        feather_radius)
  1258. {
  1259.   GimpParam *return_vals;
  1260.   gint nreturn_vals;
  1261.   gboolean success = TRUE;
  1262.  
  1263.   return_vals = gimp_run_procedure ("gimp_rect_select",
  1264.                     &nreturn_vals,
  1265.                     GIMP_PDB_IMAGE, image_ID,
  1266.                     GIMP_PDB_FLOAT, x,
  1267.                     GIMP_PDB_FLOAT, y,
  1268.                     GIMP_PDB_FLOAT, width,
  1269.                     GIMP_PDB_FLOAT, height,
  1270.                     GIMP_PDB_INT32, operation,
  1271.                     GIMP_PDB_INT32, feather,
  1272.                     GIMP_PDB_FLOAT, feather_radius,
  1273.                     GIMP_PDB_END);
  1274.  
  1275.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  1276.  
  1277.   gimp_destroy_params (return_vals, nreturn_vals);
  1278.  
  1279.   return success;
  1280. }
  1281.  
  1282. /**
  1283.  * gimp_rotate:
  1284.  * @drawable_ID: The affected drawable.
  1285.  * @interpolation: Whether to use interpolation.
  1286.  * @angle: The angle of rotation (radians).
  1287.  *
  1288.  * Rotate the specified drawable about its center through the specified
  1289.  * angle.
  1290.  *
  1291.  * This tool rotates the specified drawable if no selection exists. If
  1292.  * a selection exists, the portion of the drawable which lies under the
  1293.  * selection is cut from the drawable and made into a floating
  1294.  * selection which is then rotated by the specified amount. The
  1295.  * interpolation parameter can be set to TRUE to indicate that either
  1296.  * linear or cubic interpolation should be used to smooth the resulting
  1297.  * rotated drawable. The return value is the ID of the rotated
  1298.  * drawable. If there was no selection, this will be equal to the
  1299.  * drawable ID supplied as input. Otherwise, this will be the newly
  1300.  * created and rotated drawable.
  1301.  *
  1302.  * Returns: The rotated drawable.
  1303.  */
  1304. gint32
  1305. gimp_rotate (gint32   drawable_ID,
  1306.          gboolean interpolation,
  1307.          gdouble  angle)
  1308. {
  1309.   GimpParam *return_vals;
  1310.   gint nreturn_vals;
  1311.   gint32 ret_drawable_ID = -1;
  1312.  
  1313.   return_vals = gimp_run_procedure ("gimp_rotate",
  1314.                     &nreturn_vals,
  1315.                     GIMP_PDB_DRAWABLE, drawable_ID,
  1316.                     GIMP_PDB_INT32, interpolation,
  1317.                     GIMP_PDB_FLOAT, angle,
  1318.                     GIMP_PDB_END);
  1319.  
  1320.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  1321.     ret_drawable_ID = return_vals[1].data.d_drawable;
  1322.  
  1323.   gimp_destroy_params (return_vals, nreturn_vals);
  1324.  
  1325.   return ret_drawable_ID;
  1326. }
  1327.  
  1328. /**
  1329.  * gimp_scale:
  1330.  * @drawable_ID: The affected drawable.
  1331.  * @interpolation: Whether to use interpolation.
  1332.  * @x0: The new x coordinate of upper-left corner of newly scaled region.
  1333.  * @y0: The new y coordinate of upper-left corner of newly scaled region.
  1334.  * @x1: The new x coordinate of lower-right corner of newly scaled region.
  1335.  * @y1: The new y coordinate of lower-right corner of newly scaled region.
  1336.  *
  1337.  * Scale the specified drawable.
  1338.  *
  1339.  * This tool scales the specified drawable if no selection exists. If a
  1340.  * selection exists, the portion of the drawable which lies under the
  1341.  * selection is cut from the drawable and made into a floating
  1342.  * selection which is then scaled by the specified amount. The
  1343.  * interpolation parameter can be set to TRUE to indicate that either
  1344.  * linear or cubic interpolation should be used to smooth the resulting
  1345.  * scaled drawable. The return value is the ID of the scaled drawable.
  1346.  * If there was no selection, this will be equal to the drawable ID
  1347.  * supplied as input. Otherwise, this will be the newly created and
  1348.  * scaled drawable.
  1349.  *
  1350.  * Returns: The scaled drawable.
  1351.  */
  1352. gint32
  1353. gimp_scale (gint32   drawable_ID,
  1354.         gboolean interpolation,
  1355.         gdouble  x0,
  1356.         gdouble  y0,
  1357.         gdouble  x1,
  1358.         gdouble  y1)
  1359. {
  1360.   GimpParam *return_vals;
  1361.   gint nreturn_vals;
  1362.   gint32 ret_drawable_ID = -1;
  1363.  
  1364.   return_vals = gimp_run_procedure ("gimp_scale",
  1365.                     &nreturn_vals,
  1366.                     GIMP_PDB_DRAWABLE, drawable_ID,
  1367.                     GIMP_PDB_INT32, interpolation,
  1368.                     GIMP_PDB_FLOAT, x0,
  1369.                     GIMP_PDB_FLOAT, y0,
  1370.                     GIMP_PDB_FLOAT, x1,
  1371.                     GIMP_PDB_FLOAT, y1,
  1372.                     GIMP_PDB_END);
  1373.  
  1374.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  1375.     ret_drawable_ID = return_vals[1].data.d_drawable;
  1376.  
  1377.   gimp_destroy_params (return_vals, nreturn_vals);
  1378.  
  1379.   return ret_drawable_ID;
  1380. }
  1381.  
  1382. /**
  1383.  * gimp_shear:
  1384.  * @drawable_ID: The affected drawable.
  1385.  * @interpolation: Whether to use interpolation.
  1386.  * @shear_type: Type of shear.
  1387.  * @magnitude: The magnitude of the shear.
  1388.  *
  1389.  * Shear the specified drawable about its center by the specified
  1390.  * magnitude.
  1391.  *
  1392.  * This tool shears the specified drawable if no selection exists. If a
  1393.  * selection exists, the portion of the drawable which lies under the
  1394.  * selection is cut from the drawable and made into a floating
  1395.  * selection which is then sheard by the specified amount. The
  1396.  * interpolation parameter can be set to TRUE to indicate that either
  1397.  * linear or cubic interpolation should be used to smooth the resulting
  1398.  * sheared drawable. The return value is the ID of the sheard drawable.
  1399.  * If there was no selection, this will be equal to the drawable ID
  1400.  * supplied as input. Otherwise, this will be the newly created and
  1401.  * sheard drawable. The shear type parameter indicates whether the
  1402.  * shear will be applied horizontally or vertically. The magnitude can
  1403.  * be either positive or negative and indicates the extent (in pixels)
  1404.  * to shear by.
  1405.  *
  1406.  * Returns: The sheared drawable.
  1407.  */
  1408. gint32
  1409. gimp_shear (gint32              drawable_ID,
  1410.         gboolean            interpolation,
  1411.         GimpOrientationType shear_type,
  1412.         gdouble             magnitude)
  1413. {
  1414.   GimpParam *return_vals;
  1415.   gint nreturn_vals;
  1416.   gint32 ret_drawable_ID = -1;
  1417.  
  1418.   return_vals = gimp_run_procedure ("gimp_shear",
  1419.                     &nreturn_vals,
  1420.                     GIMP_PDB_DRAWABLE, drawable_ID,
  1421.                     GIMP_PDB_INT32, interpolation,
  1422.                     GIMP_PDB_INT32, shear_type,
  1423.                     GIMP_PDB_FLOAT, magnitude,
  1424.                     GIMP_PDB_END);
  1425.  
  1426.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  1427.     ret_drawable_ID = return_vals[1].data.d_drawable;
  1428.  
  1429.   gimp_destroy_params (return_vals, nreturn_vals);
  1430.  
  1431.   return ret_drawable_ID;
  1432. }
  1433.  
  1434. /**
  1435.  * gimp_smudge:
  1436.  * @drawable_ID: The affected drawable.
  1437.  * @pressure: The pressure of the smudge strokes.
  1438.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  1439.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  1440.  *
  1441.  * Smudge image with varying pressure.
  1442.  *
  1443.  * This tool simulates a smudge using the current brush. High pressure
  1444.  * results in a greater smudge of paint while low pressure results in a
  1445.  * lesser smudge.
  1446.  *
  1447.  * Returns: TRUE on success.
  1448.  */
  1449. gboolean
  1450. gimp_smudge (gint32   drawable_ID,
  1451.          gdouble  pressure,
  1452.          gint     num_strokes,
  1453.          gdouble *strokes)
  1454. {
  1455.   GimpParam *return_vals;
  1456.   gint nreturn_vals;
  1457.   gboolean success = TRUE;
  1458.  
  1459.   return_vals = gimp_run_procedure ("gimp_smudge",
  1460.                     &nreturn_vals,
  1461.                     GIMP_PDB_DRAWABLE, drawable_ID,
  1462.                     GIMP_PDB_FLOAT, pressure,
  1463.                     GIMP_PDB_INT32, num_strokes,
  1464.                     GIMP_PDB_FLOATARRAY, strokes,
  1465.                     GIMP_PDB_END);
  1466.  
  1467.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  1468.  
  1469.   gimp_destroy_params (return_vals, nreturn_vals);
  1470.  
  1471.   return success;
  1472. }
  1473.  
  1474. /**
  1475.  * gimp_smudge_default:
  1476.  * @drawable_ID: The affected drawable.
  1477.  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
  1478.  * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
  1479.  *
  1480.  * Smudge image with varying pressure.
  1481.  *
  1482.  * This tool simulates a smudge using the current brush. It behaves
  1483.  * exactly the same as gimp_smudge except that the pressure value is
  1484.  * taken from the smudge tool options or the options default if the
  1485.  * tools option dialog has not been activated.
  1486.  *
  1487.  * Returns: TRUE on success.
  1488.  */
  1489. gboolean
  1490. gimp_smudge_default (gint32   drawable_ID,
  1491.              gint     num_strokes,
  1492.              gdouble *strokes)
  1493. {
  1494.   GimpParam *return_vals;
  1495.   gint nreturn_vals;
  1496.   gboolean success = TRUE;
  1497.  
  1498.   return_vals = gimp_run_procedure ("gimp_smudge_default",
  1499.                     &nreturn_vals,
  1500.                     GIMP_PDB_DRAWABLE, drawable_ID,
  1501.                     GIMP_PDB_INT32, num_strokes,
  1502.                     GIMP_PDB_FLOATARRAY, strokes,
  1503.                     GIMP_PDB_END);
  1504.  
  1505.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  1506.  
  1507.   gimp_destroy_params (return_vals, nreturn_vals);
  1508.  
  1509.   return success;
  1510. }
  1511.  
  1512. /**
  1513.  * gimp_transform_2d:
  1514.  * @drawable_ID: The affected drawable.
  1515.  * @interpolation: Whether to use interpolation.
  1516.  * @source_x: X coordinate of the transformation center.
  1517.  * @source_y: Y coordinate of the transformation center.
  1518.  * @scale_x: Amount to scale in x direction.
  1519.  * @scale_y: Amount to scale in y direction.
  1520.  * @angle: The angle of rotation (radians).
  1521.  * @dest_x: X coordinate of where the centre goes.
  1522.  * @dest_y: Y coordinate of where the centre goes.
  1523.  *
  1524.  * Transform the specified drawable in 2d.
  1525.  *
  1526.  * This tool transforms the specified drawable if no selection exists.
  1527.  * If a selection exists, the portion of the drawable which lies under
  1528.  * the selection is cut from the drawable and made into a floating
  1529.  * selection which is then transformed. The interpolation parameter can
  1530.  * be set to TRUE to indicate that either linear or cubic interpolation
  1531.  * should be used to smooth the resulting drawable. The transformation
  1532.  * is done by scaling the image by the x and y scale factors about the
  1533.  * point (source_x, source_y), then rotating around the same point,
  1534.  * then translating that point to the new position (dest_x, dest_y).
  1535.  * The return value is the ID of the rotated drawable. If there was no
  1536.  * selection, this will be equal to the drawable ID supplied as input.
  1537.  * Otherwise, this will be the newly created and transformed drawable.
  1538.  *
  1539.  * Returns: The transformed drawable.
  1540.  */
  1541. gint32
  1542. gimp_transform_2d (gint32   drawable_ID,
  1543.            gboolean interpolation,
  1544.            gdouble  source_x,
  1545.            gdouble  source_y,
  1546.            gdouble  scale_x,
  1547.            gdouble  scale_y,
  1548.            gdouble  angle,
  1549.            gdouble  dest_x,
  1550.            gdouble  dest_y)
  1551. {
  1552.   GimpParam *return_vals;
  1553.   gint nreturn_vals;
  1554.   gint32 ret_drawable_ID = -1;
  1555.  
  1556.   return_vals = gimp_run_procedure ("gimp_transform_2d",
  1557.                     &nreturn_vals,
  1558.                     GIMP_PDB_DRAWABLE, drawable_ID,
  1559.                     GIMP_PDB_INT32, interpolation,
  1560.                     GIMP_PDB_FLOAT, source_x,
  1561.                     GIMP_PDB_FLOAT, source_y,
  1562.                     GIMP_PDB_FLOAT, scale_x,
  1563.                     GIMP_PDB_FLOAT, scale_y,
  1564.                     GIMP_PDB_FLOAT, angle,
  1565.                     GIMP_PDB_FLOAT, dest_x,
  1566.                     GIMP_PDB_FLOAT, dest_y,
  1567.                     GIMP_PDB_END);
  1568.  
  1569.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  1570.     ret_drawable_ID = return_vals[1].data.d_drawable;
  1571.  
  1572.   gimp_destroy_params (return_vals, nreturn_vals);
  1573.  
  1574.   return ret_drawable_ID;
  1575. }
  1576.