/usr/include/libAfterImage/transform.h is in libafterimage-dev 2.2.12-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #ifndef TRANSFORM_HEADER_FILE_INCLUDED
#define TRANSFORM_HEADER_FILE_INCLUDED
#include "asvisual.h"
#include "blender.h"
#include "asimage.h"
#ifdef __cplusplus
extern "C" {
#endif
/****h* libAfterImage/transform.h
* NAME
* transform
* SYNOPSIS
* Defines transformations that could be performed on ASImage.
* DESCRIPTION
*
* Transformations can be performed with different degree of quality.
* Internal engine uses 24.8 bits per channel per pixel. As the result
* there are no precision loss, while performing complex calculations.
* Error diffusion algorithms could be used to transform it back into 8
* bit without quality loss.
*
* Any Transformation could be performed with the result written directly
* into XImage, so that it could be displayed faster.
*
* Complex interpolation algorithms are used to perform scaling
* operations, thus yielding very good quality. All the transformations
* are performed in integer math, with the result of greater speeds.
* Optional MMX inline assembly has been incorporated into some
* procedures, and allows one to achieve considerably better performance on
* compatible CPUs.
*
* SEE ALSO
* Transformations :
* scale_asimage(), tile_asimage(), merge_layers(),
* make_gradient(), flip_asimage(), mirror_asimage(),
* pad_asimage(), blur_asimage_gauss(), fill_asimage(),
* adjust_asimage_hsv()
*
* Other libAfterImage modules :
* ascmap.h asfont.h asimage.h asvisual.h blender.h export.h
* import.h transform.h ximage.h
* AUTHOR
* Sasha Vasko <sasha at aftercode dot net>
*******/
/****f* libAfterImage/transform/scale_asimage()
* NAME
* scale_asimage() - scales source ASImage into new image of requested
* dimensions.
* SYNOPSIS
* ASImage *scale_asimage( struct ASVisual *asv,
* ASImage *src,
* unsigned int to_width,
* unsigned int to_height,
* ASAltImFormats out_format,
* unsigned int compression_out, int quality );
* INPUTS
* asv - pointer to valid ASVisual structure
* src - source ASImage
* to_width - desired width of the resulting image
* to_height - desired height of the resulting image
* out_format - optionally describes alternative ASImage format that
* should be produced as the result - XImage, ARGB32, etc.
* compression_out- compression level of resulting image in range 0-100.
* quality - output quality
* RETURN VALUE
* returns newly created and encoded ASImage on success, NULL of failure.
* DESCRIPTION
* If size has to be reduced - then several neighboring pixels will be
* averaged into single pixel. If size has to be increased then new
* pixels will be interpolated based on values of four neighboring pixels.
* EXAMPLE
* ASScale
*********/
/****f* libAfterImage/transform/tile_asimage()
* NAME
* tile_asimage() - tiles/crops ASImage to desired size, while optionaly
* tinting it at the same time.
* SYNOPSIS
* ASImage *tile_asimage ( struct ASVisual *asv,
* ASImage *src,
* int offset_x,
* int offset_y,
* unsigned int to_width,
* unsigned int to_height,
* ARGB32 tint,
* ASAltImFormats out_format,
* unsigned int compression_out, int quality );
* INPUTS
* asv - pointer to valid ASVisual structure
* src - source ASImage
* offset_x - left clip margin
* offset_y - right clip margin
* to_width - desired width of the resulting image
* to_height - desired height of the resulting image
* tint - ARGB32 value describing tinting color.
* out_format - optionally describes alternative ASImage format that
* should be produced as the result - XImage, ARGB32, etc.
* compression_out- compression level of resulting image in range 0-100.
* quality - output quality
* RETURN VALUE
* returns newly created and encoded ASImage on success, NULL of failure.
* DESCRIPTION
* Offset_x and offset_y define origin on source image from which
* tiling will start. If offset_x or offset_y is outside of the image
* boundaries, then it will be reduced by whole number of image sizes to
* fit inside the image. At the time of tiling image will be tinted
* unless tint == 0.
* EXAMPLE
* ASTile
*********/
/****f* libAfterImage/transform/merge_layers()
* NAME
* merge_layers()
* SYNOPSIS
* ASImage *merge_layers ( struct ASVisual *asv,
* ASImageLayer *layers, int count,
* unsigned int dst_width,
* unsigned int dst_height,
* ASAltImFormats out_format,
* unsigned int compression_out, int quality);
* INPUTS
* asv - pointer to valid ASVisual structure
* layers - array of ASImageLayer structures that will be rendered
* one on top of another. First element corresponds to
* the bottommost layer.
* dst_width - desired width of the resulting image
* dst_height - desired height of the resulting image
* out_format - optionally describes alternative ASImage format that
* should be produced as the result - XImage, ARGB32, etc.
* compression_out - compression level of resulting image in range 0-100.
* quality - output quality
* RETURN VALUE
* returns newly created and encoded ASImage on success, NULL of failure.
* DESCRIPTION
* merge_layers() will create new ASImage of requested size. It will then
* go through all the layers, and fill image with composition.
* Bottommost layer will be used unchanged and above layers will be
* superimposed on it, using algorithm specified in ASImageLayer
* structure of the overlaying layer. Layers may have smaller size
* then destination image, and maybe placed in arbitrary locations. Each
* layer will be padded to fit width of the destination image with all 0
* effectively making it transparent.
*********/
/****f* libAfterImage/transform/make_gradient()
* NAME
* make_gradient() - renders linear gradient into new ASImage
* SYNOPSIS
* ASImage *make_gradient ( struct ASVisual *asv,
* struct ASGradient *grad,
* unsigned int width,
* unsigned int height,
* ASFlagType filter,
* ASAltImFormats out_format,
* unsigned int compression_out, int quality);
* INPUTS
* asv - pointer to valid ASVisual structure
* grad - ASGradient structure defining how gradient should be
* drawn
* width - desired width of the resulting image
* height - desired height of the resulting image
* filter - only channels corresponding to set bits will be
* rendered.
* out_format - optionally describes alternative ASImage format that
* should be produced as the result - XImage, ARGB32, etc.
* compression_out- compression level of resulting image in range 0-100.
* quality - output quality
* RETURN VALUE
* returns newly created and encoded ASImage on success, NULL of failure.
* DESCRIPTION
* make_gradient() will create new image of requested size and it will
* fill it with gradient, described in structure pointed to by grad.
* Different dithering techniques will be applied to produce nicer
* looking gradients.
*********/
/****f* libAfterImage/transform/flip_asimage()
* NAME
* flip_asimage() - rotates ASImage in 90 degree increments
* SYNOPSIS
* ASImage *flip_asimage ( struct ASVisual *asv,
* ASImage *src,
* int offset_x, int offset_y,
* unsigned int to_width,
* unsigned int to_height,
* int flip, ASAltImFormats out_format,
* unsigned int compression_out, int quality );
* INPUTS
* asv - pointer to valid ASVisual structure
* src - source ASImage
* offset_x - left clip margin
* offset_y - right clip margin
* to_width - desired width of the resulting image
* to_height - desired height of the resulting image
* flip - flip flags determining degree of rotation.
* out_format - optionally describes alternative ASImage format that
* should be produced as the result - XImage, ARGB32, etc.
* compression_out - compression level of resulting image in range 0-100.
* quality - output quality
* RETURN VALUE
* returns newly created and encoded ASImage on success, NULL of failure.
* DESCRIPTION
* flip_asimage() will create new image of requested size, it will then
* tile source image based on offset_x, offset_y, and destination size,
* and it will rotate it then based on flip value. Three rotation angles
* supported 90, 180 and 270 degrees.
*********/
/****f* libAfterImage/transform/mirror_asimage()
* NAME
* mirror_asimage()
* SYNOPSIS
* ASImage *mirror_asimage ( struct ASVisual *asv,
* ASImage *src,
* int offset_x, int offset_y,
* unsigned int to_width,
* unsigned int to_height,
* Bool vertical, ASAltImFormats out_format,
* unsigned int compression_out, int quality );
* INPUTS
* asv - pointer to valid ASVisual structure
* src - source ASImage
* offset_x - left clip margin
* offset_y - right clip margin
* to_width - desired width of the resulting image
* to_height - desired height of the resulting image
* vertical - mirror in vertical direction.
* out_format - optionally describes alternative ASImage format that
* should be produced as the result - XImage, ARGB32, etc.
* compression_out - compression level of resulting image in range 0-100.
* quality - output quality
* RETURN VALUE
* returns newly created and encoded ASImage on success, NULL of failure.
* DESCRIPTION
* mirror_asimage() will create new image of requested size, it will then
* tile source image based on offset_x, offset_y, and destination size,
* and it will mirror it in vertical or horizontal direction.
*********/
/****f* libAfterImage/transform/pad_asimage()
* NAME
* pad_asimage() enlarges ASImage, padding it with specified color on
* each side in accordance with requested geometry.
* SYNOPSIS
* ASImage *pad_asimage( ASVisual *asv, ASImage *src,
* int dst_x, int dst_y,
* unsigned int to_width,
* unsigned int to_height,
* ARGB32 color,
* ASAltImFormats out_format,
* unsigned int compression_out, int quality );
* INPUTS
* asv - pointer to valid ASVisual structure
* src - source ASImage
* dst_x, dst_y - placement of the source image relative to the origin of
* destination image
* to_width - width of the destination image
* to_height - height of the destination image
* color - ARGB32 color value to pad with.
* out_format - optionally describes alternative ASImage format that
* should be produced as the result - XImage, ARGB32, etc.
* compression_out - compression level of resulting image in range 0-100.
* quality - output quality
* RETURN VALUE
* returns newly created and encoded ASImage on success, NULL of failure.
*********/
/****f* libAfterImage/transform/blur_asimage_gauss()
* NAME
* blur_asimage_gauss() Performs Gaussian blurr of the image
* ( useful for drop shadows and the likes ).
* SYNOPSIS
* ASImage* blur_asimage_gauss( ASVisual* asv, ASImage* src,
* double horz, double vert,
* ASAltImFormats out_format,
* unsigned int compression_out,
* int quality );
* INPUTS
* asv - pointer to valid ASVisual structure
* src - source ASImage
* horz - horizontal radius of the blurr
* vert - vertical radius of the blurr
* out_format - optionally describes alternative ASImage format that
* should be produced as the result - XImage, ARGB32, etc.
* compression_out - compression level of resulting image in range 0-100.
* quality - output quality
* RETURN VALUE
* returns newly created and encoded ASImage on success, NULL of failure.
*********/
/****f* libAfterImage/transform/fill_asimage()
* NAME
* fill_asimage() - Fills rectangle within the existing ASImage with
* specified color.
* SYNOPSIS
* Bool fill_asimage( ASVisual *asv, ASImage *im,
* int x, int y, int width, int height,
* ARGB32 color );
* INPUTS
* asv - pointer to valid ASVisual structure
* im - ASImage to fill with the color
* x, y - left-top corner of the rectangle to fill.
* width, height - size of the rectangle to fill.
* color - ARGB32 color value to fill rectangle with.
* RETURN VALUE
* True on success, False on failure.
*********/
/****f* libAfterImage/transform/adjust_asimage_hsv()
* NAME
* adjust_asimage_hsv() - adjusts image color properties in HSV colorspace
* SYNOPSIS
* ASImage *adjust_asimage_hsv( ASVisual *asv, ASImage *src,
* int offset_x, int offset_y,
* unsigned int to_width,
* unsigned int to_height,
* unsigned int affected_hue,
* unsigned int affected_radius,
* int hue_offset, int saturation_offset,
* int value_offset,
* ASAltImFormats out_format,
* unsigned int compression_out, int quality);
* INPUTS
* asv - pointer to valid ASVisual structure
* src - ASImage to adjust colors of.
* offset_x,
* offset_y - position on infinite surface tiled with original image,
* of the left-top corner of the area to be used for new
* image.
* to_width,
* to_height - size of the area of the original image to be used
* for new image.
* affected_hue - hue in degrees in range 0-360. This allows one to limit
* impact of color adjustment to affect only limited
* range of hues.
* affected_radius Sets the diapason of the range of affected hues.
* hue_offset - value by which to change hues in affected range.
* saturation_offset -
* value by which to change saturation of the pixels in
* affected hue range.
* value_offset - value by which to change Value(brightness) of pixels
* in affected hue range.
* out_format - optionally describes alternative ASImage format that
* should be produced as the result - XImage, ARGB32, etc.
* compression_out- compression level of resulting image in range 0-100.
* quality - output quality
* RETURN VALUE
* returns newly created and encoded ASImage on success, NULL of failure.
* DESCRIPTION
* This function will tile original image to specified size with offsets
* requested, and then it will go though it and adjust hue, saturation and
* value of those pixels that have specific hue, set by affected_hue/
* affected_radius parameters. When affected_radius is greater then 180
* entire image will be adjusted. Note that since grayscale colors have
* no hue - the will not get adjusted. Only saturation and value will be
* adjusted in gray pixels.
* Hue is measured as an angle on a 360 degree circle, The following is
* relationship of hue values to regular color names :
* red - 0
* yellow - 60
* green - 120
* cyan - 180
* blue - 240
* magenta - 300
* red - 360
*
* All the hue values in parameters will be adjusted to fall withing
* 0-360 range.
*********/
ASImage *scale_asimage( struct ASVisual *asv, ASImage *src,
int to_width, int to_height,
ASAltImFormats out_format,
unsigned int compression_out, int quality );
ASImage *scale_asimage2( ASVisual *asv, ASImage *src,
int clip_x, int clip_y,
int clip_width, int clip_height,
int to_width, int to_height,
ASAltImFormats out_format, unsigned int compression_out, int quality );
ASImage *tile_asimage ( struct ASVisual *asv, ASImage *src,
int offset_x, int offset_y,
int to_width, int to_height, ARGB32 tint,
ASAltImFormats out_format,
unsigned int compression_out, int quality );
ASImage *merge_layers ( struct ASVisual *asv, ASImageLayer *layers, int count,
int dst_width, int dst_height,
ASAltImFormats out_format,
unsigned int compression_out, int quality );
ASImage *make_gradient( struct ASVisual *asv, struct ASGradient *grad,
int width, int height, ASFlagType filter,
ASAltImFormats out_format,
unsigned int compression_out, int quality );
ASImage *flip_asimage( struct ASVisual *asv, ASImage *src,
int offset_x, int offset_y,
int to_width, int to_height,
int flip, ASAltImFormats out_format,
unsigned int compression_out, int quality );
ASImage *mirror_asimage( ASVisual *asv, ASImage *src,
int offset_x, int offset_y,
int to_width,
int to_height,
Bool vertical, ASAltImFormats out_format,
unsigned int compression_out, int quality );
ASImage *pad_asimage( ASVisual *asv, ASImage *src,
int dst_x, int dst_y,
int to_width,
int to_height,
ARGB32 color,
ASAltImFormats out_format,
unsigned int compression_out, int quality );
ASImage* blur_asimage_gauss( ASVisual* asv, ASImage* src,
double horz, double vert,
ASFlagType filter,
ASAltImFormats out_format,
unsigned int compression_out, int quality);
Bool fill_asimage( ASVisual *asv, ASImage *im,
int x, int y, int width, int height,
ARGB32 color );
ASImage* adjust_asimage_hsv( ASVisual *asv, ASImage *src,
int offset_x, int offset_y,
int to_width, int to_height,
int affected_hue, int affected_radius,
int hue_offset, int saturation_offset, int value_offset,
ASAltImFormats out_format,
unsigned int compression_out, int quality );
/****f* libAfterImage/transform/colorize_asimage_vector()
* NAME
* colorize_asimage_vector() creates ASImage from double precision indexed
* image data - useful for scientific visualisation.
* SYNOPSIS
* Bool colorize_asimage_vector( ASVisual *asv, ASImage *im,
* ASVectorPalette *palette,
* ASAltImFormats out_format,
* int quality );
* INPUTS
* asv - pointer to valid ASVisual structure
* im - ASImage to update.
* palette - palette to be used in conversion of double precision
* values into colors.
* out_format - optionally describes alternative ASImage format that
* should be produced as the result - XImage, ARGB32, etc.
* quality - output quality
* RETURN VALUE
* True on success, False on failure.
* DESCRIPTION
* This function will try to convert double precision indexed image data
* into actuall color image using palette. Original data should be
* attached to ASImage using vector member. Operation is relatively fast
* and allows representation of scientific data as color image with
* dynamically changing palette.
*********/
/****f* libAfterImage/transform/create_asimage_from_vector()
* NAME
* create_asimage_from_vector() - convinience function allowing to
* create new ASImage, set its vector data and colorize it using
* palette - all in one step.
* SYNOPSIS
* ASImage *create_asimage_from_vector( ASVisual *asv, double *vector,
* unsigned int width,
* unsigned int height,
* ASVectorPalette *palette,
* ASAltImFormats out_format,
* unsigned int compression,
* int quality );
* INPUTS
* asv - pointer to valid ASVisual structure
* vector - data to be attached to new ASImage and used to generate
* RGB image
* width, height - size of the new image.
* palette - palette to be used in conversion of double precision
* values into colors.
* out_format - optionally describes alternative ASImage format that
* should be produced as the result - XImage, ARGB32, etc.
* compression_out- compression level of resulting image in range 0-100.
* quality - output quality
* RETURN VALUE
* New ASImage on success, NULL on failure.
* SEE ALSO
* colorize_asimage_vector(), create_asimage(), set_asimage_vector()
*********/
/****f* libAfterImage/transform/slice_asimage2()
* NAME
* slice_asimage2() - slice ASImage leaving its corners intact, and scaling
* the middle part.
* SYNOPSIS
* ASImage*
* slice_asimage2( ASVisual *asv, ASImage *src,
* int slice_x_start, int slice_x_end,
* int slice_y_start, int slice_y_end,
* int to_width,
* int to_height,
* Bool scaled,
* ASAltImFormats out_format,
* unsigned int compression_out, int quality );
* INPUTS
* asv - pointer to valid ASVisual structure
* src - source ASImage.
* slice_x_start - ending of the left corners
* slice_x_end - beginning of the right corners
* slice_y_start - ending of the top corners
* slice_y_end - beginning of the bottom corners
* to_width - width of the generated image;
* to_height - height of the generated image;
* scaled - if True - middle part of the image will be scaled,
* otherwise - tiled;
* out_format - optionally describes alternative ASImage format that
* should be produced as the result - XImage, ARGB32, etc.;
* compression_out- compression level of resulting image in range 0-100;
* quality - output quality.
* RETURN VALUE
* New ASImage on success, NULL on failure.
* SEE ALSO
* scale_asimage(), tile_asimage()
*********/
Bool
colorize_asimage_vector( ASVisual *asv, ASImage *im,
ASVectorPalette *palette,
ASAltImFormats out_format,
int quality );
ASImage *
create_asimage_from_vector( ASVisual *asv, double *vector,
int width, int height,
ASVectorPalette *palette,
ASAltImFormats out_format,
unsigned int compression, int quality );
ASImage*
slice_asimage2( ASVisual *asv, ASImage *src,
int slice_x_start, int slice_x_end,
int slice_y_start, int slice_y_end,
int to_width,
int to_height,
Bool scaled, /* middle portion */
ASAltImFormats out_format,
unsigned int compression_out, int quality );
/* same as above with scale = 0 */
ASImage*
slice_asimage (ASVisual *asv, ASImage *src,
int slice_x_start, int slice_x_end,
int slice_y_start, int slice_y_end,
int to_width,
int to_height,
ASAltImFormats out_format,
unsigned int compression_out, int quality);
ASImage *
pixelize_asimage (ASVisual *asv, ASImage *src,
int clip_x, int clip_y, int clip_width, int clip_height,
int pixel_width, int pixel_height,
ASAltImFormats out_format, unsigned int compression_out, int quality );
ASImage *
color2alpha_asimage (ASVisual *asv, ASImage *src,
int clip_x, int clip_y, int clip_width, int clip_height,
ARGB32 color,
ASAltImFormats out_format, unsigned int compression_out, int quality);
#ifdef __cplusplus
}
#endif
#endif
|