Implementing Special Effects
The LEADTOOLS special effects methods give you precise control over a large variety of effects when you paint images, text, patterns, and shapes to a device context.
To apply a transitional effect when painting an image, you can use SpecialEffectsProcessor.PaintImage or SpecialEffectsProcessor.PaintImageEffect, and you can specify the following:
- The same source and destination rectangles and ROP codes that are available in other painting methods.
- The transitional effect to apply. For a complete list refer to SpecialEffectsType.
- 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 method more than once, each time specifying which pass of the total number to paint. The method 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 method 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 methods are available:
- SpecialEffectsProcessor.GradientPatternFillRectangle 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.)
- SpecialEffectsProcessor.GradientFillRectangle 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 SpecialEffectsGradientStyle. (There are no timed transitional effects.)
- SpecialEffectsProcessor.PaintTransition 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 images. You can control the transitional effect, speed, number of passes, transparent color, and wand.
Painting Three-Dimensional Text
You can paint rotated text using SpecialEffectsProcessor.DrawRotated3dText, or unrotated text using SpecialEffectsProcessor.Draw3dText. For rotated text, you can specify the angle of rotation. With either method, you can also specify the following:
- The text string, the font, and the rectangle to use for positioning.
- Any of the positioning and style flags listed in SpecialEffectsTextStyle and SpecialEffectsTextAlignmentFlags.
- 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.
Painting a Frame
You can use SpecialEffectsProcessor.DrawFrame to paint a frame. The interior is transparent. The frame itself has a three-dimensional appearance. 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 SpecialEffectsProcessor.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 SpecialEffectsShape.
- 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.