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
|
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* gaussian_blur_region no longer does combination; arguments changed
* -- scott@poverty.bloomington.in.us, 16Oct97
*/
#ifndef __PAINT_FUNCS_H__
#define __PAINT_FUNCS_H__
#include "pixel_region.h"
/* Called initially to setup accelerated rendering features */
void paint_funcs_setup (void);
void paint_funcs_free (void);
/* Paint functions */
void color_pixels (unsigned char *, unsigned char *,
int, int);
void blend_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int, int, int);
void shade_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int, int, int);
void extract_alpha_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int);
void darken_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int, int, int, int);
void lighten_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int, int, int, int);
void hsv_only_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int, int, int, int, int);
void color_only_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int, int, int, int, int);
void multiply_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int, int, int, int);
void screen_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int, int, int, int);
void overlay_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int, int, int, int);
void add_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int, int, int, int);
void subtract_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int, int, int, int);
void difference_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int, int, int, int);
void dissolve_pixels (unsigned char *, unsigned char *, int, int,
int, int, int, int, int);
void swap_pixels (unsigned char *, unsigned char *, int);
void scale_pixels (unsigned char *, unsigned char *,
int, int);
void add_alpha_pixels (unsigned char *, unsigned char *,
int, int);
void flatten_pixels (unsigned char *, unsigned char *,
unsigned char *, int, int);
void gray_to_rgb_pixels (unsigned char *, unsigned char *,
int, int);
/* apply the mask data to the alpha channel of the pixel data */
void apply_mask_to_alpha_channel (unsigned char *, unsigned char *,
int, int, int);
/* combine the mask data with the alpha channel of the pixel data */
void combine_mask_and_alpha_channel (unsigned char *, unsigned char *,
int, int, int);
/* copy gray pixels to intensity-alpha pixels. This function
* essentially takes a source that is only a grayscale image and
* copies it to the destination, expanding to RGB if necessary and
* adding an alpha channel. (OPAQUE)
*/
void copy_gray_to_inten_a_pixels (unsigned char *, unsigned char *,
int, int);
/* lay down the initial pixels in the case of only one
* channel being visible and no layers...In this singular
* case, we want to display a grayscale image w/o transparency
*/
void initial_channel_pixels (unsigned char *, unsigned char *,
int, int);
/* lay down the initial pixels in the case of an indexed image.
* This process obviously requires no composition
*/
void initial_indexed_pixels (unsigned char *, unsigned char *,
unsigned char *, int);
/* lay down the initial pixels in the case of an indexed image.
* This process obviously requires no composition
*/
void initial_indexed_a_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int);
/* lay down the initial pixels for the base layer.
* This process obviously requires no composition.
*/
void initial_inten_pixels (unsigned char *, unsigned char *,
unsigned char *, int,
int *, int, int);
/* lay down the initial pixels for the base layer.
* This process obviously requires no composition.
*/
void initial_inten_a_pixels (unsigned char *, unsigned char *,
unsigned char *, int,
int *, int, int);
/* combine indexed images with an optional mask which
* is interpreted as binary...destination is indexed...
*/
void combine_indexed_and_indexed_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int);
/* combine indexed images with indexed-alpha images
* result is an indexed image
*/
void combine_indexed_and_indexed_a_pixels(unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int);
/* combine indexed-alpha images with indexed-alpha images
* result is an indexed-alpha image. use this for painting
* to an indexed floating sel
*/
void combine_indexed_a_and_indexed_a_pixels(unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int);
/* combine intensity with indexed, destination is
* intensity-alpha...use this for an indexed floating sel
*/
void combine_inten_a_and_indexed_a_pixels(unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
unsigned char *, int, int, int);
/* combine RGB image with RGB or GRAY with GRAY
* destination is intensity-only...
*/
void combine_inten_and_inten_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int);
/* combine an RGBA or GRAYA image with an RGB or GRAY image
* destination is intensity-only...
*/
void combine_inten_and_inten_a_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int);
/* combine an RGB or GRAY image with an RGBA or GRAYA image
* destination is intensity-alpha...
*/
void combine_inten_a_and_inten_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int, int);
/* combine an RGBA or GRAYA image with an RGBA or GRAYA image
* destination is of course intensity-alpha...
*/
void combine_inten_a_and_inten_a_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int, int);
/* combine a channel with intensity-alpha pixels based
* on some opacity, and a channel color...
* destination is intensity-alpha
*/
void combine_inten_a_and_channel_mask_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int, int);
void combine_inten_a_and_channel_selection_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int, int);
/* paint "behind" the existing pixel row.
* This is similar in appearance to painting on a layer below
* the existing pixels.
*/
void behind_inten_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int, int, int, int);
/* paint "behind" the existing pixel row (for indexed images).
* This is similar in appearance to painting on a layer below
* the existing pixels.
*/
void behind_indexed_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int, int, int, int);
/* replace the contents of one pixel row with the other
* The operation is still bounded by mask/opacity constraints
*/
void replace_inten_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int, int, int, int);
/* replace the contents of one pixel row with the other
* The operation is still bounded by mask/opacity constraints
*/
void replace_indexed_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int, int, int, int);
/* apply source 2 to source 1, but in a non-additive way,
* multiplying alpha channels (works for intensity)
*/
void erase_inten_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int);
/* apply source 2 to source 1, but in a non-additive way,
* multiplying alpha channels (works for indexed)
*/
void erase_indexed_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int *, int, int);
/* extract information from intensity pixels based on
* a mask.
*/
void extract_from_inten_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int, int, int);
/* extract information from indexed pixels based on
* a mask.
*/
void extract_from_indexed_pixels (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
unsigned char *, int, int, int, int);
/* variable source to RGB color mapping
* src_type == 0 (RGB)
* src_type == 1 (GRAY)
* src_type == 2 (INDEXED)
*/
void
map_to_color (int, unsigned char *,
unsigned char *, unsigned char *);
/* RGB to index mapping functions...
*
* Hash table lookup speeds up the standard
* least squares method
*/
int map_rgb_to_indexed (unsigned char *, int, int,
int, int, int);
/* Region functions */
void color_region (PixelRegion *, unsigned char *);
void blend_region (PixelRegion *, PixelRegion *,
PixelRegion *, int);
void shade_region (PixelRegion *, PixelRegion *,
unsigned char *, int);
void copy_region (PixelRegion *, PixelRegion *);
void add_alpha_region (PixelRegion *, PixelRegion *);
void flatten_region (PixelRegion *, PixelRegion *,
unsigned char *);
void extract_alpha_region (PixelRegion *, PixelRegion *,
PixelRegion *);
void extract_from_region (PixelRegion *, PixelRegion *,
PixelRegion *, unsigned char *,
unsigned char *, int, int, int);
/* The types of convolutions */
#define NORMAL 0 /* Negative numbers truncated */
#define ABSOLUTE 1 /* Absolute value */
#define NEGATIVE 2 /* add 127 to values */
void convolve_region (PixelRegion *, PixelRegion *,
int *, int, int, int);
void multiply_alpha_region (PixelRegion *);
void separate_alpha_region (PixelRegion *);
void gaussian_blur_region (PixelRegion *, double);
void border_region (PixelRegion *, void *,
int, int);
void scale_region (PixelRegion *, PixelRegion *);
void scale_region_no_resample (PixelRegion *, PixelRegion *);
void subsample_region (PixelRegion *, PixelRegion *,
int);
float shapeburst_region (PixelRegion *, PixelRegion *);
/* The types of thinning */
#define SHRINK_REGION 0
#define GROW_REGION 1
int thin_region (PixelRegion *, int);
void swap_region (PixelRegion *, PixelRegion *);
/* Apply a mask to an image's alpha channel */
void apply_mask_to_region (PixelRegion *, PixelRegion *, int);
/* Combine a mask with an image's alpha channel */
void combine_mask_and_region (PixelRegion *, PixelRegion *, int);
/* Copy a gray image to an intensity-alpha region */
void copy_gray_to_region (PixelRegion *, PixelRegion *);
/* Lay down the groundwork for layer construction...
* This includes background images for indexed or non-alpha
* images, floating selections, selective display of intensity
* channels, and display of arbitrary mask channels
*/
#define INITIAL_CHANNEL_MASK 0
#define INITIAL_CHANNEL_SELECTION 1
#define INITIAL_INDEXED 2
#define INITIAL_INDEXED_ALPHA 3
#define INITIAL_INTENSITY 4
#define INITIAL_INTENSITY_ALPHA 5
void initial_region (PixelRegion *, PixelRegion *,
PixelRegion *, unsigned char *,
int, int, int *, int);
/* Combine two source regions with the help of an optional mask
* region into a destination region. This is used for constructing
* layer projections, and for applying image patches to an image
*/
#define COMBINE_INDEXED_INDEXED 0
#define COMBINE_INDEXED_INDEXED_A 1
#define COMBINE_INDEXED_A_INDEXED_A 2
#define COMBINE_INTEN_A_INDEXED_A 3
#define COMBINE_INTEN_A_CHANNEL_MASK 4
#define COMBINE_INTEN_A_CHANNEL_SELECTION 5
#define COMBINE_INTEN_INTEN 6
#define COMBINE_INTEN_INTEN_A 7
#define COMBINE_INTEN_A_INTEN 8
#define COMBINE_INTEN_A_INTEN_A 9
/* Non-conventional combination modes */
#define BEHIND_INTEN 20
#define BEHIND_INDEXED 21
#define REPLACE_INTEN 22
#define REPLACE_INDEXED 23
#define ERASE_INTEN 24
#define ERASE_INDEXED 25
#define NO_COMBINATION 26
void combine_regions (PixelRegion *, PixelRegion *,
PixelRegion *, PixelRegion *,
unsigned char *, int,
int, int *, int);
void combine_regions_replace (PixelRegion *, PixelRegion *,
PixelRegion *, PixelRegion *,
unsigned char *,
int, int *, int);
/* Color conversion routines */
void rgb_to_hsv (int *, int *, int *);
void hsv_to_rgb (int *, int *, int *);
void rgb_to_hls (int *, int *, int *);
void hls_to_rgb (int *, int *, int *);
/* Opacities */
#define TRANSPARENT_OPACITY 0
#define OPAQUE_OPACITY 255
/* Layer Modes */
#define NORMAL_MODE 0
#define DISSOLVE_MODE 1
#define BEHIND_MODE 2
#define MULTIPLY_MODE 3
#define SCREEN_MODE 4
#define OVERLAY_MODE 5
#define DIFFERENCE_MODE 6
#define ADDITION_MODE 7
#define SUBTRACT_MODE 8
#define DARKEN_ONLY_MODE 9
#define LIGHTEN_ONLY_MODE 10
#define HUE_MODE 11
#define SATURATION_MODE 12
#define COLOR_MODE 13
#define VALUE_MODE 14
#define ERASE_MODE 15
#define REPLACE_MODE 16
/* Applying layer modes... */
int apply_layer_mode (unsigned char *, unsigned char *,
unsigned char **, int, int, int,
int, int, int, int, int, int, int *);
int apply_indexed_layer_mode (unsigned char *, unsigned char *,
unsigned char **, int, int, int);
#endif /* __PAINT_FUNCS_H__ */
|