imencdec - encoding/decoding ASImage data from/to usable data structures libAfterImage/imencdec.h
Contents
Description
Completes image output process. Flushes all the internal buffers. Deallocates all the allocated memory.
Resets pointer to NULL to avoid dereferencing invalid pointers.
3rd Berkeley Distribution AfterStep v.2.2.12 imencdec(3x)
Function
Defines level of output quality/speed ratio
Inputs
pimout - pointer to pointer to ASImageOutput structure, previously created with call to
start_image_output().
Name
imencdec - encoding/decoding ASImage data from/to usable data structures libAfterImage/imencdec.h
Nameasimage_Quality_Poor
there will be no dithering and interpolation used while transforming ASIMAGE_QUALITY_FAST there will be
no dithering and used while transforming but interpolation will be used. ASIMAGE_QUALITY_GOOD simplified
dithering is performed in addition to interpolation. ASIMAGE_QUALITY_TOP full dithering and
interpolation. ASIMAGE_QUALITY_DEFAULT requests current default setting - typically same as
ASIMAGE_QUALITY_GOOD. MAX_GRADIENT_DITHER_LINES defines number of lines to use for dithering, while
rendering gradients, in order to create smooth effect. Higher number will slow things down, but will
create better gradients.
Nameasimagebevel
describes bevel to be drawn around the image.
Nameasimagedecoder
describes the status of reading any particular ASImage, as well as providing detail on how it should be
done.
Nameasimageoutput
describes the output state of the transformation result. It is used to transparently write results into
ASImage or XImage with different levels of quality.
Nameimencdec
defines main structures and function for image storing, extraction and conversion to/from usable formats.
Nameset_Decoder_Back_Color()
- changes the back color to be used while decoding the image.
Nameset_Decoder_Bevel_Geom()
- changes default placement of the bevel on decoded image.
Nameset_Decoder_Shift()
- changes the shift value of decoder - 8 or 0.
Nameset_Image_Output_Back_Color()
- changes background color of output
Namestart_Image_Decoding()
- allocates and initializes decoder structure.
Namestart_Image_Output()
- initializes output structure
Namestop_Image_Decoding()
- finishes decoding, frees all allocated memory.
Namestop_Image_Output()
- finishes output, frees all the allocated memory.
Nametoggle_Image_Output_Direction()
- reverses vertical direction of output
Notes
The output_image_scanline method should be called for each scanline to be stored. Convenience functions
listed below should be used to safely alter state of the output instead of direct manipulation of the
data members. (makes you pity you don't write in C++ doesn't it ?)
Also There is a trick in the way how output_image_scanline handles empty scanlines while writing ASImage.
If back_color of empty scanline matches back_color of ASImageOutput - then particular line is erased! If
back_colors are same - then particular line of ASImage gets filled with the back_color of ASScanline.
First approach is useful when resulting image will be used in subsequent call to merge_layers - in such
case knowing back_color of image is good enough and we don't need to store lines with the same color. In
case where ASImage will be converted into Pixmap/XImage - second approach is preferable, since that
conversion does not take into consideration image's back color - we may want to change it in the future.
Return Value
pimout - pointer to ASImageOutput will be reset to NULL.
See Also
start_image_decoding()
libAfterImage/asimage/start_image_output()
Source
typedef void (*encode_image_scanline_func)( struct ASImageOutput *imout,
struct ASScanline *to_store ); typedef void
(*output_image_scanline_func)( struct ASImageOutput *,
struct ASScanline *, int );
typedef struct ASImageOutput {
struct ASVisual *asv;
struct ASImage *im ;
ASAltImFormats out_format ;
CARD32 chan_fill[4];
int buffer_shift; /* -1 means - buffer is empty,
* 0 - no shift,
* 8 - use 8 bit precision */
int next_line ; /* next scanline to be written */
unsigned int tiling_step; /* each line written will be
* repeated with this step until
* we exceed image size */
unsigned int tiling_range; /* Limits region in which we need
* to tile. If set to 0 then image
* height is used */
int bottom_to_top; /* -1 if we should output in
* bottom to top order,
* +1 otherwise*/
int quality ; /* see above */
output_image_scanline_func
output_image_scanline ; /* high level interface - division,
* error diffusion as well
* as encoding */
encode_image_scanline_func
encode_image_scanline ; /* low level interface -
* encoding only */
/* internal data members : */
struct ASScanline buffer[2], *used, *available; }ASImageOutput;
libAfterImage/asimage/start_image_decoding()
Synopsis
void stop_image_output( ASImageOutput **pimout );
