ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5


5 - Copy Modes

The final field is mode, which determines how the image pixels interact with the destination. It can be one of the following:
IMG_CMB_SRC IMG_CMB_AND IMG_CMB_IOR
IMG_CMB_XOR IMG_CMB_SRC_INV IMG_CMB_AND_INV
IMG_CMB_IOR_INV IMG_CMB_XOR_INV
The SDK documentation discusses them in some detail, and their use can get confusing; but in general, simply remember the following:
  • If you are using 4 or 16 color bitmaps, use IMG_CMB_SRC (which simply copies) and IMG_CMB_SRC_INV (which inverts, then copies). The other modes are mostly used for special effects.
  • For 2 color bitmaps, all modes are useful - here, the foreground and background colors are used to replace the pixels, and the mode determines what gets copied - IMG_CMB_AND copies over only the zero bits, IMG_CMB_IOR copies over only the one bits, and IMG_CMB_XOR performs an exclusive-or between the source and destination pixels - if they don't match, a one is written, else a zero. These modes are especially useful for masking effects.
  • In all modes, you can reverse the result with the inverse modes, which go by the same name, but have the _INV ending. These invert the image before combining with the destination.




The test program in source and SEB format lets you get a feel for the various modes, and how they affect each of the three image bit plane sizes. The SEB file is included so you don't need to compile it, but it's worth your while to at least look over the code, since it shows how to work with the IMAGE format, how to draw a tiled background, and so forth. Reviewing it, you'll see how easy it is to include IMAGE files in your programs.

Previous Section


Copyright © 2001-2006 ebmDevMag.com - Legal Notice