1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658
|
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpcolor_pdb.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl */
#include "config.h"
#include "gimp.h"
/**
* gimp_brightness_contrast:
* @drawable_ID: The drawable.
* @brightness: Brightness adjustment.
* @contrast: Contrast adjustment.
*
* Modify brightness/contrast in the specified drawable.
*
* This procedures allows the brightness and contrast of the specified
* drawable to be modified. Both 'brightness' and 'contrast' parameters
* are defined between -127 and 127.
*
* Returns: TRUE on success.
*/
gboolean
gimp_brightness_contrast (gint32 drawable_ID,
gint brightness,
gint contrast)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_brightness_contrast",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_INT32, brightness,
GIMP_PDB_INT32, contrast,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_levels:
* @drawable_ID: The drawable.
* @channel: The channel to modify.
* @low_input: Intensity of lowest input.
* @high_input: Intensity of highest input.
* @gamma: Gamma correction factor.
* @low_output: Intensity of lowest output.
* @high_output: Intensity of highest output.
*
* Modifies intensity levels in the specified drawable.
*
* This tool allows intensity levels in the specified drawable to be
* remapped according to a set of parameters. The low/high input levels
* specify an initial mapping from the source intensities. The gamma
* value determines how intensities between the low and high input
* intensities are interpolated. A gamma value of 1.0 results in a
* linear interpolation. Higher gamma values result in more high-level
* intensities. Lower gamma values result in more low-level
* intensities. The low/high output levels constrain the final
* intensity mapping--that is, no final intensity will be lower than
* the low output level and no final intensity will be higher than the
* high output level. This tool is only valid on RGB color and
* grayscale images. It will not operate on indexed drawables.
*
* Returns: TRUE on success.
*/
gboolean
gimp_levels (gint32 drawable_ID,
GimpHistogramChannel channel,
gint low_input,
gint high_input,
gdouble gamma,
gint low_output,
gint high_output)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_levels",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_INT32, channel,
GIMP_PDB_INT32, low_input,
GIMP_PDB_INT32, high_input,
GIMP_PDB_FLOAT, gamma,
GIMP_PDB_INT32, low_output,
GIMP_PDB_INT32, high_output,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_levels_auto:
* @drawable_ID: The drawable.
*
* This procedure is deprecated! Use gimp_levels_stretch() instead.
*
* Returns: TRUE on success.
*/
gboolean
gimp_levels_auto (gint32 drawable_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_levels_auto",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_levels_stretch:
* @drawable_ID: The drawable.
*
* Automatically modifies intensity levels in the specified drawable.
*
* This procedure allows intensity levels in the specified drawable to
* be remapped according to a set of guessed parameters. It is
* equivalent to clicking the \"Auto\" button in the Levels tool. This
* procedure is only valid on RGB color and grayscale images. It will
* not operate on indexed drawables.
*
* Returns: TRUE on success.
*/
gboolean
gimp_levels_stretch (gint32 drawable_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_levels_stretch",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_posterize:
* @drawable_ID: The drawable.
* @levels: Levels of posterization.
*
* Posterize the specified drawable.
*
* This procedures reduces the number of shades allows in each
* intensity channel to the specified 'levels' parameter.
*
* Returns: TRUE on success.
*/
gboolean
gimp_posterize (gint32 drawable_ID,
gint levels)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_posterize",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_INT32, levels,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_desaturate:
* @drawable_ID: The drawable.
*
* Desaturate the contents of the specified drawable.
*
* This procedure desaturates the contents of the specified drawable.
* This procedure only works on drawables of type RGB color.
*
* Returns: TRUE on success.
*/
gboolean
gimp_desaturate (gint32 drawable_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_desaturate",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_equalize:
* @drawable_ID: The drawable.
* @mask_only: Equalization option.
*
* Equalize the contents of the specified drawable.
*
* This procedure equalizes the contents of the specified drawable.
* Each intensity channel is equalizeed independently. The equalized
* intensity is given as inten' = (255 - inten). Indexed color
* drawables are not valid for this operation. The 'mask_only' option
* specifies whether to adjust only the area of the image within the
* selection bounds, or the entire image based on the histogram of the
* selected area. If there is no selection, the entire image is
* adjusted based on the histogram for the entire image.
*
* Returns: TRUE on success.
*/
gboolean
gimp_equalize (gint32 drawable_ID,
gboolean mask_only)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_equalize",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_INT32, mask_only,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_invert:
* @drawable_ID: The drawable.
*
* Invert the contents of the specified drawable.
*
* This procedure inverts the contents of the specified drawable. Each
* intensity channel is inverted independently. The inverted intensity
* is given as inten' = (255 - inten). Indexed color drawables are not
* valid for this operation.
*
* Returns: TRUE on success.
*/
gboolean
gimp_invert (gint32 drawable_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_invert",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_curves_spline:
* @drawable_ID: The drawable.
* @channel: The channel to modify.
* @num_points: The number of values in the control point array.
* @control_pts: The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, ... }.
*
* Modifies the intensity curve(s) for specified drawable.
*
* Modifies the intensity mapping for one channel in the specified
* drawable. The drawable must be either grayscale or RGB, and the
* channel can be either an intensity component, or the value. The
* 'control_pts' parameter is an array of integers which define a set
* of control points which describe a Catmull Rom spline which yields
* the final intensity curve. Use the 'gimp_curves_explicit' function
* to explicitly modify intensity levels.
*
* Returns: TRUE on success.
*/
gboolean
gimp_curves_spline (gint32 drawable_ID,
GimpHistogramChannel channel,
gint num_points,
const guint8 *control_pts)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_curves_spline",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_INT32, channel,
GIMP_PDB_INT32, num_points,
GIMP_PDB_INT8ARRAY, control_pts,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_curves_explicit:
* @drawable_ID: The drawable.
* @channel: The channel to modify.
* @num_bytes: The number of bytes in the new curve (always 256).
* @curve: The explicit curve.
*
* Modifies the intensity curve(s) for specified drawable.
*
* Modifies the intensity mapping for one channel in the specified
* drawable. The drawable must be either grayscale or RGB, and the
* channel can be either an intensity component, or the value. The
* 'curve' parameter is an array of bytes which explicitly defines how
* each pixel value in the drawable will be modified. Use the
* 'gimp_curves_spline' function to modify intensity levels with
* Catmull Rom splines.
*
* Returns: TRUE on success.
*/
gboolean
gimp_curves_explicit (gint32 drawable_ID,
GimpHistogramChannel channel,
gint num_bytes,
const guint8 *curve)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_curves_explicit",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_INT32, channel,
GIMP_PDB_INT32, num_bytes,
GIMP_PDB_INT8ARRAY, curve,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_color_balance:
* @drawable_ID: The drawable.
* @transfer_mode: Transfer mode.
* @preserve_lum: Preserve luminosity values at each pixel.
* @cyan_red: Cyan-Red color balance.
* @magenta_green: Magenta-Green color balance.
* @yellow_blue: Yellow-Blue color balance.
*
* Modify the color balance of the specified drawable.
*
* Modify the color balance of the specified drawable. There are three
* axis which can be modified: cyan-red, magenta-green, and
* yellow-blue. Negative values increase the amount of the former,
* positive values increase the amount of the latter. Color balance can
* be controlled with the 'transfer_mode' setting, which allows
* shadows, midtones, and highlights in an image to be affected
* differently. The 'preserve_lum' parameter, if non-zero, ensures that
* the luminosity of each pixel remains fixed.
*
* Returns: TRUE on success.
*/
gboolean
gimp_color_balance (gint32 drawable_ID,
GimpTransferMode transfer_mode,
gboolean preserve_lum,
gdouble cyan_red,
gdouble magenta_green,
gdouble yellow_blue)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_color_balance",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_INT32, transfer_mode,
GIMP_PDB_INT32, preserve_lum,
GIMP_PDB_FLOAT, cyan_red,
GIMP_PDB_FLOAT, magenta_green,
GIMP_PDB_FLOAT, yellow_blue,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_colorize:
* @drawable_ID: The drawable.
* @hue: Hue in degrees.
* @saturation: Saturation in percent.
* @lightness: Lightness in percent.
*
* Render the drawable as a grayscale image seen through a colored
* glass.
*
* Desatures the drawable, then tints it with the specified color. This
* tool is only valid on RGB color images. It will not operate on
* grayscale or indexed drawables.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.2
*/
gboolean
gimp_colorize (gint32 drawable_ID,
gdouble hue,
gdouble saturation,
gdouble lightness)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_colorize",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_FLOAT, hue,
GIMP_PDB_FLOAT, saturation,
GIMP_PDB_FLOAT, lightness,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_histogram:
* @drawable_ID: The drawable.
* @channel: The channel to modify.
* @start_range: Start of the intensity measurement range.
* @end_range: End of the intensity measurement range.
* @mean: Mean intensity value.
* @std_dev: Standard deviation of intensity values.
* @median: Median intensity value.
* @pixels: Alpha-weighted pixel count for entire image.
* @count: Alpha-weighted pixel count for range.
* @percentile: Percentile that range falls under.
*
* Returns information on the intensity histogram for the specified
* drawable.
*
* This tool makes it possible to gather information about the
* intensity histogram of a drawable. A channel to examine is first
* specified. This can be either value, red, green, or blue, depending
* on whether the drawable is of type color or grayscale. The drawable
* may not be indexed. Second, a range of intensities are specified.
* The gimp_histogram function returns statistics based on the pixels
* in the drawable that fall under this range of values. Mean, standard
* deviation, median, number of pixels, and percentile are all
* returned. Additionally, the total count of pixels in the image is
* returned. Counts of pixels are weighted by any associated alpha
* values and by the current selection mask. That is, pixels that lie
* outside an active selection mask will not be counted. Similarly,
* pixels with transparent alpha values will not be counted.
*
* Returns: TRUE on success.
*/
gboolean
gimp_histogram (gint32 drawable_ID,
GimpHistogramChannel channel,
gint start_range,
gint end_range,
gdouble *mean,
gdouble *std_dev,
gdouble *median,
gdouble *pixels,
gdouble *count,
gdouble *percentile)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_histogram",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_INT32, channel,
GIMP_PDB_INT32, start_range,
GIMP_PDB_INT32, end_range,
GIMP_PDB_END);
*mean = 0.0;
*std_dev = 0.0;
*median = 0.0;
*pixels = 0.0;
*count = 0.0;
*percentile = 0.0;
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
if (success)
{
*mean = return_vals[1].data.d_float;
*std_dev = return_vals[2].data.d_float;
*median = return_vals[3].data.d_float;
*pixels = return_vals[4].data.d_float;
*count = return_vals[5].data.d_float;
*percentile = return_vals[6].data.d_float;
}
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_hue_saturation:
* @drawable_ID: The drawable.
* @hue_range: Range of affected hues.
* @hue_offset: Hue offset in degrees.
* @lightness: lightness modification.
* @saturation: saturation modification.
*
* Modify hue, lightness, and saturation in the specified drawable.
*
* This procedures allows the hue, lightness, and saturation in the
* specified drawable to be modified. The 'hue_range' parameter
* provides the capability to limit range of affected hues.
*
* Returns: TRUE on success.
*/
gboolean
gimp_hue_saturation (gint32 drawable_ID,
GimpHueRange hue_range,
gdouble hue_offset,
gdouble lightness,
gdouble saturation)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_hue_saturation",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_INT32, hue_range,
GIMP_PDB_FLOAT, hue_offset,
GIMP_PDB_FLOAT, lightness,
GIMP_PDB_FLOAT, saturation,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_threshold:
* @drawable_ID: The drawable.
* @low_threshold: The low threshold value.
* @high_threshold: The high threshold value.
*
* Threshold the specified drawable.
*
* This procedures generates a threshold map of the specified drawable.
* All pixels between the values of 'low_threshold' and
* 'high_threshold' are replaced with white, and all other pixels with
* black.
*
* Returns: TRUE on success.
*/
gboolean
gimp_threshold (gint32 drawable_ID,
gint low_threshold,
gint high_threshold)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_threshold",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_INT32, low_threshold,
GIMP_PDB_INT32, high_threshold,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
|