ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5
part 6
part 7
part 8
part 9


9 - Handy-Dandy Effects

This call is best used from within the Draw() function for your window. At that point, you display your text with much more flexibility that a CLabel can provide. The sample program for this column shows examples of effects possible, and the code in the Draw() discusses how to do the effects. For instance:
  • Using the form width and height, and finding out the string's height and width, we can justify the text any way we want, both horizontally and vertically (the nine displays of the word 'text' onscreen).
  • By writing the same text spaced horizontally one or two pixels apart, we create a bold font in different thickness, as displayed in the lower half of the window. This effect relies on another copy mode, IMG_CMB_IOR, which doesn't copy the white background, (just the black foreground), allowing for overlaid text.
  • Embossed text - while not particularly effective on a handheld, we simply draw text three times, offset by a pixel or two; a top light color, a bottom dark one, and then the middle in a middle color. The result is only somewhat embossed, but gives you an idea of effects that can be done by adjusting the font color in DrawText().
  • We can create special effects, like haloed text. Here, we draw the text a few times spaced around with the IMG_CMB_IOR_INV copy mode, and then once in black on top. The result is white surrounding each letter (IMG_CMB_IOR_INV does the same as IMG_CMB_IOR, but inverts the result, changing the black pixels to white).
While the effects may not be to your liking, they do illustrate how DrawText() can provide great flexibility in text display; in particular, allowing you to change colors, draw on colored backgrounds, and justify text. Again, the example program's code details how the effects were done, and can serve as a springboard to your own text effects.


The written word is quite powerful, and despite the advantages of imagery, words are often a most effective way to get ideas across. The ebm provides multi-facetted ways of handling text display, allowing you to balance ease of use with flexibility, with you making the choice on your projects.

Previous Section


Copyright © 2001-2006 ebmDevMag.com - Legal Notice