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

  1. /* LIBGIMP - The GIMP Library
  2.  * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
  3.  *
  4.  * gimpconvert_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_convert_rgb:
  28.  * @image_ID: The image.
  29.  *
  30.  * Convert specified image to RGB color
  31.  *
  32.  * This procedure converts the specified image to RGB color. This
  33.  * process requires an image of type GRAY or INDEXED. No image content
  34.  * is lost in this process aside from the colormap for an indexed
  35.  * image.
  36.  *
  37.  * Returns: TRUE on success.
  38.  */
  39. gboolean
  40. gimp_convert_rgb (gint32 image_ID)
  41. {
  42.   GimpParam *return_vals;
  43.   gint nreturn_vals;
  44.   gboolean success = TRUE;
  45.  
  46.   return_vals = gimp_run_procedure ("gimp_convert_rgb",
  47.                     &nreturn_vals,
  48.                     GIMP_PDB_IMAGE, image_ID,
  49.                     GIMP_PDB_END);
  50.  
  51.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  52.  
  53.   gimp_destroy_params (return_vals, nreturn_vals);
  54.  
  55.   return success;
  56. }
  57.  
  58. /**
  59.  * gimp_convert_grayscale:
  60.  * @image_ID: The image.
  61.  *
  62.  * Convert specified image to grayscale (256 intensity levels)
  63.  *
  64.  * This procedure converts the specified image to grayscale with 8 bits
  65.  * per pixel (256 intensity levels). This process requires an image of
  66.  * type RGB or INDEXED.
  67.  *
  68.  * Returns: TRUE on success.
  69.  */
  70. gboolean
  71. gimp_convert_grayscale (gint32 image_ID)
  72. {
  73.   GimpParam *return_vals;
  74.   gint nreturn_vals;
  75.   gboolean success = TRUE;
  76.  
  77.   return_vals = gimp_run_procedure ("gimp_convert_grayscale",
  78.                     &nreturn_vals,
  79.                     GIMP_PDB_IMAGE, image_ID,
  80.                     GIMP_PDB_END);
  81.  
  82.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  83.  
  84.   gimp_destroy_params (return_vals, nreturn_vals);
  85.  
  86.   return success;
  87. }
  88.  
  89. /**
  90.  * gimp_convert_indexed:
  91.  * @image_ID: The image.
  92.  * @dither_type: dither type (0=none, 1=fs, 2=fs/low-bleed 3=fixed).
  93.  * @palette_type: The type of palette to use.
  94.  * @num_cols: the number of colors to quantize to, ignored unless (palette_type == MAKE_PALETTE).
  95.  * @alpha_dither: dither transparency to fake partial opacity.
  96.  * @remove_unused: remove unused or duplicate colour entries from final palette, ignored if (palette_type == MAKE_PALETTE).
  97.  * @palette: The name of the custom palette to use, ignored unless (palette_type == CUSTOM_PALETTE).
  98.  *
  99.  * Convert specified image to and Indexed image
  100.  *
  101.  * This procedure converts the specified image to 'indexed' color. This
  102.  * process requires an image of type GRAY or RGB. The 'palette_type'
  103.  * specifies what kind of palette to use, A type of '0' means to use an
  104.  * optimal palette of 'num_cols' generated from the colors in the
  105.  * image. A type of '1' means to re-use the previous palette (not
  106.  * currently implemented). A type of '2' means to use the so-called
  107.  * WWW-optimized palette. Type '3' means to use only black and white
  108.  * colors. A type of '4' means to use a palette from the gimp palettes
  109.  * directories. The 'dither type' specifies what kind of dithering to
  110.  * use. '0' means no dithering, '1' means standard Floyd-Steinberg
  111.  * error diffusion, '2' means Floyd-Steinberg error diffusion with
  112.  * reduced bleeding, '3' means dithering based on pixel location
  113.  * ('Fixed' dithering).
  114.  *
  115.  * Returns: TRUE on success.
  116.  */
  117. gboolean
  118. gimp_convert_indexed (gint32                  image_ID,
  119.               GimpConvertDitherType   dither_type,
  120.               GimpConvertPaletteType  palette_type,
  121.               gint                    num_cols,
  122.               gboolean                alpha_dither,
  123.               gboolean                remove_unused,
  124.               gchar                  *palette)
  125. {
  126.   GimpParam *return_vals;
  127.   gint nreturn_vals;
  128.   gboolean success = TRUE;
  129.  
  130.   return_vals = gimp_run_procedure ("gimp_convert_indexed",
  131.                     &nreturn_vals,
  132.                     GIMP_PDB_IMAGE, image_ID,
  133.                     GIMP_PDB_INT32, dither_type,
  134.                     GIMP_PDB_INT32, palette_type,
  135.                     GIMP_PDB_INT32, num_cols,
  136.                     GIMP_PDB_INT32, alpha_dither,
  137.                     GIMP_PDB_INT32, remove_unused,
  138.                     GIMP_PDB_STRING, palette,
  139.                     GIMP_PDB_END);
  140.  
  141.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  142.  
  143.   gimp_destroy_params (return_vals, nreturn_vals);
  144.  
  145.   return success;
  146. }
  147.