ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5


1 - Programming with Images

    (download tutorial source .zip file)
    (download tutorial program .seb file only)


The concept of a bitmap is pretty straightforward (and necessary) in any Operating System. Graphic data is represented as rows and columns of pixels data, which can be one or more bits in size. The ebm IMAGE format is like many graphics formats, where rows of data are placed in the file one after the other. The packing of the rows first (called scan lines) is valuable, since it is often easier to dump a row of data to a display device than a column.

The actual packing depends on the color range; also called bpp, bits per pixel, color depth, number of planes, and so forth. For black and white, only one bit of data is needed, but if you use two bits to describe a pixel's color, you have 2^2 or four possible colors; in turn, four bits allows 16 colors. The ebm uses these three formats for its images, identifying them with the constants COLOR_MODE_MONO, COLOR_MODE_GRAY4, and COLOR_MODE_GRAY16.

Although bit planes can be packed in a number of ways (I once worked on a format where the various bits of each pixel were scattered throughout the file!) the ebm format is very simple - the bits of each pixel are grouped together, with either 8, 4, or 2 pixels per data byte, for two, four, and sixteen color modes respectively.


Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice