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

  1. /* LIBGIMP - The GIMP Library
  2.  * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
  3.  *
  4.  * gimpchannel_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_channel_new:
  28.  * @image_ID: The image to which to add the channel.
  29.  * @width: The channel width.
  30.  * @height: The channel height.
  31.  * @name: The channel name.
  32.  * @opacity: The channel opacity.
  33.  * @red:
  34.  * @green:
  35.  * @blue: The channel compositing color.
  36.  *
  37.  * Create a new channel.
  38.  *
  39.  * This procedure creates a new channel with the specified width and
  40.  * height. Name, opacity, and color are also supplied parameters. The
  41.  * new channel still needs to be added to the image, as this is not
  42.  * automatic. Add the new channel with the 'gimp_image_add_channel'
  43.  * command. Other attributes such as channel show masked, should be set
  44.  * with explicit procedure calls. The channel's contents are undefined
  45.  * initially.
  46.  *
  47.  * Returns: The newly created channel.
  48.  */
  49. gint32
  50. _gimp_channel_new (gint32   image_ID,
  51.            gint     width,
  52.            gint     height,
  53.            gchar   *name,
  54.            gdouble  opacity,
  55.            guchar   red,
  56.            guchar   green,
  57.            guchar   blue)
  58. {
  59.   GimpParam *return_vals;
  60.   gint nreturn_vals;
  61.   gint32 channel_ID = -1;
  62.   guchar color[3];
  63.  
  64.   color[0] = red;
  65.   color[1] = green;
  66.   color[2] = blue;
  67.  
  68.   return_vals = gimp_run_procedure ("gimp_channel_new",
  69.                     &nreturn_vals,
  70.                     GIMP_PDB_IMAGE, image_ID,
  71.                     GIMP_PDB_INT32, width,
  72.                     GIMP_PDB_INT32, height,
  73.                     GIMP_PDB_STRING, name,
  74.                     GIMP_PDB_FLOAT, opacity,
  75.                     GIMP_PDB_COLOR, color,
  76.                     GIMP_PDB_END);
  77.  
  78.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  79.     channel_ID = return_vals[1].data.d_channel;
  80.  
  81.   gimp_destroy_params (return_vals, nreturn_vals);
  82.  
  83.   return channel_ID;
  84. }
  85.  
  86. /**
  87.  * gimp_channel_copy:
  88.  * @channel_ID: The channel to copy.
  89.  *
  90.  * Copy a channel.
  91.  *
  92.  * This procedure copies the specified channel and returns the copy.
  93.  *
  94.  * Returns: The newly copied channel.
  95.  */
  96. gint32
  97. gimp_channel_copy (gint32 channel_ID)
  98. {
  99.   GimpParam *return_vals;
  100.   gint nreturn_vals;
  101.   gint32 channel_copy_ID = -1;
  102.  
  103.   return_vals = gimp_run_procedure ("gimp_channel_copy",
  104.                     &nreturn_vals,
  105.                     GIMP_PDB_CHANNEL, channel_ID,
  106.                     GIMP_PDB_END);
  107.  
  108.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  109.     channel_copy_ID = return_vals[1].data.d_channel;
  110.  
  111.   gimp_destroy_params (return_vals, nreturn_vals);
  112.  
  113.   return channel_copy_ID;
  114. }
  115.  
  116. /**
  117.  * gimp_channel_delete:
  118.  * @channel_ID: The channel to delete.
  119.  *
  120.  * Delete a channel.
  121.  *
  122.  * This procedure deletes the specified channel. This does not need to
  123.  * be done if a gimage containing this channel was already deleted.
  124.  *
  125.  * Returns: TRUE on success.
  126.  */
  127. gboolean
  128. gimp_channel_delete (gint32 channel_ID)
  129. {
  130.   GimpParam *return_vals;
  131.   gint nreturn_vals;
  132.   gboolean success = TRUE;
  133.  
  134.   return_vals = gimp_run_procedure ("gimp_channel_delete",
  135.                     &nreturn_vals,
  136.                     GIMP_PDB_CHANNEL, channel_ID,
  137.                     GIMP_PDB_END);
  138.  
  139.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  140.  
  141.   gimp_destroy_params (return_vals, nreturn_vals);
  142.  
  143.   return success;
  144. }
  145.  
  146. /**
  147.  * gimp_channel_get_name:
  148.  * @channel_ID: The channel.
  149.  *
  150.  * Get the name of the specified channel.
  151.  *
  152.  * This procedure returns the specified channel's name.
  153.  *
  154.  * Returns: The channel name.
  155.  */
  156. gchar *
  157. gimp_channel_get_name (gint32 channel_ID)
  158. {
  159.   GimpParam *return_vals;
  160.   gint nreturn_vals;
  161.   gchar *name = NULL;
  162.  
  163.   return_vals = gimp_run_procedure ("gimp_channel_get_name",
  164.                     &nreturn_vals,
  165.                     GIMP_PDB_CHANNEL, channel_ID,
  166.                     GIMP_PDB_END);
  167.  
  168.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  169.     name = g_strdup (return_vals[1].data.d_string);
  170.  
  171.   gimp_destroy_params (return_vals, nreturn_vals);
  172.  
  173.   return name;
  174. }
  175.  
  176. /**
  177.  * gimp_channel_set_name:
  178.  * @channel_ID: The channel.
  179.  * @name: The new channel name.
  180.  *
  181.  * Set the name of the specified channel.
  182.  *
  183.  * This procedure sets the specified channel's name.
  184.  *
  185.  * Returns: TRUE on success.
  186.  */
  187. gboolean
  188. gimp_channel_set_name (gint32  channel_ID,
  189.                gchar  *name)
  190. {
  191.   GimpParam *return_vals;
  192.   gint nreturn_vals;
  193.   gboolean success = TRUE;
  194.  
  195.   return_vals = gimp_run_procedure ("gimp_channel_set_name",
  196.                     &nreturn_vals,
  197.                     GIMP_PDB_CHANNEL, channel_ID,
  198.                     GIMP_PDB_STRING, name,
  199.                     GIMP_PDB_END);
  200.  
  201.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  202.  
  203.   gimp_destroy_params (return_vals, nreturn_vals);
  204.  
  205.   return success;
  206. }
  207.  
  208. /**
  209.  * gimp_channel_get_visible:
  210.  * @channel_ID: The channel.
  211.  *
  212.  * Get the visibility of the specified channel.
  213.  *
  214.  * This procedure returns the specified channel's visibility.
  215.  *
  216.  * Returns: The channel visibility.
  217.  */
  218. gboolean
  219. gimp_channel_get_visible (gint32 channel_ID)
  220. {
  221.   GimpParam *return_vals;
  222.   gint nreturn_vals;
  223.   gboolean visible = FALSE;
  224.  
  225.   return_vals = gimp_run_procedure ("gimp_channel_get_visible",
  226.                     &nreturn_vals,
  227.                     GIMP_PDB_CHANNEL, channel_ID,
  228.                     GIMP_PDB_END);
  229.  
  230.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  231.     visible = return_vals[1].data.d_int32;
  232.  
  233.   gimp_destroy_params (return_vals, nreturn_vals);
  234.  
  235.   return visible;
  236. }
  237.  
  238. /**
  239.  * gimp_channel_set_visible:
  240.  * @channel_ID: The channel.
  241.  * @visible: The new channel visibility.
  242.  *
  243.  * Set the visibility of the specified channel.
  244.  *
  245.  * This procedure sets the specified channel's visibility.
  246.  *
  247.  * Returns: TRUE on success.
  248.  */
  249. gboolean
  250. gimp_channel_set_visible (gint32   channel_ID,
  251.               gboolean visible)
  252. {
  253.   GimpParam *return_vals;
  254.   gint nreturn_vals;
  255.   gboolean success = TRUE;
  256.  
  257.   return_vals = gimp_run_procedure ("gimp_channel_set_visible",
  258.                     &nreturn_vals,
  259.                     GIMP_PDB_CHANNEL, channel_ID,
  260.                     GIMP_PDB_INT32, visible,
  261.                     GIMP_PDB_END);
  262.  
  263.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  264.  
  265.   gimp_destroy_params (return_vals, nreturn_vals);
  266.  
  267.   return success;
  268. }
  269.  
  270. /**
  271.  * gimp_channel_get_show_masked:
  272.  * @channel_ID: The channel.
  273.  *
  274.  * Get the composite method of the specified channel.
  275.  *
  276.  * This procedure returns the specified channel's composite method. If
  277.  * it is non-zero, then the channel is composited with the image so
  278.  * that masked regions are shown. Otherwise, selected regions are
  279.  * shown.
  280.  *
  281.  * Returns: The channel composite method.
  282.  */
  283. gboolean
  284. gimp_channel_get_show_masked (gint32 channel_ID)
  285. {
  286.   GimpParam *return_vals;
  287.   gint nreturn_vals;
  288.   gboolean show_masked = FALSE;
  289.  
  290.   return_vals = gimp_run_procedure ("gimp_channel_get_show_masked",
  291.                     &nreturn_vals,
  292.                     GIMP_PDB_CHANNEL, channel_ID,
  293.                     GIMP_PDB_END);
  294.  
  295.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  296.     show_masked = return_vals[1].data.d_int32;
  297.  
  298.   gimp_destroy_params (return_vals, nreturn_vals);
  299.  
  300.   return show_masked;
  301. }
  302.  
  303. /**
  304.  * gimp_channel_set_show_masked:
  305.  * @channel_ID: The channel.
  306.  * @show_masked: The new channel composite method.
  307.  *
  308.  * Set the composite method of the specified channel.
  309.  *
  310.  * This procedure sets the specified channel's composite method. If it
  311.  * is non-zero, then the channel is composited with the image so that
  312.  * masked regions are shown. Otherwise, selected regions are shown.
  313.  *
  314.  * Returns: TRUE on success.
  315.  */
  316. gboolean
  317. gimp_channel_set_show_masked (gint32   channel_ID,
  318.                   gboolean show_masked)
  319. {
  320.   GimpParam *return_vals;
  321.   gint nreturn_vals;
  322.   gboolean success = TRUE;
  323.  
  324.   return_vals = gimp_run_procedure ("gimp_channel_set_show_masked",
  325.                     &nreturn_vals,
  326.                     GIMP_PDB_CHANNEL, channel_ID,
  327.                     GIMP_PDB_INT32, show_masked,
  328.                     GIMP_PDB_END);
  329.  
  330.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  331.  
  332.   gimp_destroy_params (return_vals, nreturn_vals);
  333.  
  334.   return success;
  335. }
  336.  
  337. /**
  338.  * gimp_channel_get_opacity:
  339.  * @channel_ID: The channel.
  340.  *
  341.  * Get the opacity of the specified channel.
  342.  *
  343.  * This procedure returns the specified channel's opacity.
  344.  *
  345.  * Returns: The channel opacity.
  346.  */
  347. gdouble
  348. gimp_channel_get_opacity (gint32 channel_ID)
  349. {
  350.   GimpParam *return_vals;
  351.   gint nreturn_vals;
  352.   gdouble opacity = 0;
  353.  
  354.   return_vals = gimp_run_procedure ("gimp_channel_get_opacity",
  355.                     &nreturn_vals,
  356.                     GIMP_PDB_CHANNEL, channel_ID,
  357.                     GIMP_PDB_END);
  358.  
  359.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  360.     opacity = return_vals[1].data.d_float;
  361.  
  362.   gimp_destroy_params (return_vals, nreturn_vals);
  363.  
  364.   return opacity;
  365. }
  366.  
  367. /**
  368.  * gimp_channel_set_opacity:
  369.  * @channel_ID: The channel.
  370.  * @opacity: The new channel opacity.
  371.  *
  372.  * Set the opacity of the specified channel.
  373.  *
  374.  * This procedure sets the specified channel's opacity.
  375.  *
  376.  * Returns: TRUE on success.
  377.  */
  378. gboolean
  379. gimp_channel_set_opacity (gint32  channel_ID,
  380.               gdouble opacity)
  381. {
  382.   GimpParam *return_vals;
  383.   gint nreturn_vals;
  384.   gboolean success = TRUE;
  385.  
  386.   return_vals = gimp_run_procedure ("gimp_channel_set_opacity",
  387.                     &nreturn_vals,
  388.                     GIMP_PDB_CHANNEL, channel_ID,
  389.                     GIMP_PDB_FLOAT, opacity,
  390.                     GIMP_PDB_END);
  391.  
  392.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  393.  
  394.   gimp_destroy_params (return_vals, nreturn_vals);
  395.  
  396.   return success;
  397. }
  398.  
  399. /**
  400.  * gimp_channel_get_color:
  401.  * @channel_ID: The channel.
  402.  * @red:
  403.  * @green:
  404.  * @blue: The channel compositing color.
  405.  *
  406.  * Get the compositing color of the specified channel.
  407.  *
  408.  * This procedure returns the specified channel's compositing color.
  409.  *
  410.  * Returns: TRUE on success.
  411.  */
  412. gboolean
  413. gimp_channel_get_color (gint32  channel_ID,
  414.             guchar *red,
  415.             guchar *green,
  416.             guchar *blue)
  417. {
  418.   GimpParam *return_vals;
  419.   gint nreturn_vals;
  420.   gboolean success = TRUE;
  421.  
  422.   return_vals = gimp_run_procedure ("gimp_channel_get_color",
  423.                     &nreturn_vals,
  424.                     GIMP_PDB_CHANNEL, channel_ID,
  425.                     GIMP_PDB_END);
  426.  
  427.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  428.  
  429.   if (success)
  430.     {
  431.       *red = return_vals[1].data.d_color.red;
  432.       *green = return_vals[1].data.d_color.green;
  433.       *blue = return_vals[1].data.d_color.blue;
  434.     }
  435.  
  436.   gimp_destroy_params (return_vals, nreturn_vals);
  437.  
  438.   return success;
  439. }
  440.  
  441. /**
  442.  * gimp_channel_set_color:
  443.  * @channel_ID: The channel.
  444.  * @red:
  445.  * @green:
  446.  * @blue: The new channel compositing color.
  447.  *
  448.  * Set the compositing color of the specified channel.
  449.  *
  450.  * This procedure sets the specified channel's compositing color.
  451.  *
  452.  * Returns: TRUE on success.
  453.  */
  454. gboolean
  455. gimp_channel_set_color (gint32 channel_ID,
  456.             guchar red,
  457.             guchar green,
  458.             guchar blue)
  459. {
  460.   GimpParam *return_vals;
  461.   gint nreturn_vals;
  462.   gboolean success = TRUE;
  463.   guchar color[3];
  464.  
  465.   color[0] = red;
  466.   color[1] = green;
  467.   color[2] = blue;
  468.  
  469.   return_vals = gimp_run_procedure ("gimp_channel_set_color",
  470.                     &nreturn_vals,
  471.                     GIMP_PDB_CHANNEL, channel_ID,
  472.                     GIMP_PDB_COLOR, color,
  473.                     GIMP_PDB_END);
  474.  
  475.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  476.  
  477.   gimp_destroy_params (return_vals, nreturn_vals);
  478.  
  479.   return success;
  480. }
  481.  
  482. /**
  483.  * gimp_channel_get_tattoo:
  484.  * @channel_ID: The channel.
  485.  *
  486.  * Get the tattoo of the specified channel.
  487.  *
  488.  * This procedure returns the specified channel's tattoo. A tattoo is a
  489.  * unique and permanent identifier attached to a channel that can be
  490.  * used to uniquely identify a channel within an image even between
  491.  * sessions.
  492.  *
  493.  * Returns: The channel tattoo.
  494.  */
  495. gint
  496. gimp_channel_get_tattoo (gint32 channel_ID)
  497. {
  498.   GimpParam *return_vals;
  499.   gint nreturn_vals;
  500.   gint tattoo = 0;
  501.  
  502.   return_vals = gimp_run_procedure ("gimp_channel_get_tattoo",
  503.                     &nreturn_vals,
  504.                     GIMP_PDB_CHANNEL, channel_ID,
  505.                     GIMP_PDB_END);
  506.  
  507.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  508.     tattoo = return_vals[1].data.d_tattoo;
  509.  
  510.   gimp_destroy_params (return_vals, nreturn_vals);
  511.  
  512.   return tattoo;
  513. }
  514.  
  515. /**
  516.  * gimp_channel_set_tattoo:
  517.  * @channel_ID: The channel.
  518.  * @tattoo: The new channel tattoo.
  519.  *
  520.  * Set the tattoo of the specified channel.
  521.  *
  522.  * This procedure sets the specified channel's tattoo. A tattoo is a
  523.  * unique and permanent identifier attached to a channel that can be
  524.  * used to uniquely identify a channel within an image even between
  525.  * sessions.
  526.  *
  527.  * Returns: TRUE on success.
  528.  */
  529. gboolean
  530. gimp_channel_set_tattoo (gint32 channel_ID,
  531.              gint   tattoo)
  532. {
  533.   GimpParam *return_vals;
  534.   gint nreturn_vals;
  535.   gboolean success = TRUE;
  536.  
  537.   return_vals = gimp_run_procedure ("gimp_channel_set_tattoo",
  538.                     &nreturn_vals,
  539.                     GIMP_PDB_CHANNEL, channel_ID,
  540.                     GIMP_PDB_INT32, tattoo,
  541.                     GIMP_PDB_END);
  542.  
  543.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  544.  
  545.   gimp_destroy_params (return_vals, nreturn_vals);
  546.  
  547.   return success;
  548. }
  549.