LEADTOOLS Special Effects (Leadtools.SpecialEffects assembly)
LEAD Technologies, Inc

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

Example 





The destination Graphics object.
Pointer to an object that references the bitmap that has the region to paint.
Rectangle to be used as the display source rectangle that specifies the part of the image to use as the display source.
Rectangle to be used as the display source clipping rectangle. The display source clipping rectangle specifies the portion of the display source to be painted. Generally, this is used for updating the display when part of the source image has changed.
Rectangle to be used as the display destination 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 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.
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.
Applies an effect when painting a bitmap region to a device context. This method works the same as PaintImageEffect, except that only the bitmap region is painted.
Syntax
'Declaration
 
Public Overloads Sub PaintImageRegionEffect( _
   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 _
) 
'Usage
 
Dim instance As SpecialEffectsProcessor
Dim g As Graphics
Dim image As RasterImage
Dim src As Rectangle
Dim srcClip As Rectangle
Dim dest As Rectangle
Dim destClip As Rectangle
Dim paintProperties As RasterPaintProperties
Dim effectType As SpecialEffectsType
Dim progressCallback As SpecialEffectsProgress
 
instance.PaintImageRegionEffect(g, image, src, srcClip, dest, destClip, paintProperties, effectType, progressCallback)
 function Leadtools.SpecialEffects.SpecialEffectsProcessor.PaintImageRegionEffect(Graphics,RasterImage,Rectangle,Rectangle,Rectangle,Rectangle,RasterPaintProperties,SpecialEffectsType,SpecialEffectsProgress)( 
   g ,
   image ,
   src ,
   srcClip ,
   dest ,
   destClip ,
   paintProperties ,
   effectType ,
   progressCallback 
)

Parameters

g
The destination Graphics object.
image
Pointer to an object that references the bitmap that has the region to paint.
src
Rectangle to be used as the display source rectangle that specifies the part of the image to use as the display source.
srcClip
Rectangle to be used as the display source clipping rectangle. The display source clipping rectangle specifies the portion of the display source to be painted. Generally, this is used for updating the display when part of the source image has changed.
dest
Rectangle to be used as the display destination 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.
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.
paintProperties
Options for the display.
effectType
Effect to apply when painting. For valid values, refer to SpecialEffectsType.
progressCallback
Callback method that will be called when the paint image effect is started to determine the status for the paint of the image effect.
Remarks
Multipass painting for the PushClass is disabled.
Example
Copy CodeCopy Code  
Public Sub PaintImageRegionEffect(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.PaintImageRegionEffect(g, rasterImage, Rectangle.Empty, Rectangle.Empty, destRect, Rectangle.Empty, properties, SpecialEffectsType.SpiralIn, _
                                       AddressOf SpecialEffectsProgress)

      rasterImage.Dispose()
   End Sub

   Private Shared Function SpecialEffectsProgress(ByVal percent As Integer) As Boolean
      Console.WriteLine("{0}%", percent)
      Return True
   End Function

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
public void PaintImageRegionEffect(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.PaintImageRegionEffect(g, rasterImage,
                                       Rectangle.Empty, /* Default source rectangle */
                                       Rectangle.Empty, /* Default source clip area */
                                       destRect, /* Destination rectangle */
                                       Rectangle.Empty, /* Default destination clipping rectangle */
                                       properties,
                                       SpecialEffectsType.SpiralIn, /* Spiral effect */
                                       SpecialEffectsProgress);

      rasterImage.Dispose();
   }

   static bool SpecialEffectsProgress(int percent)
   {
      Console.WriteLine("{0}%", percent);
      return true;
   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

SpecialEffectsProcessor Class
SpecialEffectsProcessor Members
Overload List

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.