Intro: understanding bitmaps
============================

Bitmaps are pictures.
You can load them from a file or create them new.
You can draw into them with drawing functions.
You can copy them into other bitmaps or into your window.
Your window can be seen also as a bitmap, into which you can draw.
To refer to the window instead of a bitmap, the parameter for the bitmap
must have the value NULL.


Format of a bitmap-file

Any bitmap-file must be in a supported format
(VgaGames-bitmap-format, windows bmp, ppm3 or ppm6).

But for performing issues VgaGames-bitmap-format is strongly recommended.
This format has:
 - "VG" (to recognize a VgaGames-bitmap-file)
 - 5 bytes (string, not binary) for the width of the bitmap
 - 5 bytes (string, not binary) for the height of the bitmap
 - colormap of bitmap:
   256 x 3 bytes:
     the 3 bytes represent a color red,green,blue of the color-index 0-255,
     but the value of each of the 3 bytes is from 0 to 63,
     refer to "Format of a colormap-file".
 - one byte for each pixel,
   where the first byte is the color-index of the upper left pixel,
   the second byte the color-index of the next pixel to the right,
   and so on


Creating a bitmap-file

The usual way to create a VgaGames-bitmap-file is to create a bitmap-file of
another format and to convert it into the VgaGames-bitmap-format
with the program "vgag-bitmap", shipped with this library.
"vgag-bitmap" only supports two other formats:
 - MS-Windows .bmp
 - PPM (plain and raw)
With the package "netpbm" (see sourceforge.net) you can convert
many formats into PPM.
"vgag-bitmap" can also convert VgaGames-bitmap-format back.


bitmap functions

There are many vg_bitmap_* functions to create or modify a bitmap,
to get their properties (width and height), to copy them into another one,
or save them into a file.
And there are drawing functions to draw into them.



FUNCTIONS

vg_bitmap_createnew()
vg_bitmap_createfromfile()
vg_bitmap_createfromtext()
vg_bitmap_duplicate()
vg_bitmap_width()
vg_bitmap_height()
vg_bitmap_getpixel()
vg_bitmap_clear()
vg_bitmap_copyto()
vg_bitmap_save()
vg_bitmap_rotate()
vg_bitmap_zoom()
vg_bitmap_mirror()
vg_bitmap_overlap()
vg_bitmap_free()

Back to Index