Leadtools.SpecialEffects Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
PaintImage(IntPtr,RasterImage,Rectangle,Rectangle,Rectangle,Rectangle,SpecialEffectsType,Int32,Int32,Int32,Int32,Int32,Int32,Boolean,Color,Int32,Color,RasterPaintProperties,SpecialEffectsProgress) Method
See Also  Example
Leadtools.SpecialEffects Namespace > SpecialEffectsProcessor Class > PaintImage Method : PaintImage(IntPtr,RasterImage,Rectangle,Rectangle,Rectangle,Rectangle,SpecialEffectsType,Int32,Int32,Int32,Int32,Int32,Int32,Boolean,Color,Int32,Color,RasterPaintProperties,SpecialEffectsProgress) Method



hdc
Handle to the target device context.
image
Pointer to the object that contains the image to paint.
src
Rectangle to be used as the display source rectangle that specifies the part of the bitmap to use as the display source. The coordinates for the Rectangle object are relative to the image. You can pass null to use the default, which matches the image.
srcClip
Rectangle that specifies the portion of the display source to paint. Generally, this is used for updating the display when part of the source bitmap has changed. The coordinates for the Rectangle object are relative to the image. You can pass null to use the default, which matches the bitmap.
dest
Rectangle that determines how the source rectangle is scaled and how the image is positioned in the device context. The coordinates for the Rectangle object are relative to the device context. There is no default for this parameter. You must specify the Recatangle object.
destClip
Rectangle to be used as the display destination clipping rectangle.that specifies the portion of the display rectangle to paint. Generally, this is used for updating changes in the display surface, such as when a user moves another window, uncovering a part of the image that had been covered up. The coordinates for the Rectangle object are relative to the device context. You can pass null to use the default, which matches the device context.
effectType
Effect to apply when painting. For valid values, refer to SpecialEffectsType.
grain
Graining size. This is the smallest size (pixel width or height) to be updated when painting an effect. Using a small grain makes the painting smoother, but takes longer to paint. Using a large grain makes the painting more coarse, but paints faster. If the effectType parameter is from the Wave class this represents the duration or height of the wave. Valid values are 1 to 256.
delay
Delay between graining steps, in milliseconds.
speed
Speed of the wave. Valid values are 1 to 256. This parameter is valid only if the effectType parameter is from the Wave class.
cycles
Number of cycles or repetitions used to draw the wave. This parameter is valid only if the effectType parameter is from the Wave class.
pass
Pass number when using a pattern brush. Use 1 for painting in one pass.
maxPass
Maximum passes for a pattern brush. Use 1 for painting in one pass.
transparency
True to implement transparency by not painting pixels of the color specified in the transparentColor parameter; False if transparency is not implemented.
transparentColor
Value that specifies the transparent color.
wandWidth
Wand width, in pixels.
wandColor
Value that specifies the wand color.
paintProperties
Options for the display.
progressCallback
Callback method that will be called when the paint image is started to determine the status for the paint image effect.
Applies an effect when painting an image onto a target device context. The effect, commonly used for slide show transitions, specifies how the image is painted, not how it looks when painting is finished.

Syntax

Visual Basic (Declaration)  
Public Overloads Sub PaintImage( _
   ByVal hdc As IntPtr, _
   ByVal image As RasterImage, _
   ByVal src As Rectangle, _
   ByVal srcClip As Rectangle, _
   ByVal dest As Rectangle, _
   ByVal destClip As Rectangle, _
   ByVal effectType As SpecialEffectsType, _
   ByVal grain As Integer, _
   ByVal delay As Integer, _
   ByVal speed As Integer, _
   ByVal cycles As Integer, _
   ByVal pass As Integer, _
   ByVal maxPass As Integer, _
   ByVal transparency As Boolean, _
   ByVal transparentColor As Color, _
   ByVal wandWidth As Integer, _
   ByVal wandColor As Color, _
   ByVal paintProperties As RasterPaintProperties, _
   ByVal progressCallback As SpecialEffectsProgress _
) 
Visual Basic (Usage) Copy Code
Dim instance As SpecialEffectsProcessor
Dim hdc As IntPtr
Dim image As RasterImage
Dim src As Rectangle
Dim srcClip As Rectangle
Dim dest As Rectangle
Dim destClip As Rectangle
Dim effectType As SpecialEffectsType
Dim grain As Integer
Dim delay As Integer
Dim speed As Integer
Dim cycles As Integer
Dim pass As Integer
Dim maxPass As Integer
Dim transparency As Boolean
Dim transparentColor As Color
Dim wandWidth As Integer
Dim wandColor As Color
Dim paintProperties As RasterPaintProperties
Dim progressCallback As SpecialEffectsProgress
 
instance.PaintImage(hdc, image, src, srcClip, dest, destClip, effectType, grain, delay, speed, cycles, pass, maxPass, transparency, transparentColor, wandWidth, wandColor, paintProperties, progressCallback)
C#  
public void PaintImage( 
   IntPtr hdc,
   RasterImage image,
   Rectangle src,
   Rectangle srcClip,
   Rectangle dest,
   Rectangle destClip,
   SpecialEffectsType effectType,
   int grain,
   int delay,
   int speed,
   int cycles,
   int pass,
   int maxPass,
   bool transparency,
   Color transparentColor,
   int wandWidth,
   Color wandColor,
   RasterPaintProperties paintProperties,
   SpecialEffectsProgress progressCallback
)
C++/CLI  
public:
void PaintImage( 
   IntPtr hdc,
   RasterImage image,
   Rectangle src,
   Rectangle srcClip,
   Rectangle dest,
   Rectangle destClip,
   SpecialEffectsType effectType,
   int grain,
   int delay,
   int speed,
   int cycles,
   int pass,
   int maxPass,
   bool transparency,
   Color transparentColor,
   int wandWidth,
   Color wandColor,
   RasterPaintProperties paintProperties,
   SpecialEffectsProgress^ progressCallback
) 

Parameters

hdc
Handle to the target device context.
image
Pointer to the object that contains the image to paint.
src
Rectangle to be used as the display source rectangle that specifies the part of the bitmap to use as the display source. The coordinates for the Rectangle object are relative to the image. You can pass null to use the default, which matches the image.
srcClip
Rectangle that specifies the portion of the display source to paint. Generally, this is used for updating the display when part of the source bitmap has changed. The coordinates for the Rectangle object are relative to the image. You can pass null to use the default, which matches the bitmap.
dest
Rectangle that determines how the source rectangle is scaled and how the image is positioned in the device context. The coordinates for the Rectangle object are relative to the device context. There is no default for this parameter. You must specify the Recatangle object.
destClip
Rectangle to be used as the display destination clipping rectangle.that specifies the portion of the display rectangle to paint. Generally, this is used for updating changes in the display surface, such as when a user moves another window, uncovering a part of the image that had been covered up. The coordinates for the Rectangle object are relative to the device context. You can pass null to use the default, which matches the device context.
effectType
Effect to apply when painting. For valid values, refer to SpecialEffectsType.
grain
Graining size. This is the smallest size (pixel width or height) to be updated when painting an effect. Using a small grain makes the painting smoother, but takes longer to paint. Using a large grain makes the painting more coarse, but paints faster. If the effectType parameter is from the Wave class this represents the duration or height of the wave. Valid values are 1 to 256.
delay
Delay between graining steps, in milliseconds.
speed
Speed of the wave. Valid values are 1 to 256. This parameter is valid only if the effectType parameter is from the Wave class.
cycles
Number of cycles or repetitions used to draw the wave. This parameter is valid only if the effectType parameter is from the Wave class.
pass
Pass number when using a pattern brush. Use 1 for painting in one pass.
maxPass
Maximum passes for a pattern brush. Use 1 for painting in one pass.
transparency
True to implement transparency by not painting pixels of the color specified in the transparentColor parameter; False if transparency is not implemented.
transparentColor
Value that specifies the transparent color.
wandWidth
Wand width, in pixels.
wandColor
Value that specifies the wand color.
paintProperties
Options for the display.
progressCallback
Callback method that will be called when the paint image is started to determine the status for the paint image effect.

Example

This example shows the minimum requirements for using PaintImage method.

Visual Basic Copy Code
Public Sub PaintImage(ByVal g As Graphics, ByVal destRect As Rectangle)
    Dim processor As SpecialEffectsProcessor = New SpecialEffectsProcessor()
    Dim properties As RasterPaintProperties = New RasterPaintProperties()
    properties.RasterOperation = RasterPaintProperties.SourceCopy

    RasterCodecs.Startup()
    Dim codecs As RasterCodecs = New RasterCodecs()
    Dim rasterImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Image1.cmp")

    processor.PaintImage(g, rasterImage, Rectangle.Empty, Rectangle.Empty, destRect, Rectangle.Empty, SpecialEffectsType.Wipe4LRTB, 5, 10, 0, 0, 1, 3, False, Color.Empty, 0, Color.Empty, properties, Nothing)
    'MessageBox.Show("Continue to next effect");

    processor.PaintImage(g, rasterImage, Rectangle.Empty, Rectangle.Empty, destRect, Rectangle.Empty, SpecialEffectsType.WipeRectangleIn, 5, 10, 0, 0, 2, 3, False, Color.Empty, 0, Color.Empty, properties, Nothing)
    'MessageBox.Show("Continue to next effect");

    processor.PaintImage(g, rasterImage, Rectangle.Empty, Rectangle.Empty, destRect, Rectangle.Empty, SpecialEffectsType.WipeRectangleOut, 5, 10, 0, 0, 3, 3, False, Color.Empty, 0, Color.Empty, properties, Nothing)
    'MessageBox.Show("Continue to next effect");

    rasterImage.Dispose()
    RasterCodecs.Shutdown()
End Sub
C# Copy Code
public void PaintImage(Graphics g, Rectangle destRect) 

   SpecialEffectsProcessor processor = new SpecialEffectsProcessor(); 
   RasterPaintProperties properties = new RasterPaintProperties(); 
   properties.RasterOperation = RasterPaintProperties.SourceCopy; 
 
   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   RasterImage rasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Image1.cmp"); 
 
   processor.PaintImage(g, 
                        rasterImage, 
                        Rectangle.Empty, 
                        Rectangle.Empty, 
                        destRect, 
                        Rectangle.Empty, 
                        SpecialEffectsType.Wipe4LRTB, /* effect to apply when painting the transition */ 
                        5,          /* graining size */ 
                        10,         /* delay between graining steps */ 
                        0,          /* speed of the wave */ 
                        0,          /* number of cycles or repetitions */ 
                        1,          /* step number for the pattern brush */ 
                        3,          /* maximum steps for the pattern brush */ 
                        false,      /* do not use transparency */ 
                        Color.Empty,/* no transparent color */ 
                        0,          /* wand width */ 
                        Color.Empty,/* no wand color */ 
                        properties, 
                        null); 
   //MessageBox.Show("Continue to next effect"); 
 
   processor.PaintImage(g, rasterImage, 
                        Rectangle.Empty, 
                        Rectangle.Empty, 
                        destRect, 
                        Rectangle.Empty, 
                        SpecialEffectsType.WipeRectangleIn,  /* effect to apply when painting the transition */ 
                        5,          /* graining size */ 
                        10,         /* delay between graining steps */ 
                        0,          /* speed of the wave */ 
                        0,          /* number of cycles or repetitions */ 
                        2,          /* step number for the pattern brush */ 
                        3,          /* maximum steps for the pattern brush */ 
                        false,      /* do not use transparency */ 
                        Color.Empty,/* no transparent color */ 
                        0,          /* wand width */ 
                        Color.Empty,/* no wand color */ 
                        properties, 
                        null); 
   //MessageBox.Show("Continue to next effect"); 
 
   processor.PaintImage(g, rasterImage, 
                        Rectangle.Empty, 
                        Rectangle.Empty, 
                        destRect, 
                        Rectangle.Empty, 
                        SpecialEffectsType.WipeRectangleOut,  /* effect to apply when painting the transition */ 
                        5,          /* graining size */ 
                        10,         /* delay between graining steps */ 
                        0,          /* speed of the wave */ 
                        0,          /* number of cycles or repetitions */ 
                        3,          /* step number for the pattern brush */ 
                        3,          /* maximum steps for the pattern brush */ 
                        false,      /* do not use transparency */ 
                        Color.Empty,/* no transparent color */ 
                        0,          /* wand width */ 
                        Color.Empty,/* no wand color */ 
                        properties, 
                        null); 
   //MessageBox.Show("Continue to next effect"); 
 
   rasterImage.Dispose(); 
   RasterCodecs.Shutdown(); 
}

Remarks

Use the grain and delay parameters to control the speed of the display. The grain parameter controls the size of the painting increment, and delay controls the time between increments.

The wand is a solid color bar that moves during an effect. Small grain sizes produce the best wand effects. Many of the effects listed in Effect Types can have a wand.

Use the pass and maxPass parameters to paint the image in more than one pass. For example, if you want a 3-pass paint, use maxPass of 3 and paint 3 times, once with pass = 1, once with pass = 2, and once with pass = 3.

Multipass painting for the PushClass is disabled.

If the effectType parameter is from the Twirl class, White Turnover class, Turnover class, Replace class, Laser class, Fade Normal class, Fade Black and White class, Fade Color class or Wave Class, the pass and maxPass parameters have no effect.

If the effectType parameter is from the Fade Normal class, Fade Black and White class or Fade Color class, the grain parameter has no effect. However, if the effectType parameter is from the Wave class, the grain parameter contains the wave size.

If the effectType parameter is from the White Turnover class, the Turnover class or the Replace class, the wandWidth and wandColor parameters have no effect. However, if the effectType parameter is from the Fade Color class, the wandColor parameter contains the bitmap color level.

The speed and cycles parameters have effect only if the effectType parameter is from the Wave class.

For general information, refer to Implementing Special Effects .

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also