Implementing Special Effects

The LEADTOOLS special effects functions give you precise control over a large variety of effects when you paint bitmaps, text, patterns, and shapes to a device context.

Painting Bitmaps

To apply a transitional effect when painting a bitmap, you can use L_EfxPaintBitmap or L_EfxEffectBlt, and you can specify the following:

image\sqrblit.gif The same source and destination rectangles and ROP codes that are available in other painting functions.

image\sqrblit.gif The transitional effect to apply. For a complete list refer to Effect Types.

image\sqrblit.gif The speed of the effect. The speed is affected by two parameters: one for granularity (the size of the step) and the other for the delay between steps.

image\sqrblit.gif The number of passes to complete the effect. You can call the paint effect function more than once, each time specifying which pass of the total number to paint. The function applies a pattern brush to paint some of the pixels on each pass. The transition to the new image is complete when you finish all of the passes.

image\sqrblit.gif A transparent color. The function skips pixels of the specified color.

image\sqrblit.gif A wand, which is a line on the leading edge of some effects, such as horizontal or vertical wipes. You can specify the width and color of the wand

Painting Rectangular Areas

You can paint a rectangular area with a solid color, a gradient color transition, or a pattern. The following functions are available:

image\sqrblit.gif L_EfxPatternFillRect lets you paint a rectangle with various patterns of lines. You can specify the foreground color and background color. (There are no timed transitional effects.)

image\sqrblit.gif L_EfxGradientFillRect lets you paint a rectangle with a gradient color transition. You specify the beginning and ending colors, and the number of steps from one to the other. There are several transition patterns, as described in Effect Gradient Styles. (There are no timed transitional effects.)

image\sqrblit.gif L_EfxPaintTransition lets you paint a rectangle with a gradient color transition, and with all of the same controls that are available in the paint effects for bitmaps. You can control the transitional effect, speed, number of passes, transparent color, and wand.

Painting Three-Dimensional Text

You can paint rotated text using L_EfxDrawRotated3dText or unrotated text using L_EfxDraw3dText. For rotated text, you can specify the angle of rotation. With either of the functions, you can also specify the following:

image\sqrblit.gif The text string, the font, and the rectangle to use for positioning.

image\sqrblit.gif Any of the positioning and style flags listed in Effect Text Style Flags and Effect Text Alignment Flags.

image\sqrblit.gif The color of the text, or an image to paint on the face of the text instead of the color.

image\sqrblit.gif The color and position of a shadow, if the style requires it.

image\sqrblit.gif The color of the border or highlight, if the style requires it.

Painting a Frame

You can use L_EfxDrawFrame to paint a frame. The interior is transparent. The frame, itself, has a three-dimensional apperance. You can specify the following:

image\sqrblit.gif The rectangle that defines the frame. You can control whether the frame itself is inside or outside the rectangle.

image\sqrblit.gif One of the several inset or raised three-dimensional styles.

image\sqrblit.gif Three bands used for the three-dimensional appearance: middle, inner, and outer. For each band you can specify the overall width, and the colors of the band and its highlight and shadow. Usage of the bands, highlights, and shadows depends on the selected three-dimensional style.

Painting a Three-Dimensional Shape

You can use L_EfxDraw3dShape to paint a three-dimensional shape, such as a circle or triangle. For each shape, you can specify the following:

image\sqrblit.gif Any of the shapes listed in Effect Shapes.

image\sqrblit.gif The background style and color. The style can be transparent, or it can use an opaque or translucent color, or it can use an opaque or translucent tiled image.

image\sqrblit.gif The border width, style, and color.

image\sqrblit.gif The inner and outer bands that are applied to the border for three-dimensional effects. For each band, you can specify the width, style (raised, inset, or none), and the highlight and shadow colors. The usage of highlights and shadows depends on the style.

image\sqrblit.gif The position and color of a shadow.