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

  1. /* LIBGIMP - The GIMP Library
  2.  * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
  3.  *
  4.  * gimplayer_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_layer_new:
  28.  * @image_ID: The image to which to add the layer.
  29.  * @width: The layer width.
  30.  * @height: The layer height.
  31.  * @type: The layer type.
  32.  * @name: The layer name.
  33.  * @opacity: The layer opacity.
  34.  * @mode: The layer combination mode.
  35.  *
  36.  * Create a new layer.
  37.  *
  38.  * This procedure creates a new layer with the specified width, height,
  39.  * and type. Name, opacity, and mode are also supplied parameters. The
  40.  * new layer still needs to be added to the image, as this is not
  41.  * automatic. Add the new layer with the 'gimp_image_add_layer'
  42.  * command. Other attributes such as layer mask modes, and offsets
  43.  * should be set with explicit procedure calls.
  44.  *
  45.  * Returns: The newly created layer.
  46.  */
  47. gint32
  48. _gimp_layer_new (gint32                image_ID,
  49.          gint                  width,
  50.          gint                  height,
  51.          GimpImageType         type,
  52.          gchar                *name,
  53.          gdouble               opacity,
  54.          GimpLayerModeEffects  mode)
  55. {
  56.   GimpParam *return_vals;
  57.   gint nreturn_vals;
  58.   gint32 layer_ID = -1;
  59.  
  60.   return_vals = gimp_run_procedure ("gimp_layer_new",
  61.                     &nreturn_vals,
  62.                     GIMP_PDB_IMAGE, image_ID,
  63.                     GIMP_PDB_INT32, width,
  64.                     GIMP_PDB_INT32, height,
  65.                     GIMP_PDB_INT32, type,
  66.                     GIMP_PDB_STRING, name,
  67.                     GIMP_PDB_FLOAT, opacity,
  68.                     GIMP_PDB_INT32, mode,
  69.                     GIMP_PDB_END);
  70.  
  71.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  72.     layer_ID = return_vals[1].data.d_layer;
  73.  
  74.   gimp_destroy_params (return_vals, nreturn_vals);
  75.  
  76.   return layer_ID;
  77. }
  78.  
  79. /**
  80.  * _gimp_layer_copy:
  81.  * @layer_ID: The layer to copy.
  82.  * @add_alpha: Add an alpha channel to the copied layer.
  83.  *
  84.  * Copy a layer.
  85.  *
  86.  * This procedure copies the specified layer and returns the copy. The
  87.  * newly copied layer is for use within the original layer's image. It
  88.  * should not be subsequently added to any other image. The copied
  89.  * layer can optionally have an added alpha channel. This is useful if
  90.  * the background layer in an image is being copied and added to the
  91.  * same image.
  92.  *
  93.  * Returns: The newly copied layer.
  94.  */
  95. gint32
  96. _gimp_layer_copy (gint32   layer_ID,
  97.           gboolean add_alpha)
  98. {
  99.   GimpParam *return_vals;
  100.   gint nreturn_vals;
  101.   gint32 layer_copy_ID = -1;
  102.  
  103.   return_vals = gimp_run_procedure ("gimp_layer_copy",
  104.                     &nreturn_vals,
  105.                     GIMP_PDB_LAYER, layer_ID,
  106.                     GIMP_PDB_INT32, add_alpha,
  107.                     GIMP_PDB_END);
  108.  
  109.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  110.     layer_copy_ID = return_vals[1].data.d_layer;
  111.  
  112.   gimp_destroy_params (return_vals, nreturn_vals);
  113.  
  114.   return layer_copy_ID;
  115. }
  116.  
  117. /**
  118.  * gimp_layer_create_mask:
  119.  * @layer_ID: The layer to which to add the mask.
  120.  * @mask_type: The type of mask.
  121.  *
  122.  * Create a layer mask for the specified specified layer.
  123.  *
  124.  * This procedure creates a layer mask for the specified layer. Layer
  125.  * masks serve as an additional alpha channel for a layer. Three
  126.  * different types of masks are allowed initially: completely white
  127.  * masks (which will leave the layer fully visible), completely black
  128.  * masks (which will give the layer complete transparency, and the
  129.  * layer's already existing alpha channel (which will leave the layer
  130.  * fully visible, but which may be more useful than a white mask). The
  131.  * layer mask still needs to be added to the layer. This can be done
  132.  * with a call to 'gimage_add_layer_mask'.
  133.  *
  134.  * Returns: The newly created mask.
  135.  */
  136. gint32
  137. gimp_layer_create_mask (gint32          layer_ID,
  138.             GimpAddMaskType mask_type)
  139. {
  140.   GimpParam *return_vals;
  141.   gint nreturn_vals;
  142.   gint32 mask_ID = -1;
  143.  
  144.   return_vals = gimp_run_procedure ("gimp_layer_create_mask",
  145.                     &nreturn_vals,
  146.                     GIMP_PDB_LAYER, layer_ID,
  147.                     GIMP_PDB_INT32, mask_type,
  148.                     GIMP_PDB_END);
  149.  
  150.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  151.     mask_ID = return_vals[1].data.d_layer_mask;
  152.  
  153.   gimp_destroy_params (return_vals, nreturn_vals);
  154.  
  155.   return mask_ID;
  156. }
  157.  
  158. /**
  159.  * gimp_layer_scale:
  160.  * @layer_ID: The layer.
  161.  * @new_width: New layer width.
  162.  * @new_height: New layer height.
  163.  * @local_origin: Use a local origin (as opposed to the image origin).
  164.  *
  165.  * Scale the layer to the specified extents.
  166.  *
  167.  * This procedure scales the layer so that it's new width and height
  168.  * are equal to the supplied parameters. The \"local_origin\" parameter
  169.  * specifies whether to scale from the center of the layer, or from the
  170.  * image origin. This operation only works if the layer has been added
  171.  * to an image.
  172.  *
  173.  * Returns: TRUE on success.
  174.  */
  175. gboolean
  176. gimp_layer_scale (gint32   layer_ID,
  177.           gint     new_width,
  178.           gint     new_height,
  179.           gboolean local_origin)
  180. {
  181.   GimpParam *return_vals;
  182.   gint nreturn_vals;
  183.   gboolean success = TRUE;
  184.  
  185.   return_vals = gimp_run_procedure ("gimp_layer_scale",
  186.                     &nreturn_vals,
  187.                     GIMP_PDB_LAYER, layer_ID,
  188.                     GIMP_PDB_INT32, new_width,
  189.                     GIMP_PDB_INT32, new_height,
  190.                     GIMP_PDB_INT32, local_origin,
  191.                     GIMP_PDB_END);
  192.  
  193.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  194.  
  195.   gimp_destroy_params (return_vals, nreturn_vals);
  196.  
  197.   return success;
  198. }
  199.  
  200. /**
  201.  * gimp_layer_resize:
  202.  * @layer_ID: The layer.
  203.  * @new_width: New layer width.
  204.  * @new_height: New layer height.
  205.  * @offx: x offset between upper left corner of old and new layers: (new - old).
  206.  * @offy: y offset between upper left corner of old and new layers: (new - old).
  207.  *
  208.  * Resize the layer to the specified extents.
  209.  *
  210.  * This procedure resizes the layer so that it's new width and height
  211.  * are equal to the supplied parameters. Offsets are also provided
  212.  * which describe the position of the previous layer's content. This
  213.  * operation only works if the layer has been added to an image.
  214.  *
  215.  * Returns: TRUE on success.
  216.  */
  217. gboolean
  218. gimp_layer_resize (gint32 layer_ID,
  219.            gint   new_width,
  220.            gint   new_height,
  221.            gint   offx,
  222.            gint   offy)
  223. {
  224.   GimpParam *return_vals;
  225.   gint nreturn_vals;
  226.   gboolean success = TRUE;
  227.  
  228.   return_vals = gimp_run_procedure ("gimp_layer_resize",
  229.                     &nreturn_vals,
  230.                     GIMP_PDB_LAYER, layer_ID,
  231.                     GIMP_PDB_INT32, new_width,
  232.                     GIMP_PDB_INT32, new_height,
  233.                     GIMP_PDB_INT32, offx,
  234.                     GIMP_PDB_INT32, offy,
  235.                     GIMP_PDB_END);
  236.  
  237.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  238.  
  239.   gimp_destroy_params (return_vals, nreturn_vals);
  240.  
  241.   return success;
  242. }
  243.  
  244. /**
  245.  * gimp_layer_delete:
  246.  * @layer_ID: The layer to delete.
  247.  *
  248.  * Delete a layer.
  249.  *
  250.  * This procedure deletes the specified layer. This does not need to be
  251.  * done if a gimage containing this layer was already deleted.
  252.  *
  253.  * Returns: TRUE on success.
  254.  */
  255. gboolean
  256. gimp_layer_delete (gint32 layer_ID)
  257. {
  258.   GimpParam *return_vals;
  259.   gint nreturn_vals;
  260.   gboolean success = TRUE;
  261.  
  262.   return_vals = gimp_run_procedure ("gimp_layer_delete",
  263.                     &nreturn_vals,
  264.                     GIMP_PDB_LAYER, layer_ID,
  265.                     GIMP_PDB_END);
  266.  
  267.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  268.  
  269.   gimp_destroy_params (return_vals, nreturn_vals);
  270.  
  271.   return success;
  272. }
  273.  
  274. /**
  275.  * gimp_layer_translate:
  276.  * @layer_ID: The layer.
  277.  * @offx: Offset in x direction.
  278.  * @offy: Offset in y direction.
  279.  *
  280.  * Translate the layer by the specified offsets.
  281.  *
  282.  * This procedure translates the layer by the amounts specified in the
  283.  * x and y arguments. These can be negative, and are considered offsets
  284.  * from the current position. This command only works if the layer has
  285.  * been added to an image. All additional layers contained in the image
  286.  * which have the linked flag set to TRUE w ill also be translated by
  287.  * the specified offsets.
  288.  *
  289.  * Returns: TRUE on success.
  290.  */
  291. gboolean
  292. gimp_layer_translate (gint32 layer_ID,
  293.               gint   offx,
  294.               gint   offy)
  295. {
  296.   GimpParam *return_vals;
  297.   gint nreturn_vals;
  298.   gboolean success = TRUE;
  299.  
  300.   return_vals = gimp_run_procedure ("gimp_layer_translate",
  301.                     &nreturn_vals,
  302.                     GIMP_PDB_LAYER, layer_ID,
  303.                     GIMP_PDB_INT32, offx,
  304.                     GIMP_PDB_INT32, offy,
  305.                     GIMP_PDB_END);
  306.  
  307.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  308.  
  309.   gimp_destroy_params (return_vals, nreturn_vals);
  310.  
  311.   return success;
  312. }
  313.  
  314. /**
  315.  * gimp_layer_add_alpha:
  316.  * @layer_ID: The layer.
  317.  *
  318.  * Add an alpha channel to the layer if it doesn't already have one.
  319.  *
  320.  * This procedure adds an additional component to the specified layer
  321.  * if it does not already possess an alpha channel. An alpha channel
  322.  * makes it possible to move a layer from the bottom of the layer stack
  323.  * and to clear and erase to transparency, instead of the background
  324.  * color. This transforms images of type RGB to RGBA, GRAY to GRAYA,
  325.  * and INDEXED to INDEXEDA.
  326.  *
  327.  * Returns: TRUE on success.
  328.  */
  329. gboolean
  330. gimp_layer_add_alpha (gint32 layer_ID)
  331. {
  332.   GimpParam *return_vals;
  333.   gint nreturn_vals;
  334.   gboolean success = TRUE;
  335.  
  336.   return_vals = gimp_run_procedure ("gimp_layer_add_alpha",
  337.                     &nreturn_vals,
  338.                     GIMP_PDB_LAYER, layer_ID,
  339.                     GIMP_PDB_END);
  340.  
  341.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  342.  
  343.   gimp_destroy_params (return_vals, nreturn_vals);
  344.  
  345.   return success;
  346. }
  347.  
  348. /**
  349.  * gimp_layer_set_offsets:
  350.  * @layer_ID: The layer.
  351.  * @offx: Offset in x direction.
  352.  * @offy: Offset in y direction.
  353.  *
  354.  * Set the layer offsets.
  355.  *
  356.  * This procedure sets the offsets for the specified layer. The offsets
  357.  * are relative to the image origin and can be any values. This
  358.  * operation is valid only on layers which have been added to an image.
  359.  *
  360.  * Returns: TRUE on success.
  361.  */
  362. gboolean
  363. gimp_layer_set_offsets (gint32 layer_ID,
  364.             gint   offx,
  365.             gint   offy)
  366. {
  367.   GimpParam *return_vals;
  368.   gint nreturn_vals;
  369.   gboolean success = TRUE;
  370.  
  371.   return_vals = gimp_run_procedure ("gimp_layer_set_offsets",
  372.                     &nreturn_vals,
  373.                     GIMP_PDB_LAYER, layer_ID,
  374.                     GIMP_PDB_INT32, offx,
  375.                     GIMP_PDB_INT32, offy,
  376.                     GIMP_PDB_END);
  377.  
  378.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  379.  
  380.   gimp_destroy_params (return_vals, nreturn_vals);
  381.  
  382.   return success;
  383. }
  384.  
  385. /**
  386.  * gimp_layer_mask:
  387.  * @layer_ID: The layer.
  388.  *
  389.  * Get the specified layer's mask if it exists.
  390.  *
  391.  * This procedure returns the specified layer's mask, or -1 if none
  392.  * exists.
  393.  *
  394.  * Returns: The layer mask.
  395.  */
  396. gint32
  397. gimp_layer_mask (gint32 layer_ID)
  398. {
  399.   GimpParam *return_vals;
  400.   gint nreturn_vals;
  401.   gint32 mask_ID = -1;
  402.  
  403.   return_vals = gimp_run_procedure ("gimp_layer_mask",
  404.                     &nreturn_vals,
  405.                     GIMP_PDB_LAYER, layer_ID,
  406.                     GIMP_PDB_END);
  407.  
  408.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  409.     mask_ID = return_vals[1].data.d_channel;
  410.  
  411.   gimp_destroy_params (return_vals, nreturn_vals);
  412.  
  413.   return mask_ID;
  414. }
  415.  
  416. /**
  417.  * gimp_layer_is_floating_sel:
  418.  * @layer_ID: The layer.
  419.  *
  420.  * Is the specified layer a floating selection?
  421.  *
  422.  * This procedure returns whether the layer is a floating selection.
  423.  * Floating selections are special cases of layers which are attached
  424.  * to a specific drawable.
  425.  *
  426.  * Returns: Non-zero if the layer is a floating selection.
  427.  */
  428. gboolean
  429. gimp_layer_is_floating_sel (gint32 layer_ID)
  430. {
  431.   GimpParam *return_vals;
  432.   gint nreturn_vals;
  433.   gboolean is_floating_sel = FALSE;
  434.  
  435.   return_vals = gimp_run_procedure ("gimp_layer_is_floating_sel",
  436.                     &nreturn_vals,
  437.                     GIMP_PDB_LAYER, layer_ID,
  438.                     GIMP_PDB_END);
  439.  
  440.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  441.     is_floating_sel = return_vals[1].data.d_int32;
  442.  
  443.   gimp_destroy_params (return_vals, nreturn_vals);
  444.  
  445.   return is_floating_sel;
  446. }
  447.  
  448. /**
  449.  * gimp_layer_get_name:
  450.  * @layer_ID: The layer.
  451.  *
  452.  * Get the name of the specified layer.
  453.  *
  454.  * This procedure returns the specified layer's name.
  455.  *
  456.  * Returns: The layer name.
  457.  */
  458. gchar *
  459. gimp_layer_get_name (gint32 layer_ID)
  460. {
  461.   GimpParam *return_vals;
  462.   gint nreturn_vals;
  463.   gchar *name = NULL;
  464.  
  465.   return_vals = gimp_run_procedure ("gimp_layer_get_name",
  466.                     &nreturn_vals,
  467.                     GIMP_PDB_LAYER, layer_ID,
  468.                     GIMP_PDB_END);
  469.  
  470.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  471.     name = g_strdup (return_vals[1].data.d_string);
  472.  
  473.   gimp_destroy_params (return_vals, nreturn_vals);
  474.  
  475.   return name;
  476. }
  477.  
  478. /**
  479.  * gimp_layer_set_name:
  480.  * @layer_ID: The layer.
  481.  * @name: The new layer name.
  482.  *
  483.  * Set the name of the specified layer.
  484.  *
  485.  * This procedure sets the specified layer's name.
  486.  *
  487.  * Returns: TRUE on success.
  488.  */
  489. gboolean
  490. gimp_layer_set_name (gint32  layer_ID,
  491.              gchar  *name)
  492. {
  493.   GimpParam *return_vals;
  494.   gint nreturn_vals;
  495.   gboolean success = TRUE;
  496.  
  497.   return_vals = gimp_run_procedure ("gimp_layer_set_name",
  498.                     &nreturn_vals,
  499.                     GIMP_PDB_LAYER, layer_ID,
  500.                     GIMP_PDB_STRING, name,
  501.                     GIMP_PDB_END);
  502.  
  503.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  504.  
  505.   gimp_destroy_params (return_vals, nreturn_vals);
  506.  
  507.   return success;
  508. }
  509.  
  510. /**
  511.  * gimp_layer_get_visible:
  512.  * @layer_ID: The layer.
  513.  *
  514.  * Get the visibility of the specified layer.
  515.  *
  516.  * This procedure returns the specified layer's visibility.
  517.  *
  518.  * Returns: The layer visibility.
  519.  */
  520. gboolean
  521. gimp_layer_get_visible (gint32 layer_ID)
  522. {
  523.   GimpParam *return_vals;
  524.   gint nreturn_vals;
  525.   gboolean visible = FALSE;
  526.  
  527.   return_vals = gimp_run_procedure ("gimp_layer_get_visible",
  528.                     &nreturn_vals,
  529.                     GIMP_PDB_LAYER, layer_ID,
  530.                     GIMP_PDB_END);
  531.  
  532.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  533.     visible = return_vals[1].data.d_int32;
  534.  
  535.   gimp_destroy_params (return_vals, nreturn_vals);
  536.  
  537.   return visible;
  538. }
  539.  
  540. /**
  541.  * gimp_layer_set_visible:
  542.  * @layer_ID: The layer.
  543.  * @visible: The new layer visibility.
  544.  *
  545.  * Set the visibility of the specified layer.
  546.  *
  547.  * This procedure sets the specified layer's visibility.
  548.  *
  549.  * Returns: TRUE on success.
  550.  */
  551. gboolean
  552. gimp_layer_set_visible (gint32   layer_ID,
  553.             gboolean visible)
  554. {
  555.   GimpParam *return_vals;
  556.   gint nreturn_vals;
  557.   gboolean success = TRUE;
  558.  
  559.   return_vals = gimp_run_procedure ("gimp_layer_set_visible",
  560.                     &nreturn_vals,
  561.                     GIMP_PDB_LAYER, layer_ID,
  562.                     GIMP_PDB_INT32, visible,
  563.                     GIMP_PDB_END);
  564.  
  565.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  566.  
  567.   gimp_destroy_params (return_vals, nreturn_vals);
  568.  
  569.   return success;
  570. }
  571.  
  572. /**
  573.  * gimp_layer_get_preserve_trans:
  574.  * @layer_ID: The layer.
  575.  *
  576.  * Get the preserve transperancy setting of the specified layer.
  577.  *
  578.  * This procedure returns the specified layer's preserve transperancy
  579.  * setting.
  580.  *
  581.  * Returns: The layer's preserve transperancy setting.
  582.  */
  583. gboolean
  584. gimp_layer_get_preserve_trans (gint32 layer_ID)
  585. {
  586.   GimpParam *return_vals;
  587.   gint nreturn_vals;
  588.   gboolean preserve_trans = FALSE;
  589.  
  590.   return_vals = gimp_run_procedure ("gimp_layer_get_preserve_trans",
  591.                     &nreturn_vals,
  592.                     GIMP_PDB_LAYER, layer_ID,
  593.                     GIMP_PDB_END);
  594.  
  595.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  596.     preserve_trans = return_vals[1].data.d_int32;
  597.  
  598.   gimp_destroy_params (return_vals, nreturn_vals);
  599.  
  600.   return preserve_trans;
  601. }
  602.  
  603. /**
  604.  * gimp_layer_set_preserve_trans:
  605.  * @layer_ID: The layer.
  606.  * @preserve_trans: The new layer's preserve transperancy setting.
  607.  *
  608.  * Set the preserve transperancy setting of the specified layer.
  609.  *
  610.  * This procedure sets the specified layer's preserve transperancy
  611.  * setting.
  612.  *
  613.  * Returns: TRUE on success.
  614.  */
  615. gboolean
  616. gimp_layer_set_preserve_trans (gint32   layer_ID,
  617.                    gboolean preserve_trans)
  618. {
  619.   GimpParam *return_vals;
  620.   gint nreturn_vals;
  621.   gboolean success = TRUE;
  622.  
  623.   return_vals = gimp_run_procedure ("gimp_layer_set_preserve_trans",
  624.                     &nreturn_vals,
  625.                     GIMP_PDB_LAYER, layer_ID,
  626.                     GIMP_PDB_INT32, preserve_trans,
  627.                     GIMP_PDB_END);
  628.  
  629.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  630.  
  631.   gimp_destroy_params (return_vals, nreturn_vals);
  632.  
  633.   return success;
  634. }
  635.  
  636. /**
  637.  * gimp_layer_get_apply_mask:
  638.  * @layer_ID: The layer.
  639.  *
  640.  * Get the apply mask setting of the specified layer.
  641.  *
  642.  * This procedure returns the specified layer's apply mask setting. If
  643.  * the value is non-zero, then the layer mask for this layer is
  644.  * currently being composited with the layer's alpha channel.
  645.  *
  646.  * Returns: The layer's apply mask setting.
  647.  */
  648. gboolean
  649. gimp_layer_get_apply_mask (gint32 layer_ID)
  650. {
  651.   GimpParam *return_vals;
  652.   gint nreturn_vals;
  653.   gboolean apply_mask = FALSE;
  654.  
  655.   return_vals = gimp_run_procedure ("gimp_layer_get_apply_mask",
  656.                     &nreturn_vals,
  657.                     GIMP_PDB_LAYER, layer_ID,
  658.                     GIMP_PDB_END);
  659.  
  660.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  661.     apply_mask = return_vals[1].data.d_int32;
  662.  
  663.   gimp_destroy_params (return_vals, nreturn_vals);
  664.  
  665.   return apply_mask;
  666. }
  667.  
  668. /**
  669.  * gimp_layer_set_apply_mask:
  670.  * @layer_ID: The layer.
  671.  * @apply_mask: The new layer's apply mask setting.
  672.  *
  673.  * Set the apply mask setting of the specified layer.
  674.  *
  675.  * This procedure sets the specified layer's apply mask setting. This
  676.  * controls whether the layer's mask is currently affecting the alpha
  677.  * channel. If there is no layer mask, this function will return an
  678.  * error.
  679.  *
  680.  * Returns: TRUE on success.
  681.  */
  682. gboolean
  683. gimp_layer_set_apply_mask (gint32   layer_ID,
  684.                gboolean apply_mask)
  685. {
  686.   GimpParam *return_vals;
  687.   gint nreturn_vals;
  688.   gboolean success = TRUE;
  689.  
  690.   return_vals = gimp_run_procedure ("gimp_layer_set_apply_mask",
  691.                     &nreturn_vals,
  692.                     GIMP_PDB_LAYER, layer_ID,
  693.                     GIMP_PDB_INT32, apply_mask,
  694.                     GIMP_PDB_END);
  695.  
  696.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  697.  
  698.   gimp_destroy_params (return_vals, nreturn_vals);
  699.  
  700.   return success;
  701. }
  702.  
  703. /**
  704.  * gimp_layer_get_show_mask:
  705.  * @layer_ID: The layer.
  706.  *
  707.  * Get the show mask setting of the specified layer.
  708.  *
  709.  * This procedure returns the specified layer's show mask setting. If
  710.  * the value is non-zero, then the layer mask for this layer is
  711.  * currently being shown instead of the layer.
  712.  *
  713.  * Returns: The layer's show mask setting.
  714.  */
  715. gboolean
  716. gimp_layer_get_show_mask (gint32 layer_ID)
  717. {
  718.   GimpParam *return_vals;
  719.   gint nreturn_vals;
  720.   gboolean show_mask = FALSE;
  721.  
  722.   return_vals = gimp_run_procedure ("gimp_layer_get_show_mask",
  723.                     &nreturn_vals,
  724.                     GIMP_PDB_LAYER, layer_ID,
  725.                     GIMP_PDB_END);
  726.  
  727.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  728.     show_mask = return_vals[1].data.d_int32;
  729.  
  730.   gimp_destroy_params (return_vals, nreturn_vals);
  731.  
  732.   return show_mask;
  733. }
  734.  
  735. /**
  736.  * gimp_layer_set_show_mask:
  737.  * @layer_ID: The layer.
  738.  * @show_mask: The new layer's show mask setting.
  739.  *
  740.  * Set the show mask setting of the specified layer.
  741.  *
  742.  * This procedure sets the specified layer's show mask setting. This
  743.  * controls whether the layer or it's mask is visible. Non-zero values
  744.  * indicate that the mask should be visible. If the layer has no mask,
  745.  * then this function returns an error.
  746.  *
  747.  * Returns: TRUE on success.
  748.  */
  749. gboolean
  750. gimp_layer_set_show_mask (gint32   layer_ID,
  751.               gboolean show_mask)
  752. {
  753.   GimpParam *return_vals;
  754.   gint nreturn_vals;
  755.   gboolean success = TRUE;
  756.  
  757.   return_vals = gimp_run_procedure ("gimp_layer_set_show_mask",
  758.                     &nreturn_vals,
  759.                     GIMP_PDB_LAYER, layer_ID,
  760.                     GIMP_PDB_INT32, show_mask,
  761.                     GIMP_PDB_END);
  762.  
  763.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  764.  
  765.   gimp_destroy_params (return_vals, nreturn_vals);
  766.  
  767.   return success;
  768. }
  769.  
  770. /**
  771.  * gimp_layer_get_edit_mask:
  772.  * @layer_ID: The layer.
  773.  *
  774.  * Get the show mask setting of the specified layer.
  775.  *
  776.  * This procedure returns the specified layer's show mask setting. If
  777.  * the value is non-zero, then the layer mask for this layer is
  778.  * currently active, and not the layer.
  779.  *
  780.  * Returns: The layer's show mask setting.
  781.  */
  782. gboolean
  783. gimp_layer_get_edit_mask (gint32 layer_ID)
  784. {
  785.   GimpParam *return_vals;
  786.   gint nreturn_vals;
  787.   gboolean edit_mask = FALSE;
  788.  
  789.   return_vals = gimp_run_procedure ("gimp_layer_get_edit_mask",
  790.                     &nreturn_vals,
  791.                     GIMP_PDB_LAYER, layer_ID,
  792.                     GIMP_PDB_END);
  793.  
  794.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  795.     edit_mask = return_vals[1].data.d_int32;
  796.  
  797.   gimp_destroy_params (return_vals, nreturn_vals);
  798.  
  799.   return edit_mask;
  800. }
  801.  
  802. /**
  803.  * gimp_layer_set_edit_mask:
  804.  * @layer_ID: The layer.
  805.  * @edit_mask: The new layer's show mask setting.
  806.  *
  807.  * Set the show mask setting of the specified layer.
  808.  *
  809.  * This procedure sets the specified layer's show mask setting. This
  810.  * controls whether the layer or it's mask is currently active for
  811.  * editing. If the specified layer has no layer mask, then this
  812.  * procedure will return an error.
  813.  *
  814.  * Returns: TRUE on success.
  815.  */
  816. gboolean
  817. gimp_layer_set_edit_mask (gint32   layer_ID,
  818.               gboolean edit_mask)
  819. {
  820.   GimpParam *return_vals;
  821.   gint nreturn_vals;
  822.   gboolean success = TRUE;
  823.  
  824.   return_vals = gimp_run_procedure ("gimp_layer_set_edit_mask",
  825.                     &nreturn_vals,
  826.                     GIMP_PDB_LAYER, layer_ID,
  827.                     GIMP_PDB_INT32, edit_mask,
  828.                     GIMP_PDB_END);
  829.  
  830.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  831.  
  832.   gimp_destroy_params (return_vals, nreturn_vals);
  833.  
  834.   return success;
  835. }
  836.  
  837. /**
  838.  * gimp_layer_get_opacity:
  839.  * @layer_ID: The layer.
  840.  *
  841.  * Get the opacity of the specified layer.
  842.  *
  843.  * This procedure returns the specified layer's opacity.
  844.  *
  845.  * Returns: The layer opacity.
  846.  */
  847. gdouble
  848. gimp_layer_get_opacity (gint32 layer_ID)
  849. {
  850.   GimpParam *return_vals;
  851.   gint nreturn_vals;
  852.   gdouble opacity = 0;
  853.  
  854.   return_vals = gimp_run_procedure ("gimp_layer_get_opacity",
  855.                     &nreturn_vals,
  856.                     GIMP_PDB_LAYER, layer_ID,
  857.                     GIMP_PDB_END);
  858.  
  859.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  860.     opacity = return_vals[1].data.d_float;
  861.  
  862.   gimp_destroy_params (return_vals, nreturn_vals);
  863.  
  864.   return opacity;
  865. }
  866.  
  867. /**
  868.  * gimp_layer_set_opacity:
  869.  * @layer_ID: The layer.
  870.  * @opacity: The new layer opacity.
  871.  *
  872.  * Set the opacity of the specified layer.
  873.  *
  874.  * This procedure sets the specified layer's opacity.
  875.  *
  876.  * Returns: TRUE on success.
  877.  */
  878. gboolean
  879. gimp_layer_set_opacity (gint32  layer_ID,
  880.             gdouble opacity)
  881. {
  882.   GimpParam *return_vals;
  883.   gint nreturn_vals;
  884.   gboolean success = TRUE;
  885.  
  886.   return_vals = gimp_run_procedure ("gimp_layer_set_opacity",
  887.                     &nreturn_vals,
  888.                     GIMP_PDB_LAYER, layer_ID,
  889.                     GIMP_PDB_FLOAT, opacity,
  890.                     GIMP_PDB_END);
  891.  
  892.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  893.  
  894.   gimp_destroy_params (return_vals, nreturn_vals);
  895.  
  896.   return success;
  897. }
  898.  
  899. /**
  900.  * gimp_layer_get_mode:
  901.  * @layer_ID: The layer.
  902.  *
  903.  * Get the combination mode of the specified layer.
  904.  *
  905.  * This procedure returns the specified layer's combination mode.
  906.  *
  907.  * Returns: The layer combination mode.
  908.  */
  909. GimpLayerModeEffects
  910. gimp_layer_get_mode (gint32 layer_ID)
  911. {
  912.   GimpParam *return_vals;
  913.   gint nreturn_vals;
  914.   GimpLayerModeEffects mode = 0;
  915.  
  916.   return_vals = gimp_run_procedure ("gimp_layer_get_mode",
  917.                     &nreturn_vals,
  918.                     GIMP_PDB_LAYER, layer_ID,
  919.                     GIMP_PDB_END);
  920.  
  921.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  922.     mode = return_vals[1].data.d_int32;
  923.  
  924.   gimp_destroy_params (return_vals, nreturn_vals);
  925.  
  926.   return mode;
  927. }
  928.  
  929. /**
  930.  * gimp_layer_set_mode:
  931.  * @layer_ID: The layer.
  932.  * @mode: The new layer combination mode.
  933.  *
  934.  * Set the combination mode of the specified layer.
  935.  *
  936.  * This procedure sets the specified layer's combination mode.
  937.  *
  938.  * Returns: TRUE on success.
  939.  */
  940. gboolean
  941. gimp_layer_set_mode (gint32               layer_ID,
  942.              GimpLayerModeEffects mode)
  943. {
  944.   GimpParam *return_vals;
  945.   gint nreturn_vals;
  946.   gboolean success = TRUE;
  947.  
  948.   return_vals = gimp_run_procedure ("gimp_layer_set_mode",
  949.                     &nreturn_vals,
  950.                     GIMP_PDB_LAYER, layer_ID,
  951.                     GIMP_PDB_INT32, mode,
  952.                     GIMP_PDB_END);
  953.  
  954.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  955.  
  956.   gimp_destroy_params (return_vals, nreturn_vals);
  957.  
  958.   return success;
  959. }
  960.  
  961. /**
  962.  * gimp_layer_get_linked:
  963.  * @layer_ID: The layer.
  964.  *
  965.  * Get the linked state of the specified layer.
  966.  *
  967.  * This procedure returns the specified layer's linked state.
  968.  *
  969.  * Returns: The layer linked state (for moves).
  970.  */
  971. gboolean
  972. gimp_layer_get_linked (gint32 layer_ID)
  973. {
  974.   GimpParam *return_vals;
  975.   gint nreturn_vals;
  976.   gboolean linked = FALSE;
  977.  
  978.   return_vals = gimp_run_procedure ("gimp_layer_get_linked",
  979.                     &nreturn_vals,
  980.                     GIMP_PDB_LAYER, layer_ID,
  981.                     GIMP_PDB_END);
  982.  
  983.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  984.     linked = return_vals[1].data.d_int32;
  985.  
  986.   gimp_destroy_params (return_vals, nreturn_vals);
  987.  
  988.   return linked;
  989. }
  990.  
  991. /**
  992.  * gimp_layer_set_linked:
  993.  * @layer_ID: The layer.
  994.  * @linked: The new layer linked state.
  995.  *
  996.  * Set the linked state of the specified layer.
  997.  *
  998.  * This procedure sets the specified layer's linked state.
  999.  *
  1000.  * Returns: TRUE on success.
  1001.  */
  1002. gboolean
  1003. gimp_layer_set_linked (gint32   layer_ID,
  1004.                gboolean linked)
  1005. {
  1006.   GimpParam *return_vals;
  1007.   gint nreturn_vals;
  1008.   gboolean success = TRUE;
  1009.  
  1010.   return_vals = gimp_run_procedure ("gimp_layer_set_linked",
  1011.                     &nreturn_vals,
  1012.                     GIMP_PDB_LAYER, layer_ID,
  1013.                     GIMP_PDB_INT32, linked,
  1014.                     GIMP_PDB_END);
  1015.  
  1016.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  1017.  
  1018.   gimp_destroy_params (return_vals, nreturn_vals);
  1019.  
  1020.   return success;
  1021. }
  1022.  
  1023. /**
  1024.  * gimp_layer_get_tattoo:
  1025.  * @layer_ID: The layer.
  1026.  *
  1027.  * Get the tattoo of the specified layer.
  1028.  *
  1029.  * This procedure returns the specified layer's tattoo. A tattoo is a
  1030.  * unique and permanent identifier attached to a layer that can be used
  1031.  * to uniquely identify a layer within an image even between sessions
  1032.  *
  1033.  * Returns: The layer tattoo.
  1034.  */
  1035. gint
  1036. gimp_layer_get_tattoo (gint32 layer_ID)
  1037. {
  1038.   GimpParam *return_vals;
  1039.   gint nreturn_vals;
  1040.   gint tattoo = 0;
  1041.  
  1042.   return_vals = gimp_run_procedure ("gimp_layer_get_tattoo",
  1043.                     &nreturn_vals,
  1044.                     GIMP_PDB_LAYER, layer_ID,
  1045.                     GIMP_PDB_END);
  1046.  
  1047.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  1048.     tattoo = return_vals[1].data.d_tattoo;
  1049.  
  1050.   gimp_destroy_params (return_vals, nreturn_vals);
  1051.  
  1052.   return tattoo;
  1053. }
  1054.  
  1055. /**
  1056.  * gimp_layer_set_tattoo:
  1057.  * @layer_ID: The layer.
  1058.  * @tattoo: The new layer tattoo.
  1059.  *
  1060.  * Set the tattoo of the specified layer.
  1061.  *
  1062.  * This procedure sets the specified layer's tattoo. A tattoo is a
  1063.  * unique and permanent identifier attached to a layer that can be used
  1064.  * to uniquely identify a layer within an image even between sessions
  1065.  *
  1066.  * Returns: TRUE on success.
  1067.  */
  1068. gboolean
  1069. gimp_layer_set_tattoo (gint32 layer_ID,
  1070.                gint   tattoo)
  1071. {
  1072.   GimpParam *return_vals;
  1073.   gint nreturn_vals;
  1074.   gboolean success = TRUE;
  1075.  
  1076.   return_vals = gimp_run_procedure ("gimp_layer_set_tattoo",
  1077.                     &nreturn_vals,
  1078.                     GIMP_PDB_LAYER, layer_ID,
  1079.                     GIMP_PDB_INT32, tattoo,
  1080.                     GIMP_PDB_END);
  1081.  
  1082.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  1083.  
  1084.   gimp_destroy_params (return_vals, nreturn_vals);
  1085.  
  1086.   return success;
  1087. }
  1088.