Go to the previous, next section.

How to draw an image?

AA-lib emulates video-ram so it looks just like a plain memory. It contains aa_imgheight (context) lines of aa_imgwidth(context) bytes where each of them specifies a grayscale value or an index to a colormap (or graymap ?). Pointer to this memory can be obtained using aa_image(context) macro.

Note that width and height of videoram differ from physical width/height of a device (stored in aa_hardwareparams variables). Currently it is twice bigger because every four pixels are rendered into one character. Future versions should (possibly) support nine pixels.

There's nearly no difference in API between classical gfx libraries and AA-lib. There are currently no higher level graphics functions. But AA-lib provides aa_putpixel(context,x,y,color) macro. There is no problem to make more complex functions (send `hem to us, you'll be in credits! ;). A great help to a potential programmer is the fact that AA-lib provides a colormap mode emulation. To set the palette you should use macro:

aa_setpalette(palette, index, red, green, blue)

Red, green and blue components are recalculated into super-grayscale. Values are in range 0--255 where 0 means black. You can also set directly value using something like:

palette[index]=value;

Another difference is that your aplication is expected to handle various imgwidth/imgheights (in case you didn't exacly specified them in hardwareparams during initialization). Also your aplication should take care for aa_mmwidth(context) and aa_mmheight(context) values that contain real size in millimeters of output device. You cannot simply expect that pixel has the same width and height as at normal graphics libraries.

Many old programs may require some scalling functions to convert images from their internal size (320x200) to AA-Lib real size.

Note that image WON'T be displayed on the screen unless it is rendered and FLUSHED !

Go to the previous, next section.