1asimage(1)               AfterStep X11 window manager               asimage(1)
2
3
4

NAME

6       asimage -  internal  structures and methods used for image manipulation
7       in libAfterImage libAfterImage/asimage.h
8

NAMEasimage

10       defines main structures and function for image manipulation.
11
12

DESCRIPTION

14       libAfterImage provides powerful functionality to load, store
15       and transform images. It allows for smaller memory utilization by
16       utilizing run-length encoding of the image data. There could be
17       different levels of compression selected, allowing to choose best
18       speed/memory ratio.
19

SEE ALSO

21       Structures :
22                ASImage
23                ASImageManager
24                ASImageBevel
25                ASImageDecoder
26                ASImageOutput
27                ASImageLayer
28                ASGradient
29
30       Functions :
31                asimage_init(), asimage_start(), create_asimage(),
32                clone_asimage(), destroy_asimage()
33
34         ImageManager Reference counting and managing :
35                create_image_manager(), destroy_image_manager(),
36                store_asimage(), fetch_asimage(), query_asimage(),
37                dup_asimage(), release_asimage(),
38                release_asimage_by_name(), forget_asimage(),
39                safe_asimage_destroy()
40
41         Gradients helper functions :
42                flip_gradient(), destroy_asgradient()
43
44         Layers helper functions :
45                init_image_layers(), create_image_layers(),
46                destroy_image_layers()
47
48         Encoding :
49                asimage_add_line(),    asimage_add_line_mono(),
50                asimage_print_line(), get_asimage_chanmask(),
51                move_asimage_channel(), copy_asimage_channel(),
52                copy_asimage_lines()
53
54         Decoding
55                start_image_decoding(), stop_image_decoding(),
56                asimage_decode_line (), set_decoder_shift(),
57                set_decoder_back_color()
58
59         Output :
60                start_image_output(), set_image_output_back_color(),
61                toggle_image_output_direction(), stop_image_output()
62
63       Other libAfterImage modules :
64                ascmap.h asfont.h asimage.h asvisual.h blender.h export.h
65                import.h transform.h ximage.h
66

AUTHOR

68       Sasha Vasko <sasha at aftercode dot net>
69

NAMEASAltImFormats

71       identifies what output format should be used for storing the  transfor‐
72       mation  result.  Also  identifies  what data is currently stored in alt
73       member of ASImage structure.
74
75

SOURCE

77       Source :
78       typedef enum {
79           ASA_ASImage = 0,
80           ASA_XImage,
81           ASA_MaskXImage,
82           /* temporary XImages to be allocated from static pool of memory :*/
83           ASA_ScratchXImage,
84           ASA_ScratchMaskXImage,
85
86           ASA_ScratchXImageAndAlpha,
87
88           ASA_ARGB32,
89           ASA_Vector,       /* This cannot be used for transformation's result
90                              * format */
91           ASA_Formats
92       }ASAltImFormats;
93

NAMEASImage

95       is the main structure to hold image data.
96
97

DESCRIPTION

99       Images are stored internally split into ARGB channels, each split
100       into scanline. Actuall data is stored using ASStorage container. Inside
101       ASImage data structure we only store IDs pointing to data in ASStorage
102       ASStorage implements reference counting, data compression,
103       automatic memory defragmentation and other nice things.
104

SEE ALSO

106        asimage_init()
107        asimage_start()
108        create_asimage()
109        destroy_asimage()
110

SOURCE

112       Source :
113       struct ASImageAlternative;
114       struct ASImageManager;
115
116       /* magic number identifying ASFont data structure */
117       #define MAGIC_ASIMAGE            0xA3A314AE
118
119       typedef struct ASImage
120       {
121
122         unsigned long magic ;
123
124         unsigned int width, height;       /* size of the image in pixels */
125
126         /* arrays of storage ids of stored scanlines of particular channel: */
127         ASStorageID *alpha,
128                     *red,
129                     *green,
130                     *blue;
131
132         ASStorageID *channels[IC_NUM_CHANNELS];
133                                           /* merely a shortcut so we can
134                                            * somewhat simplify code in loops */
135
136         ARGB32 back_color ;               /* background color of the image, so
137                                            * we could discard everything that
138                                            * matches it, and then restore it
139                                            * back. */
140
141         struct ASImageAlternative
142         {  /* alternative forms of ASImage storage : */
143           XImage *ximage ;                /* pointer to XImage created as the
144                                            * result of transformations whenever
145                                            * we request it to output into
146                                            * XImage ( see to_xim parameter ) */
147           XImage *mask_ximage ;           /* XImage of depth 1 that could be
148                                            * used to store mask of the image */
149           ARGB32 *argb32 ;                /* array of widthxheight ARGB32
150                                            * values */
151           double *vector ;                /* scientific data that should be used
152                                            * in conjunction with
153                                            * ASScientificPalette to produce
154                                            * actuall ARGB data */
155         }alt;
156
157         struct ASImageManager *imageman;  /* if not null - then image could be
158                                            * referenced by some other code */
159         int                    ref_count ;/* this will tell us what us how many
160                                            * times */
161
162
163         char                  *name ;     /* readonly copy of image name
164                                            * this name is a hash value used to
165                                            * store image in the image-man's hash,
166                                            * and gets freed automagically on image
167                                            * removal from hash */
168
169       #define ASIM_DATA_NOT_USEFUL    (0x01<<0)
170       #define ASIM_VECTOR_TOP2BOTTOM  (0x01<<1)
171       #define ASIM_XIMAGE_8BIT_MASK   (0x01<<2)
172       #define ASIM_NO_COMPRESSION     (0x01<<3) /* Do not use compression to
173                                                  * save some computation time
174                                                  */
175       #define ASIM_ALPHA_IS_BITMAP    (0x01<<4)
176       #define ASIM_RGB_IS_BITMAP      (0x01<<5)
177       #define ASIM_XIMAGE_NOT_USEFUL  (0x01<<6)
178       #define ASIM_NAME_IS_FILENAME   (0x01<<7)
179
180         ASFlagType             flags ;    /* combination of the above flags */
181
182       } ASImage;
183

NAMEASImageManager

185       structure to be used to maintain list of loaded images for given set of
186       search paths and gamma. Images are named and reference counted.
187
188

SOURCE

190       Source :
191       typedef struct ASImageManager
192       {
193           ASHashTable  *image_hash ;
194           /* misc stuff that may come handy : */
195           char         *search_path[MAX_SEARCH_PATHS+1];
196           double        gamma ;
197       }ASImageManager;
198

NAMEMAX_IMPORT_IMAGE_SIZE

200       effectively  limits size of the allowed images to be loaded from files.
201       That is needed to be able to filter out corrupt files.   MAX_BEVEL_OUT‐
202       LINE   Limit   on   bevel   outline  to  be  drawn  around  the  image.
203       MAX_SEARCH_PATHS Number of search paths to be used while loading images
204       from files.
205
206       Source :
207       #define MAX_IMPORT_IMAGE_SIZE   8000
208       #define MAX_BEVEL_OUTLINE       100
209       #define MAX_SEARCH_PATHS        8      /* prudently limiting ourselfs */
210

NAMEASVectorPalette

212       contains pallette allowing us to map double values in vector image data
213       into actuall ARGB values.
214
215

SOURCE

217       Source :
218       typedef struct ASVectorPalette
219       {
220           unsigned int npoints ;
221           double *points ;
222           CARD16 *channels[IC_NUM_CHANNELS] ;   /* ARGB data for key points. */
223           ARGB32  default_color;
224       }ASVectorPalette;
225

NAMEASImageLayer

227       specifies parameters of the image superimposition.
228
229

DESCRIPTION

231       libAfterImage allows for simultaneous superimposition (overlaying) of
232       arbitrary number of images. To facilitate this ASImageLayer structure
233       has been created in order to specify parameters of each image
234       participating in overlaying operation. Images need not to be exact
235       same size. For each image its position on destination is specified
236       via dst_x and dst_y data members. Each image maybe tiled and clipped
237       to fit into rectangle specified by clip_x, clip_y, clip_width,
238       clip_height ( in image coordinates - not destination ). If image is
239       missing, then area specified by dst_x, dst_y, clip_width, clip_height
240       will be filled with solid_color.
241       Entire image will be tinted using tint parameter prior to overlaying.
242       Bevel specified by bevel member will be drawn over image prior to
243       overlaying. Specific overlay method has to be specified.
244       merge_scanlines method is pointer to a function,
245       that accepts 2 ASScanlines as arguments and performs overlaying of
246       first one with the second one.
247       There are 15 different merge_scanline methods implemented in
248       libAfterImage, including alpha-blending, tinting, averaging,
249       HSV and HSL colorspace operations, etc.
250

NOTES

252       ASImageLayer s could be organized into chains using next pointers.
253       Since there could be a need to rearrange layers and maybe bypass some
254       layers - we need to provide for flexibility, while at the same time
255       allowing for simplicity of arrays. As the result next pointers could
256       be used to link together continuous arrays of layer, like so :
257       array1: [layer1(next==NULL)][layer2(next!=NULL)]
258                ____________________________|
259                V
260       array2: [layer3(next==NULL)][layer4(next==NULL)][layer5(next!=NULL)]
261                ________________________________________________|
262                V
263       array3: [layer6(next==NULL)][layer7(next==layer7)]
264                                      ^______|
265
266       While iterating throught such a list we check for two conditions -
267       exceeding count of layers and layer pointing to self. When any of
268       that is met - we stopping iteration.
269

SEE ALSO

271       merge_layers()
272       blender.h
273

SOURCE

275       Source :
276       typedef struct ASImageLayer
277       {
278           ASImage *im;
279           ARGB32   solid_color ;              /* If im == NULL, then fill
280                                                * the area with this color. */
281
282           int dst_x, dst_y;                   /* placement in overall
283                                                * composition */
284
285           /* clip area could be partially outside of the image -
286            * image gets tiled in it */
287           int clip_x, clip_y;
288           unsigned int clip_width, clip_height;
289
290           ARGB32 tint ;                       /* if 0 - no tint */
291           struct ASImageBevel *bevel ;        /* border to wrap layer with
292                                                * (for buttons, etc.)*/
293
294           /* if image is clipped then we need to specify offsets of bevel as
295            * related to clipped rectangle. Normally it should be :
296            * 0, 0, im->width, im->height. And if width/height left 0 - it will
297            * default to this values. Note that clipped image MUST be entirely
298            * inside the bevel rectangle. !!!*/
299           int bevel_x, bevel_y;
300           unsigned int bevel_width, bevel_height;
301
302           int merge_mode ;                        /* reserved for future use */
303           merge_scanlines_func merge_scanlines ;  /* overlay method */
304           struct ASImageLayer *next;              /* optional pointer to next
305                                                    * layer. If it points to
306                                                    * itself - then end of the
307                                                    * chain.*/
308           void *data;                             /* hook to hung data on */
309       }ASImageLayer;
310

FUNCTION

312       Combination of this flags defines the way gradient is rendered.
313

NAMEGRADIENT_TYPE_DIAG

315       when set it will cause gradient's direction to be rotated by 45 degrees
316       GRADIENT_TYPE_ORIENTATION  will  cause gradient direction to be rotated
317       by 90 degrees. When combined with GRADIENT_TYPE_DIAG - rotates gradient
318       direction by 135 degrees.
319
320

SOURCE

322       Source :
323       #define GRADIENT_TYPE_DIAG          (0x01<<0)
324       #define GRADIENT_TYPE_ORIENTATION   (0x01<<1)
325       #define GRADIENT_TYPE_MASK          (GRADIENT_TYPE_ORIENTATION|                                      GRADIENT_TYPE_DIAG)
326

FUNCTION

328       This are named combinations of above flags to define type of gradient.
329

NAMEGRADIENT_Left2Right

331       normal  left-to-right  gradient.  GRADIENT_TopLeft2BottomRight diagonal
332       top-left to bottom-right.  GRADIENT_Top2Bottom vertical top  to  bottom
333       gradient.   GRADIENT_BottomLeft2TopRight  diagonal  bottom-left to top-
334       right.
335
336

SOURCE

338       Source :
339       #define GRADIENT_Left2Right             0
340       #define GRADIENT_TopLeft2BottomRight    GRADIENT_TYPE_DIAG
341       #define GRADIENT_Top2Bottom             GRADIENT_TYPE_ORIENTATION
342       #define GRADIENT_BottomLeft2TopRight    (GRADIENT_TYPE_DIAG|                                          GRADIENT_TYPE_ORIENTATION)
343

NAMEASGradient

345       describes how gradient is to be drawn.
346
347

DESCRIPTION

349       libAfterImage includes functionality to draw multipoint gradients in
350       4 different directions left->right, top->bottom and diagonal
351       lefttop->rightbottom and bottomleft->topright. Each gradient described
352       by type, number of colors (or anchor points), ARGB values for each
353       color and offsets of each point from the beginning of gradient in
354       fractions of entire length. There should be at least 2 anchor points.
355       very first point should have offset of 0. and last point should have
356       offset of 1. Gradients are drawn in ARGB colorspace, so it is possible
357       to have semitransparent gradients.
358

SEE ALSO

360       make_gradient()
361

SOURCE

363       Source :
364       typedef struct ASGradient
365       {
366           int         type;     /* see GRADIENT_TYPE above */
367
368           int         npoints;  /* number of anchor points */
369           ARGB32     *color;    /* ARGB color values for each anchor point*/
370           double     *offset;   /* offset of each point from the beginning in
371                                  * fractions of entire length */
372       }ASGradient;
373

FUNCTION

375       This are flags that define rotation angle.
376

NAMEFLIP_VERTICAL

378       defines  rotation  of  90  degrees  counterclockwise.   FLIP_UPSIDEDOWN
379       defines  rotation of 180 degrees counterclockwise. combined they define
380       rotation of 270 degrees counterclockwise.
381
382

SOURCE

384       Source :
385       #define FLIP_VERTICAL       (0x01<<0)
386       #define FLIP_UPSIDEDOWN     (0x01<<1)
387       #define FLIP_MASK           (FLIP_UPSIDEDOWN|FLIP_VERTICAL)
388

NAMEflip_gradient()

390       - rotates gradient in 90 degree increments.
391
392

SYNOPSIS

394       ASGradient *flip_gradient( ASGradient *orig, int flip );
395

INPUTS

397       orig   - pointer to original ASGradient structure to be rotated.
398
399       flip   - value defining desired rotation.
400
401

RETURN VALUE

403       Same as original gradient if flip is 0. New gradient structure in any
404       other case.
405

DESCRIPTION

407       Rotates ( flips ) gradient data in 90 degree increments. When needed
408       order of points is reversed.
409

FUNCTION

411       We use 32 bit ARGB values to define how tinting should be done.
412       The formula for tinting particular channel data goes like that:
413       tinted_data = (image_data * tint)/128
414       So if tint channel value is greater then 127 - same channel will be
415       brighter in destination image; if it is lower then 127 - same channel
416       will be darker in destination image. Tint channel value of 127
417       ( or 0x7F hex ) does not change anything.
418       Alpha channel is tinted as well, allowing for creation of
419       semitransparent images. Calculations are performed in 24.8 format -
420       with 8 bit precision. Result is saturated to avoid overflow, and
421       precision is carried over to next pixel ( error diffusion ), when con
422       verting 24.8 to 8 bit format.
423

NAMETINT_NONE

425       special value that disables tinting TINT_LEAVE_SAME also disables tint‐
426       ing.
427
428

SOURCE

430       Source :
431       #define TINT_NONE           0
432       #define TINT_LEAVE_SAME     (0x7F7F7F7F)
433       #define TINT_HALF_DARKER    (0x3F3F3F3F)
434       #define TINT_HALF_BRIGHTER  (0xCFCFCFCF)
435       #define TINT_RED            (0x7F7F0000)
436       #define TINT_GREEN          (0x7F007F00)
437       #define TINT_BLUE           (0x7F00007F)
438

FUNCTION

440       Defines the level of compression to attempt on ASImage scanlines.
441

NAMEASIM_COMPRESSION_NONE

443       defined  as 0 - disables compression.  ASIM_COMPRESSION_FULL defined as
444       100 - highest compression level. Anything in between  0  and  100  will
445       cause only part of the scanline to be compressed. This is obsolete. Now
446       all images are  compressed  if  possible.   libAfterImage/asimage/asim‐
447       age_init()
448

NAMEasimage_init()

450       frees datamembers of the supplied ASImage structure, and initializes it
451       to all 0.
452
453

SYNOPSIS

455       void asimage_init (ASImage * im, Bool free_resources);
456

INPUTS

458       im     - pointer to valid ASImage structure
459
460       free_resources
461              - if True will make function attempt to free all non-NULL point‐
462              ers.  libAfterImage/asimage/flush_asimage_cache()
463

NAMEflush_asimage_cache()

465       destroys  XImage and mask XImage kept from previous conversions to/from
466       X Pixmap.
467
468

SYNOPSIS

470       void flush_asimage_cache (ASImage * im );
471

INPUTS

473       im     - pointer to valid ASImage structure libAfterImage/asimage/asim‐
474              age_start()
475

NAMEasimage_start()

477       Allocates  memory  needed  to  store  scanline of the image of supplied
478       size. Assigns all the data members valid values. Makes sure that  ASIm‐
479       age structure is ready to store image data.
480
481

SYNOPSIS

483       void asimage_start (ASImage * im, unsigned int width,
484                                         unsigned int height,
485                                         unsigned int compression);
486

INPUTS

488       im     - pointer to valid ASImage structure
489
490       width  - width of the image
491
492       height - height of the image
493
494       compression
495              - level of compression to perform on image data. compression has
496              to be in range of 0-100 with 100  signifying  highest  level  of
497              compression.
498
499

NOTES

501       In order to resize ASImage structure after asimage_start() has been
502       called, asimage_init() must be invoked to free all the memory, and
503       then asimage_start() has to be called with new dimensions.
504

NAMEcreate_asimage()

506       Performs  memory  allocation  for the new ASImage structure, as well as
507       initialization of allocated structure based on supplied parameters.
508
509

SYNOPSIS

511       ASImage *create_asimage( unsigned int width,
512                                unsigned int height,
513                                unsigned int compression);
514

INPUTS

516       width  - desired image width
517
518       height - desired image height
519
520       compression
521              - compression level in new ASImage( see asimage_start() for more
522              ).
523
524

RETURN VALUE

526       Pointer to newly allocated and initialized ASImage structure on
527       Success. NULL in case of any kind of error - that should never happen.
528

NAMEclone_asimage()

SYNOPSIS

531       ASImage *clone_asimage(ASImage *src, ASFlagType filter );
532

INPUTS

534       src    - original ASImage.
535
536       filter - bitmask of channels to be copied from one image to another.
537
538

RETURN VALUE

540       New ASImage, as a copy of original image.
541

DESCRIPTION

543       Creates exact clone of the original ASImage, with same compression,
544       back_color and rest of the attributes. Only ASImage data will be
545       carried over. Any attached alternative forms of images (XImages, etc.)
546       will not be copied. Any channel with unset bit in filter will not be
547       copied. Image name, ASImageManager and ref_count will not be copied -
548       use store_asimage() afterwards and make sure you use different name,
549       to avoid clashes with original image.
550

NAMEdestroy_asimage()

552       frees all the memory allocated for specified ASImage.
553
554

SYNOPSIS

556       void destroy_asimage( ASImage **im );
557

INPUTS

559       im     - pointer to valid ASImage structure.
560
561

NOTES

563       If there was XImage attached to it - it will be deallocated as well.
564

EXAMPLE

566       asview.c: ASView.5
567

NAMEasimage_replace()

569       will replace ASImage's data using data from another ASImage
570
571

SYNOPSIS

573       Bool asimage_replace (ASImage *im, ASImage *from);
574

INPUTS

576       im     - pointer to valid ASImage structure.
577
578       from   - pointer to ASImage from which to take the data.
579
580

NOTES

582       this function updates image without reallocating structure itself, which
583       means that all pointers to it will still be valid. If that function
584       succeeds - [from] ASImage will become unusable and should be deallocated
585       using free() call.
586

NAMEset_asimage_vector()

588       This  function replaces contents of the vector member of ASImage struc‐
589       ture with new double precision data.
590
591

SYNOPSIS

593       set_asimage_vector( ASImage *im, register double *vector );
594

INPUTS

596       im     - pointer to valid ASImage structure.
597
598       vector - scientific data to attach to the image.
599
600

NOTES

602       Data must have size of width*height ahere width and height are size of
603       the ASImage.
604

NAMEvectorize_asimage()

606       This function replaces contents of the vector member of ASImage  struc‐
607       ture with new double precision data, generated from native ARGB32 image
608       contents. Color palette is generated by  indexing  color  values  using
609       max_colors, dither and opaque_threshold parameters.
610
611

SYNOPSIS

613       ASVectorPalette* vectorize_asimage( ASImage *im,
614                                           unsigned int max_colors,
615                                           unsigned int dither,
616                                           int opaque_threshold );
617

INPUTS

619       im     - pointer to valid ASImage structure.
620
621       max_colors
622              - maximum size of the colormap.
623
624       dither - number of bits to strip off the color data ( 0...7 )
625
626       opaque_threshold
627              -  alpha  channel  threshold at which pixel should be treated as
628              opaque
629
630

RETURN VALUE

632       pointer to the ASVectorPalette structure that could be used for
633       reverse conversion from double values to ARGB32.
634

NOTES

636       alt.vector member of the supplied ASImage will be replaced and will
637       contain WIDTHxHEIGHT double values representing generated scientific
638       data.
639

NAMEcreate_image_manager()

641       create ASImage management and reference counting object.
642
643

SYNOPSIS

645       ASImageManager *create_image_manager( ASImageManager *reusable_memory,
646                                             double gamma, ... );
647

INPUTS

649       reusable_memory
650              - optional pointer to a block of memory  to  be  used  to  store
651              ASImageManager object.
652
653       double gamma  -  value  of  gamma  correction  to be used while loading
654              images from files.
655
656       ...    - NULL terminated list of up to 8 PATH strings to list locations
657              at which images could be found.
658
659

DESCRIPTION

661       Creates ASImageManager object in memory and initializes it with
662       requested gamma value and PATH list. This Object will contain a hash
663       table referencing all the loaded images. When such object is used while
664       loading images from the file - gamma and PATH values will be used, so
665       that all the loaded and referenced images will have same parameters.
666       File name will be used as the image name, and if same file is attempted
667       to be loaded again - instead reference will be incremented, and
668       previously loaded image will be retyrned. All the images stored in
669       ASImageManager's table will contain a back pointer to it, and they must
670       be deallocated only by calling release_asimage(). destroy_asimage() will
671       refuse to deallocate such an image.
672

NAMEdestroy_image_manager()

674       destroy management obejct.
675
676

SYNOPSIS

678       void destroy_image_manager( struct ASImageManager *imman,
679                                      Bool reusable );
680

INPUTS

682       imman  - pointer to ASImageManager object to be deallocated
683
684       reusable
685              -  if  True,  then  memory  that holds object itself will not be
686              deallocated. Usefull when object is created on stack.
687
688

DESCRIPTION

690       Destroys all the referenced images, PATH values and if reusable is False,
691       also deallocates object's memory.
692

NAMEstore_asimage()

694       add ASImage to the reference.
695
696

SYNOPSIS

698       Bool store_asimage( ASImageManager* imageman, ASImage *im,
699                              const char *name );
700

INPUTS

702       imageman
703              - pointer to valid ASImageManager object.
704
705       im     - pointer to the image to be stored.
706
707       name   - unique name of the image.
708
709

DESCRIPTION

711       Adds specifyed image to the ASImageManager's list of referenced images.
712       Stored ASImage could be deallocated only by release_asimage(), or when
713       ASImageManager object itself is destroyed.
714

NAMErelocate_asimage()

716       relocate ASImage into a different image manager.
717
718

SYNOPSIS

720       void     relocate_asimage( ASImageManager* to_imageman, ASImage *im );
721

INPUTS

723       to_imageman
724              - pointer to valid ASImageManager object.
725
726       im     - pointer to the image to be stored.
727
728

DESCRIPTION

730       Moves image from one ASImageManager's list of referenced images into
731       another ASImageManager. Reference count will be kept the same.
732

NAMEfetch_asimage()

734       query_asimage()
735
736
737

SYNOPSIS

739       ASImage *fetch_asimage( ASImageManager* imageman, const char *name );
740       ASImage *query_asimage( ASImageManager* imageman, const char *name );
741

INPUTS

743       imageman
744              - pointer to valid ASImageManager object.
745
746       name   - unique name of the image.
747
748

DESCRIPTION

750       Looks for image with the name in ASImageManager's list and if found,
751       returns pointer to it. Note that query_asimage() does not increment
752       reference count, while fetch_asimage() does. Therefore if fetch_asimage()
753       is used - release_asimage() should be called , when image is no longer
754       in use.
755

NAMEdup_asimage()

757       increment reference count of stored ASImage.
758
759

SYNOPSIS

761       ASImage *dup_asimage( ASImage* im );
762

INPUTS

764       im     - pointer  to  already  referenced  image.   libAfterImage/asim‐
765              age/release_asimage()
766

NAMErelease_asimage()

768       decrement reference count for given ASImage.  release_asimage_by_name()
769       decrement reference count for ASImage identifyed by its name.
770
771

SYNOPSIS

773       int release_asimage( ASImage *im );
774       int release_asimage_by_name( ASImageManager *imman, char *name );
775

INPUTS

777       im     - pointer to already referenced image.
778
779       imageman
780              - pointer to valid ASImageManager object.
781
782       name   - unique name of the image.
783
784

DESCRIPTION

786       Decrements reference count on the ASImage object and destroys it if
787       reference count is below zero.
788

NAMEforget_asimage()

790       remove ASImage from ASImageManager's  hash  by  pointer.   forget_asim‐
791       age_name() remove ASImage from ASImageManager's hash by its name.
792
793

SYNOPSIS

795       void     forget_asimage( ASImage *im );
796       void  forget_asimage_name( ASImageManager *imman, const char *name );
797

INPUTS

799       im     pointer to already referenced image.
800
801       imageman
802              pointer to valid ASImageManager object.
803
804       name   unique name of the image.  libAfterImage/safe_asimage_destroy()
805

NAMEsafe_asimage_destroy()

807       either  release or destroy asimage, checking if it is attached to ASIm‐
808       ageManager.
809
810

SYNOPSIS

812       int      safe_asimage_destroy( ASImage *im );
813

INPUTS

815       im     pointer to  and  ASImage  structure.   libAfterImage/print_asim‐
816              age_manager()
817

NAMEprint_asimage_manager()

819       prints  list  of  images  referenced in given ASImageManager structure.
820       libAfterImage/asimage/destroy_asgradient()
821

NAMEdestroy_asgradient()

823       - destroy ASGradient  structure,  deallocating  all  associated  memory
824       libAfterImage/asimage/init_image_layers()
825

NAMEinit_image_layers()

827       - initialize set of ASImageLayer structures.
828
829

SYNOPSIS

831       void init_image_layers( register ASImageLayer *l, int count );
832

INPUTS

834       l      - pointer to valid ASImageLayer structure.
835
836       count  - number of elements to initialize.
837
838

DESCRIPTION

840       Initializes array on ASImageLayer structures to sensible defaults.
841       Basically - all zeros and merge_scanlines == alphablend_scanlines.
842

NAMEcreate_image_layers()

844       - allocate and initialize set of ASImageLayer's.
845
846

SYNOPSIS

848       ASImageLayer *create_image_layers( int count );
849

INPUTS

851       count  - number of ASImageLayer structures in allocated array.
852
853

RETURN VALUE

855       Pointer to newly allocated and initialized array of ASImageLayer
856       structures on Success. NULL in case of any kind of error - that
857       should never happen.
858

DESCRIPTION

860       Performs memory allocation for the new array of ASImageLayer
861       structures, as well as initialization of allocated structure to
862       sensible defaults - merge_func will be set to alphablend_scanlines.
863

NAMEdestroy_image_layers()

865       - destroy set of ASImageLayer structures.
866
867

SYNOPSIS

869       void destroy_image_layers( register ASImageLayer *l,
870                                  int count,
871                                  Bool reusable );
872

INPUTS

874       l      - pointer to pointer to valid array of ASImageLayer structures.
875
876       count  - number of structures in array.
877
878       reusable
879              - if True - then array itself will not be deallocates - which is
880              usable when it was allocated on stack.
881
882

DESCRIPTION

884       frees all the memory allocated for specified array of ASImageLayer s.
885       If there was ASImage and/or ASImageBevel attached to it - it will be
886       deallocated as well.
887

NAMEasimage_add_line()

SYNOPSIS

890       size_t asimage_add_line ( ASImage * im, ColorPart color,
891                                 CARD32 * data, unsigned int y);
892

INPUTS

894       im     - pointer to valid ASImage structure
895
896       color  - color channel's number
897
898       data   - raw channel data of 32 bits per pixel -  only  lowest  8  bits
899              gets encoded.
900
901       y      - image row starting with 0
902
903

RETURN VALUE

905       asimage_add_line() return size of the encoded channel scanline in
906       bytes. On failure it will return 0.
907

DESCRIPTION

909       Encodes raw data of the single channel into ASImage channel scanline.
910       based on compression level selected for this ASImage all or part of
911       the scanline will be RLE encoded.
912

NAMEasimage_add_line_mono()

SYNOPSIS

915       size_t asimage_add_line_mono ( ASImage * im, ColorPart color,
916                                      CARD8 value, unsigned int y);
917

INPUTS

919       im     - pointer to valid ASImage structure
920
921       color  - color channel's number
922
923       value  - value for the channel
924
925       y      - image row starting with 0
926
927

RETURN VALUE

929       asimage_add_line_mono() return size of the encoded channel scanline
930       in bytes. On failure it will return 0.
931

DESCRIPTION

933       encodes ASImage channel scanline to have same color components
934       value in every pixel. Useful for vertical gradients for example.
935

NAMEget_asimage_chanmask()

SYNOPSIS

938       ASFlagType get_asimage_chanmask( ASImage *im);
939

INPUTS

941       im     - valid ASImage object.
942
943

DESCRIPTION

945       goes throu all the scanlines of the ASImage and toggles bits
946       representing those components that have at least some data.
947

NAMEmove_asimage_channel()

SYNOPSIS

950       void move_asimage_channel( ASImage *dst, int channel_dst,
951                                  ASImage *src, int channel_src );
952

INPUTS

954       dst    - ASImage which will have its channel substituted;
955
956       channel_dst
957              - what channel to move data to;
958
959       src    - ASImage which will donate its channel to dst;
960
961       channel_src
962              - what source image channel to move data from.
963
964

DESCRIPTION

966       MOves channel data from one ASImage to another, while discarding
967       what was already in destination's channel.
968

NOTES

970       Source image (donor) will loose its channel data, as it will be
971       moved to destination ASImage. Also there is a condition that both
972       images must be of the same width - otherwise function returns
973       without doing anything. If height is different - the minimum of
974       two will be used.
975

NAMEcopy_asimage_channel()

SYNOPSIS

978       void copy_asimage_channel( ASImage *dst, int channel_dst,
979                                  ASImage *src, int channel_src );
980

INPUTS

982       dst    - ASImage which will have its channel substituted;
983
984       channel_dst
985              - what channel to copy data to;
986
987       src    - ASImage which will donate its channel to dst;
988
989       channel_src
990              - what source image channel to copy data from.
991
992

DESCRIPTION

994       Same as move_asimage_channel() but makes copy of channel's data
995       instead of simply moving it from one image to another.
996

NAMEcopy_asimage_lines()

SYNOPSIS

999       void copy_asimage_lines( ASImage *dst, unsigned int offset_dst,
1000                                ASImage *src, unsigned int offset_src,
1001                                unsigned int nlines, ASFlagType filter );
1002

INPUTS

1004       dst    - ASImage which will have its channel substituted;
1005
1006       offset_dst
1007              - scanline in destination image to copy to;
1008
1009       src    - ASImage which will donate its channel to dst;
1010
1011       offset_src
1012              - scanline in source image to copy data from;
1013
1014       nlines - number of scanlines to be copied;
1015
1016       filter - specifies what channels should be copied.
1017
1018

DESCRIPTION

1020       Makes copy of scanline data for continuos set of scanlines, affecting
1021       only those channels marked in filter.
1022       NOTE
1023       Images must be of the same width.
1024

FUNCTION

1026       This are flags that define what should be printed by
1027       asimage_print_line():
1028           VRB_LINE_SUMMARY    - print only summary for each scanline
1029           VRB_LINE_CONTENT    - print summary and data for each scanline
1030           VRB_CTRL_EXPLAIN    - print summary, data and control codes for each
1031                                 scanline
1032

SOURCE

1034       Source :
1035       #define VRB_LINE_SUMMARY    (0x01<<0)
1036       #define VRB_LINE_CONTENT    (0x01<<1)
1037       #define VRB_CTRL_EXPLAIN    (0x01<<2)
1038       #define VRB_EVERYTHING      (VRB_LINE_SUMMARY|VRB_CTRL_EXPLAIN|                              VRB_LINE_CONTENT)
1039

NAMEasimage_print_line()

SYNOPSIS

1042           unsigned int asimage_print_line ( ASImage * im, ColorPart color,
1043                                             unsigned int y,
1044                                             unsigned long verbosity);
1045

INPUTS

1047       im     - pointer to valid ASImage structure
1048
1049       color  - color channel's number
1050
1051       y      - image row starting with 0
1052
1053       verbosity
1054              - verbosity level - any combination of flags is allowed
1055
1056

RETURN VALUE

1058       amount of memory used by this particular channel of specified
1059       scanline.
1060

DESCRIPTION

1062       asimage_print_line() prints data stored in specified image scanline
1063       channel. That may include simple summary of how much memory is used,
1064       actual visible data, and/or RLE control codes. That helps to see
1065       how effectively data is encoded.
1066
1067       Useful mostly for debugging purposes.
1068

NAMEget_asimage_channel_rects()

1070       - translate image into a list of rectangles.
1071
1072

SYNOPSIS

1074       XRectangle*
1075           get_asimage_channel_rects( ASImage *src, int channel,
1076                                      unsigned int threshold,
1077                                      unsigned int *rects_count_ret );
1078

INPUTS

1080       src    - ASImage which will donate its channel to dst;
1081
1082       channel
1083              - what source image channel to copy data from;
1084
1085       threshold
1086              - threshold to compare channel values against;
1087
1088       rects_count_ret
1089              - returns count of generated rectangles.
1090
1091

DESCRIPTION

1093       This function will translate contents of selected channel
1094       (usualy alpha) into a list of rectangles, ecompasing regions
1095       with values above the threshold. This is usefull to generate shape
1096       of the window to be used with X Shape extention.
1097
1098
1099
11003rd Berkeley Distribution      AfterStep v.2.2.6                    asimage(1)
Impressum