1transform(1) AfterStep X11 window manager transform(1)
2
3
4
6 transform - transformations available for ASImages libAfterImage/transā
7 form.h
8
11 Defines transformations that could be performed on ASImage.
12
14 Transformations can be performed with different degree of quality.
15 Internal engine uses 24.8 bits per channel per pixel. As the result
16 there are no precision loss, while performing complex calculations.
17 Error diffusion algorithms could be used to transform it back into 8
18 bit without quality loss.
19
20 Any Transformation could be performed with the result written directly
21 into XImage, so that it could be displayed faster.
22
23 Complex interpolation algorithms are used to perform scaling
24 operations, thus yielding very good quality. All the transformations
25 are performed in integer math, with the result of greater speeds.
26 Optional MMX inline assembly has been incorporated into some
27 procedures, and allows to achieve considerably better performance on
28 compatible CPUs.
29
31 Transformations :
32 scale_asimage(), tile_asimage(), merge_layers(),
33 make_gradient(), flip_asimage(), mirror_asimage(),
34 pad_asimage(), blur_asimage_gauss(), fill_asimage(),
35 adjust_asimage_hsv()
36
37 Other libAfterImage modules :
38 ascmap.h asfont.h asimage.h asvisual.h blender.h export.h
39 import.h transform.h ximage.h
40
42 Sasha Vasko <sasha at aftercode dot net>
43
45 - scales source ASImage into new image of requested dimensions.
46
47
49 ASImage *scale_asimage( struct ASVisual *asv,
50 ASImage *src,
51 unsigned int to_width,
52 unsigned int to_height,
53 ASAltImFormats out_format,
54 unsigned int compression_out, int quality );
55
57 asv - pointer to valid ASVisual structure
58
59 src - source ASImage
60
61 to_width
62 - desired width of the resulting image
63
64 to_height
65 - desired height of the resulting image
66
67 out_format
68 - optionally describes alternative ASImage format that should be
69 produced as the result - XImage, ARGB32, etc.
70
71 compression_out-
72 compression level of resulting image in range 0-100.
73
74 quality
75 - output quality
76
77
79 returns newly created and encoded ASImage on success, NULL of failure.
80
82 If size has to be reduced - then several neighboring pixels will be
83 averaged into single pixel. If size has to be increased then new
84 pixels will be interpolated based on values of four neighboring pixels.
85
87 ASScale
88
90 - tiles/crops ASImage to desired size, while optionaly tinting it at
91 the same time.
92
93
95 ASImage *tile_asimage ( struct ASVisual *asv,
96 ASImage *src,
97 int offset_x,
98 int offset_y,
99 unsigned int to_width,
100 unsigned int to_height,
101 ARGB32 tint,
102 ASAltImFormats out_format,
103 unsigned int compression_out, int quality );
104
106 asv - pointer to valid ASVisual structure
107
108 src - source ASImage
109
110 offset_x
111 - left clip margin
112
113 offset_y
114 - right clip margin
115
116 to_width
117 - desired width of the resulting image
118
119 to_height
120 - desired height of the resulting image
121
122 tint - ARGB32 value describing tinting color.
123
124 out_format
125 - optionally describes alternative ASImage format that should be
126 produced as the result - XImage, ARGB32, etc.
127
128 compression_out-
129 compression level of resulting image in range 0-100.
130
131 quality
132 - output quality
133
134
136 returns newly created and encoded ASImage on success, NULL of failure.
137
139 Offset_x and offset_y define origin on source image from which
140 tiling will start. If offset_x or offset_y is outside of the image
141 boundaries, then it will be reduced by whole number of image sizes to
142 fit inside the image. At the time of tiling image will be tinted
143 unless tint == 0.
144
146 ASTile
147
150 ASImage *merge_layers ( struct ASVisual *asv,
151 ASImageLayer *layers, int count,
152 unsigned int dst_width,
153 unsigned int dst_height,
154 ASAltImFormats out_format,
155 unsigned int compression_out, int quality);
156
158 asv - pointer to valid ASVisual structure
159
160 layers - array of ASImageLayer structures that will be rendered one on
161 top of another. First element corresponds to the bottommost
162 layer.
163
164 dst_width
165 - desired width of the resulting image
166
167 dst_height
168 - desired height of the resulting image
169
170 out_format
171 - optionally describes alternative ASImage format that should be
172 produced as the result - XImage, ARGB32, etc.
173
174 compression_out
175 - compression level of resulting image in range 0-100.
176
177 quality
178 - output quality
179
180
182 returns newly created and encoded ASImage on success, NULL of failure.
183
185 merge_layers() will create new ASImage of requested size. It will then
186 go through all the layers, and fill image with composition.
187 Bottommost layer will be used unchanged and above layers will be
188 superimposed on it, using algorithm specified in ASImageLayer
189 structure of the overlaying layer. Layers may have smaller size
190 then destination image, and maybe placed in arbitrary locations. Each
191 layer will be padded to fit width of the destination image with all 0
192 effectively making it transparent.
193
195 - renders linear gradient into new ASImage
196
197
199 ASImage *make_gradient ( struct ASVisual *asv,
200 struct ASGradient *grad,
201 unsigned int width,
202 unsigned int height,
203 ASFlagType filter,
204 ASAltImFormats out_format,
205 unsigned int compression_out, int quality);
206
208 asv - pointer to valid ASVisual structure
209
210 grad - ASGradient structure defining how gradient should be drawn
211
212 width - desired width of the resulting image
213
214 height - desired height of the resulting image
215
216 filter - only channels corresponding to set bits will be rendered.
217
218 out_format
219 - optionally describes alternative ASImage format that should be
220 produced as the result - XImage, ARGB32, etc.
221
222 compression_out-
223 compression level of resulting image in range 0-100.
224
225 quality
226 - output quality
227
228
230 returns newly created and encoded ASImage on success, NULL of failure.
231
233 make_gradient() will create new image of requested size and it will
234 fill it with gradient, described in structure pointed to by grad.
235 Different dithering techniques will be applied to produce nicer
236 looking gradients.
237
239 - rotates ASImage in 90 degree increments
240
241
243 ASImage *flip_asimage ( struct ASVisual *asv,
244 ASImage *src,
245 int offset_x, int offset_y,
246 unsigned int to_width,
247 unsigned int to_height,
248 int flip, ASAltImFormats out_format,
249 unsigned int compression_out, int quality );
250
252 asv - pointer to valid ASVisual structure
253
254 src - source ASImage
255
256 offset_x
257 - left clip margin
258
259 offset_y
260 - right clip margin
261
262 to_width
263 - desired width of the resulting image
264
265 to_height
266 - desired height of the resulting image
267
268 flip - flip flags determining degree of rotation.
269
270 out_format
271 - optionally describes alternative ASImage format that should be
272 produced as the result - XImage, ARGB32, etc.
273
274 compression_out
275 - compression level of resulting image in range 0-100.
276
277 quality
278 - output quality
279
280
282 returns newly created and encoded ASImage on success, NULL of failure.
283
285 flip_asimage() will create new image of requested size, it will then
286 tile source image based on offset_x, offset_y, and destination size,
287 and it will rotate it then based on flip value. Three rotation angles
288 supported 90, 180 and 270 degrees.
289
292 ASImage *mirror_asimage ( struct ASVisual *asv,
293 ASImage *src,
294 int offset_x, int offset_y,
295 unsigned int to_width,
296 unsigned int to_height,
297 Bool vertical, ASAltImFormats out_format,
298 unsigned int compression_out, int quality );
299
301 asv - pointer to valid ASVisual structure
302
303 src - source ASImage
304
305 offset_x
306 - left clip margin
307
308 offset_y
309 - right clip margin
310
311 to_width
312 - desired width of the resulting image
313
314 to_height
315 - desired height of the resulting image
316
317 vertical
318 - mirror in vertical direction.
319
320 out_format
321 - optionally describes alternative ASImage format that should be
322 produced as the result - XImage, ARGB32, etc.
323
324 compression_out
325 - compression level of resulting image in range 0-100.
326
327 quality
328 - output quality
329
330
332 returns newly created and encoded ASImage on success, NULL of failure.
333
335 mirror_asimage() will create new image of requested size, it will then
336 tile source image based on offset_x, offset_y, and destination size,
337 and it will mirror it in vertical or horizontal direction.
338
340 enlarges ASImage, padding it with specified color on each side in
341 accordance with requested geometry.
342
343
345 ASImage *pad_asimage( ASVisual *asv, ASImage *src,
346 int dst_x, int dst_y,
347 unsigned int to_width,
348 unsigned int to_height,
349 ARGB32 color,
350 ASAltImFormats out_format,
351 unsigned int compression_out, int quality );
352
354 asv - pointer to valid ASVisual structure
355
356 src - source ASImage
357
358 dst_x, dst_y - placement of the source image relative to the origin of
359 destination image
360
361 to_width
362 - width of the destination image
363
364 to_height
365 - height of the destination image
366
367 color - ARGB32 color value to pad with.
368
369 out_format
370 - optionally describes alternative ASImage format that should be
371 produced as the result - XImage, ARGB32, etc.
372
373 compression_out
374 - compression level of resulting image in range 0-100.
375
376 quality
377 - output quality
378
379
381 returns newly created and encoded ASImage on success, NULL of failure.
382
384 Performs Gaussian blurr of the image ( usefull for drop shadows and the
385 likes ).
386
387
389 ASImage* blur_asimage_gauss( ASVisual* asv, ASImage* src,
390 double horz, double vert,
391 ASAltImFormats out_format,
392 unsigned int compression_out,
393 int quality );
394
396 asv - pointer to valid ASVisual structure
397
398 src - source ASImage
399
400 horz - horizontal radius of the blurr
401
402 vert - vertical radius of the blurr
403
404 out_format
405 - optionally describes alternative ASImage format that should be
406 produced as the result - XImage, ARGB32, etc.
407
408 compression_out
409 - compression level of resulting image in range 0-100.
410
411 quality
412 - output quality
413
414
416 returns newly created and encoded ASImage on success, NULL of failure.
417
419 - Fills rectangle within the existing ASImage with specified color.
420
421
423 Bool fill_asimage( ASVisual *asv, ASImage *im,
424 int x, int y, int width, int height,
425 ARGB32 color );
426
428 asv - pointer to valid ASVisual structure
429
430 im - ASImage to fill with the color
431
432 x, y - left-top corner of the rectangle to fill.
433
434 width, height - size of the rectangle to fill.
435
436 color - ARGB32 color value to fill rectangle with.
437
438
440 True on success, False on failure.
441
443 - adjusts image color properties in HSV colorspace
444
445
447 ASImage *adjust_asimage_hsv( ASVisual *asv, ASImage *src,
448 int offset_x, int offset_y,
449 unsigned int to_width,
450 unsigned int to_height,
451 unsigned int affected_hue,
452 unsigned int affected_radius,
453 int hue_offset, int saturation_offset,
454 int value_offset,
455 ASAltImFormats out_format,
456 unsigned int compression_out, int quality);
457
459 asv - pointer to valid ASVisual structure
460
461 src - ASImage to adjust colors of.
462
463 offset_x,
464
465
466 offset_y
467 - position on infinite surface tiled with original image, of the
468 left-top corner of the area to be used for new image.
469
470 to_width,
471
472
473 to_height
474 - size of the area of the original image to be used for new
475 image.
476
477 affected_hue
478 - hue in degrees in range 0-360. This allows to limit impact of
479 color adjustment to affect only limited range of hues.
480
481 affected_radius
482 Sets the diapason of the range of affected hues.
483
484 hue_offset
485 - value by which to change hues in affected range.
486
487 saturation_offset
488 - value by which to change saturation of the pixels in affected
489 hue range.
490
491 value_offset
492 - value by which to change Value(brightness) of pixels in
493 affected hue range.
494
495 out_format
496 - optionally describes alternative ASImage format that should be
497 produced as the result - XImage, ARGB32, etc.
498
499 compression_out-
500 compression level of resulting image in range 0-100.
501
502 quality
503 - output quality
504
505
507 returns newly created and encoded ASImage on success, NULL of failure.
508
510 This function will tile original image to specified size with offsets
511 requested, and then it will go though it and adjust hue, saturation and
512 value of those pixels that have specific hue, set by affected_hue/
513 affected_radius parameters. When affected_radius is greater then 180
514 entire image will be adjusted. Note that since grayscale colors have
515 no hue - the will not get adjusted. Only saturation and value will be
516 adjusted in gray pixels.
517 Hue is measured as an angle on a 360 degree circle, The following is
518 relationship of hue values to regular color names :
519 red - 0
520 yellow - 60
521 green - 120
522 cyan - 180
523 blue - 240
524 magenta - 300
525 red - 360
526
527 All the hue values in parameters will be adjusted to fall withing
528 0-360 range.
529
531 creates ASImage from double precision indexed image data - usefull for
532 scientific visualisation.
533
534
536 Bool colorize_asimage_vector( ASVisual *asv, ASImage *im,
537 ASVectorPalette *palette,
538 ASAltImFormats out_format,
539 int quality );
540
542 asv - pointer to valid ASVisual structure
543
544 im - ASImage to update.
545
546 palette
547 - palette to be used in conversion of double precision values
548 into colors.
549
550 out_format
551 - optionally describes alternative ASImage format that should be
552 produced as the result - XImage, ARGB32, etc.
553
554 quality
555 - output quality
556
557
559 True on success, False on failure.
560
562 This function will try to convert double precision indexed image data
563 into actuall color image using palette. Original data should be
564 attached to ASImage using vector member. Operation is relatively fast
565 and allows representation of scientific data as color image with
566 dynamically changing palette.
567
569 - convinience function allowing to create new ASImage, set its vector
570 data and colorize it using palette - all in one step.
571
572
574 ASImage *create_asimage_from_vector( ASVisual *asv, double *vector,
575 unsigned int width,
576 unsigned int height,
577 ASVectorPalette *palette,
578 ASAltImFormats out_format,
579 unsigned int compression,
580 int quality );
581
583 asv - pointer to valid ASVisual structure
584
585 vector - data to be attached to new ASImage and used to generate RGB
586 image
587
588 width, height - size of the new image.
589
590 palette
591 - palette to be used in conversion of double precision values
592 into colors.
593
594 out_format
595 - optionally describes alternative ASImage format that should be
596 produced as the result - XImage, ARGB32, etc.
597
598 compression_out-
599 compression level of resulting image in range 0-100.
600
601 quality
602 - output quality
603
604
606 New ASImage on success, NULL on failure.
607
609 colorize_asimage_vector(), create_asimage(), set_asimage_vector()
610
612 - slice ASImage leaving its corners intact, and scaling the middle
613 part.
614
615
617 ASImage*
618 slice_asimage2( ASVisual *asv, ASImage *src,
619 int slice_x_start, int slice_x_end,
620 int slice_y_start, int slice_y_end,
621 int to_width,
622 int to_height,
623 Bool scaled,
624 ASAltImFormats out_format,
625 unsigned int compression_out, int quality );
626
628 asv - pointer to valid ASVisual structure
629
630 src - source ASImage.
631
632 slice_x_start
633 - ending of the left corners
634
635 slice_x_end
636 - begining of the right corners
637
638 slice_y_start
639 - ending of the top corners
640
641 slice_y_end
642 - begining of the bottom corners
643
644 to_width
645 - width of the generated image;
646
647 to_height
648 - height of the generated image;
649
650 scaled - if True - middle part of the image will be scaled, otherwise -
651 tiled;
652
653 out_format
654 - optionally describes alternative ASImage format that should be
655 produced as the result - XImage, ARGB32, etc.;
656
657 compression_out-
658 compression level of resulting image in range 0-100;
659
660 quality
661 - output quality.
662
663
665 New ASImage on success, NULL on failure.
666
668 scale_asimage(), tile_asimage()
669
670
671
6723rd Berkeley Distribution AfterStep v.2.2.6 transform(1)