GNU Info

Info Node: (aalib.info)Rendering

(aalib.info)Rendering


Next: Flushing Prev: Drawing image Up: Top
Enter node , (file) or (file)node

Rendering of image into ascii-art
*********************************

   Once image is drawn it needs to be rendered. For this purpose three
functions are provided:

     void aa_fastrender(aa_context *C, int X1, int Y1, int X2, int Y2);
     void aa_render(aa_context * C, aa_renderparams *P,
                           int X1, int Y1, int X2, int Y2);
     void aa_renderpalette(aa_context *C, aa_palette TABLE,
                           aa_renderparams *P,
                           int X1, int Y1, int X2, int Y2);

   `x1', `y1', `x2', `y2' parameters specify Top left/bottom right
corner of rendered rectangle. Note that these coordinates are SCREEN
not IMAGE ones. So they can be twice smaller !!  Specify the range
0...`aa_scrwidth(context)' or 0...`aa_scrheight(context)').  Please do
NOT confuse them with image coords otherwise you'll get strange results!
Note that the first call of our rendering function can take
significantly more time becouse it pre-computes internal look-up tables.

   Function `aa_fastrender' does very fast (but not as perfect)
results. It is designed for aplications that prefers simplicity and
speed to the quality of output.  Quick and easy way to use render
routines is to call:

     aa_fastrender(context, 0, 0, aa_scrwidth(context), aa_scrheight(context));

   Function `aa_render' is a bit more complex than the previous one.
It uses 256 colors instead of 16 ones and it has an extra parameter `p'.
This parameter allows a control of its advanced features. It's a pointer
to the following structure:

     struct aa_renderparams {
         int bright, contrast;
         float gamma;
         int dither;
         int inversion;
         int randomval;
     };

   Values `bright', `contrast', `gamma' let you control the quality of
the output image. Brightness of range 0...255 and contrast 0...127;
dither can be set to one of the following values:
`AA_NONE'
     disables dithering

`AA_ERROR_DISTRIB'
     enables error distribution dithering

`AA_FLOYD_S'
     enables floyd-steinberg dithering

   Inversion enables/disables the inversion. Randomval can be used to
control the random dithering. If randomval is non-zero a random value
in range ( -randomval / 2 , ranomval / 2) is added to every pixel value
before the rendering.  Note that this can be combined with all other
ditherings too.

   Function `aa_renderpalette' is similiar to `aa_render'. The only
difference is that it lets you specify the palette.


automatically generated by info2www version 1.2.2.9