Go to the previous, next section.
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@dots{}aa_scrwidth(context)
or 0@dots{}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@dots{}255 and contrast 0@dots{}127;
dither can be set to one of the following values:
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.
Go to the previous, next section.