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

  1. /* LIBGIMP - The GIMP Library
  2.  * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
  3.  *
  4.  * gimpguides_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_image_add_hguide:
  28.  * @image_ID: The image.
  29.  * @yposition: The guide's y-offset from top of image.
  30.  *
  31.  * Add a horizontal guide to an image.
  32.  *
  33.  * This procedure adds a horizontal guide to an image. It takes the
  34.  * input image and the y-position of the new guide as parameters. It
  35.  * returns the guide ID of the new guide.
  36.  *
  37.  * Returns: The new guide.
  38.  */
  39. gint32
  40. gimp_image_add_hguide (gint32 image_ID,
  41.                gint   yposition)
  42. {
  43.   GimpParam *return_vals;
  44.   gint nreturn_vals;
  45.   gint32 guide_ID = -1;
  46.  
  47.   return_vals = gimp_run_procedure ("gimp_image_add_hguide",
  48.                     &nreturn_vals,
  49.                     GIMP_PDB_IMAGE, image_ID,
  50.                     GIMP_PDB_INT32, yposition,
  51.                     GIMP_PDB_END);
  52.  
  53.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  54.     guide_ID = return_vals[1].data.d_int32;
  55.  
  56.   gimp_destroy_params (return_vals, nreturn_vals);
  57.  
  58.   return guide_ID;
  59. }
  60.  
  61. /**
  62.  * gimp_image_add_vguide:
  63.  * @image_ID: The image.
  64.  * @xposition: The guide's x-offset from left of image.
  65.  *
  66.  * Add a vertical guide to an image.
  67.  *
  68.  * This procedure adds a vertical guide to an image. It takes the input
  69.  * image and the x-position of the new guide as parameters. It returns
  70.  * the guide ID of the new guide.
  71.  *
  72.  * Returns: The new guide.
  73.  */
  74. gint32
  75. gimp_image_add_vguide (gint32 image_ID,
  76.                gint   xposition)
  77. {
  78.   GimpParam *return_vals;
  79.   gint nreturn_vals;
  80.   gint32 guide_ID = -1;
  81.  
  82.   return_vals = gimp_run_procedure ("gimp_image_add_vguide",
  83.                     &nreturn_vals,
  84.                     GIMP_PDB_IMAGE, image_ID,
  85.                     GIMP_PDB_INT32, xposition,
  86.                     GIMP_PDB_END);
  87.  
  88.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  89.     guide_ID = return_vals[1].data.d_int32;
  90.  
  91.   gimp_destroy_params (return_vals, nreturn_vals);
  92.  
  93.   return guide_ID;
  94. }
  95.  
  96. /**
  97.  * gimp_image_delete_guide:
  98.  * @image_ID: The image.
  99.  * @guide_ID: The ID of the guide to be removed.
  100.  *
  101.  * Deletes a guide from an image.
  102.  *
  103.  * This procedure takes an image and a guide ID as input and removes
  104.  * the specified guide from the specified image.
  105.  *
  106.  * Returns: TRUE on success.
  107.  */
  108. gboolean
  109. gimp_image_delete_guide (gint32 image_ID,
  110.              gint32 guide_ID)
  111. {
  112.   GimpParam *return_vals;
  113.   gint nreturn_vals;
  114.   gboolean success = TRUE;
  115.  
  116.   return_vals = gimp_run_procedure ("gimp_image_delete_guide",
  117.                     &nreturn_vals,
  118.                     GIMP_PDB_IMAGE, image_ID,
  119.                     GIMP_PDB_INT32, guide_ID,
  120.                     GIMP_PDB_END);
  121.  
  122.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  123.  
  124.   gimp_destroy_params (return_vals, nreturn_vals);
  125.  
  126.   return success;
  127. }
  128.  
  129. /**
  130.  * gimp_image_find_next_guide:
  131.  * @image_ID: The image.
  132.  * @guide_ID: The ID of the current guide (0 if first invocation).
  133.  *
  134.  * Find next guide on an image.
  135.  *
  136.  * This procedure takes an image and a guide ID as input and finds the
  137.  * guide ID of the successor of the given guide ID in the image's guide
  138.  * list. If the supplied guide ID is 0, the procedure will return the
  139.  * first Guide. The procedure will return 0 if given the final guide ID
  140.  * as an argument or the image has no guides.
  141.  *
  142.  * Returns: The next guide's ID.
  143.  */
  144. gint32
  145. gimp_image_find_next_guide (gint32 image_ID,
  146.                 gint32 guide_ID)
  147. {
  148.   GimpParam *return_vals;
  149.   gint nreturn_vals;
  150.   gint32 next_guide_ID = -1;
  151.  
  152.   return_vals = gimp_run_procedure ("gimp_image_find_next_guide",
  153.                     &nreturn_vals,
  154.                     GIMP_PDB_IMAGE, image_ID,
  155.                     GIMP_PDB_INT32, guide_ID,
  156.                     GIMP_PDB_END);
  157.  
  158.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  159.     next_guide_ID = return_vals[1].data.d_int32;
  160.  
  161.   gimp_destroy_params (return_vals, nreturn_vals);
  162.  
  163.   return next_guide_ID;
  164. }
  165.  
  166. /**
  167.  * gimp_image_get_guide_orientation:
  168.  * @image_ID: The image.
  169.  * @guide_ID: The guide.
  170.  *
  171.  * Get orientation of a guide on an image.
  172.  *
  173.  * This procedure takes an image and a guide ID as input and returns
  174.  * the orientations of the guide.
  175.  *
  176.  * Returns: The guide's orientation.
  177.  */
  178. GimpOrientationType
  179. gimp_image_get_guide_orientation (gint32 image_ID,
  180.                   gint32 guide_ID)
  181. {
  182.   GimpParam *return_vals;
  183.   gint nreturn_vals;
  184.   GimpOrientationType orientation = GIMP_UNKNOWN;
  185.  
  186.   return_vals = gimp_run_procedure ("gimp_image_get_guide_orientation",
  187.                     &nreturn_vals,
  188.                     GIMP_PDB_IMAGE, image_ID,
  189.                     GIMP_PDB_INT32, guide_ID,
  190.                     GIMP_PDB_END);
  191.  
  192.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  193.     orientation = return_vals[1].data.d_int32;
  194.  
  195.   gimp_destroy_params (return_vals, nreturn_vals);
  196.  
  197.   return orientation;
  198. }
  199.  
  200. /**
  201.  * gimp_image_get_guide_position:
  202.  * @image_ID: The image.
  203.  * @guide_ID: The guide.
  204.  *
  205.  * Get position of a guide on an image.
  206.  *
  207.  * This procedure takes an image and a guide ID as input and returns
  208.  * the position of the guide relative to the top or left of the image.
  209.  *
  210.  * Returns: The guide's position relative to top or left of image.
  211.  */
  212. gint
  213. gimp_image_get_guide_position (gint32 image_ID,
  214.                    gint32 guide_ID)
  215. {
  216.   GimpParam *return_vals;
  217.   gint nreturn_vals;
  218.   gint position = -1;
  219.  
  220.   return_vals = gimp_run_procedure ("gimp_image_get_guide_position",
  221.                     &nreturn_vals,
  222.                     GIMP_PDB_IMAGE, image_ID,
  223.                     GIMP_PDB_INT32, guide_ID,
  224.                     GIMP_PDB_END);
  225.  
  226.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  227.     position = return_vals[1].data.d_int32;
  228.  
  229.   gimp_destroy_params (return_vals, nreturn_vals);
  230.  
  231.   return position;
  232. }
  233.