PaintImageEffect(Graphics,RasterImage,Rectangle,Rectangle,Rectangle,Rectangle,RasterPaintProperties,SpecialEffectsType,SpecialEffectsProgress) Method

Applies an effect when painting a bitmap to a screen. The effect, commonly used for slide show transitions, specifies how the image is painted, not how it looks when painting is finished.
public void PaintImageEffect( 
   Graphics g, 
   RasterImage image, 
   Rectangle src, 
   Rectangle srcClip, 
   Rectangle dest, 
   Rectangle destClip, 
   RasterPaintProperties paintProperties, 
   SpecialEffectsType effectType, 
   SpecialEffectsProgress progressCallback 
Public Sub PaintImageEffect( 
   ByVal g As Graphics, 
   ByVal image As RasterImage, 
   ByVal src As Rectangle, 
   ByVal srcClip As Rectangle, 
   ByVal dest As Rectangle, 
   ByVal destClip As Rectangle, 
   ByVal paintProperties As RasterPaintProperties, 
   ByVal effectType As SpecialEffectsType, 
   ByVal progressCallback As SpecialEffectsProgress 
   void PaintImageEffect( 
       Graphics^ g, 
      RasterImage^ image, 
      Rectangle^ src, 
      Rectangle^ srcClip, 
      Rectangle^ dest, 
      Rectangle^ destClip, 
      RasterPaintProperties^ paintProperties, 
      SpecialEffectsType^ effectType, 
      SpecialEffectsProgress^ progressCallback 


The destination Graphics object.

Pointer to an object that references the image to be painted.

Rectangle that specifies the part of the image to use as the display source.

Rectangle that specifies the portion of the display source to paint. Generally, this is used for updating the display when part of the source image has changed.

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 Rectangle object.

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.

Options for the display.

Effect to apply when painting. For valid values, refer to SpecialEffectsType.

Callback method that will be called when the paint image effect is started to determine the status for the paint of the image effect.


If the screen has fewer colors than the image, this method dithers the output to that display surface without affecting the actual image data.

PaintImageEffect paints an image faster if its view perspective is bottom left. LEAD CMP images have a bottom-left view perspective, but some other formats have a top-left perspective. To get uniformly fast paints on all images, you can set the perspective after you load them. (You do not have to change them back before saving them in the original format, because the save methods set the orientation for the specified format.)

Multipass painting for the PushClass is disabled.


This example shows the minimum requirements for using PaintImageEffect(Graphics,RasterImage,Rectangle,Rectangle,Rectangle,Rectangle,RasterPaintProperties,SpecialEffectsType,SpecialEffectsProgress) method to paint an image .

using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.SpecialEffects; 
using Leadtools.Drawing; 
public void PaintImageEffect(Graphics g, Rectangle destRect) 
   SpecialEffectsProcessor processor = new SpecialEffectsProcessor(); 
   RasterPaintProperties properties = new RasterPaintProperties(); 
   properties.RasterOperation = RasterPaintProperties.SourceCopy; 
   RasterCodecs codecs = new RasterCodecs(); 
   RasterImage rasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")); 
   processor.PaintImageEffect(g, rasterImage, 
                              Rectangle.Empty, /* Default source rectangle */ 
                              Rectangle.Empty, /* Default source clip area */ 
                              destRect, /* Destination rectangle */ 
                              Rectangle.Empty, /* Default destination clipping rectangle */ 
                              SpecialEffectsType.SpiralIn, /* Spiral effect */ 
static class LEAD_VARS 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.SpecialEffects 
Imports Leadtools.Drawing 
Public Sub PaintImageEffect(ByVal g As Graphics, ByVal destRect As Rectangle) 
   Dim processor As SpecialEffectsProcessor = New SpecialEffectsProcessor() 
   Dim properties As RasterPaintProperties = New RasterPaintProperties() 
   properties.RasterOperation = RasterPaintProperties.SourceCopy 
   Dim codecs As RasterCodecs = New RasterCodecs() 
   Dim rasterImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")) 
   processor.PaintImageEffect(g, rasterImage, Rectangle.Empty, Rectangle.Empty, destRect, Rectangle.Empty, properties, SpecialEffectsType.SpiralIn, Nothing) 
End Sub 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images" 
End Class 

Target Platforms

Help Version 21.0.2021.3.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.SpecialEffects Assembly