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 LPaintEffect::PaintBitmap or LPaintEffect::EffectBlt, and you can specify the following:
The same source and destination rectangles and ROP codes that are available in other painting functions.
The transitional effect to apply. For a complete list refer to Effect Types.
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.
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.
A transparent color. The function skips pixels of the specified color.
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:
LPaintEffect::DrawPattern 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.)
LPaintEffect::DrawGradient lets you paint a rectangle with a 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.)
LPaintEffect::PaintTransition lets you paint a rectangle with a 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 or unrotated text using LPaintEffect::Draw3dText or LPaintEffect::Draw3dText. You can specify the following:
The text string, the font, and the rectangle to use for positioning.
Any of the positioning and style flags listed in Effect Text Flags.
The color of the text, or an image to paint on the face of the text instead of the color.
The color and position of a shadow, if the style requires it.
The color of the border or highlight, if the style requires it.
The angle of rotation.
Painting a Frame
You can use LPaintEffect::DrawFrame to paint a frame. The interior is transparent. The frame, itself, has a three-dimensional apperance. You can specify the following:
The rectangle that defines the frame. You can control whether the frame itself is inside or outside the rectangle.
One of the several inset or raised three-dimensional styles.
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 LPaintEffect::Draw3dShape to paint a three-dimensional shape, such as a circle or triangle. For each shape, you can specify the following:
Any of the shapes listed in Effect Shapes.
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.
The border width, style, and color.
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.
The position and color of a shadow.
You can also use the high-level class LBitmapWindow to implement special effects. This class creates a window and does all of the processing required to implement special effects. You control the effects using various member functions of LBitmapWindow.