Leadtools.ImageProcessing.Effects Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
AlphaBlendCommand Constructor(RasterImage,Point,Rectangle,Int32)
See Also  Example
Leadtools.ImageProcessing.Effects Namespace > AlphaBlendCommand Class > AlphaBlendCommand Constructor : AlphaBlendCommand Constructor(RasterImage,Point,Rectangle,Int32)



sourceImage
RasterImage object that references the source image.
sourcePoint
Point structure that contains the origin of the source rectangle. The width and height are the same width and height for the destination rectangle.
destinationRect
Rectangle structure that contains the destination rectangle.
opacity
Opacity value used when combining the areas from the source and affected images. This value is between 0 and 255.
Initializes a new AlphaBlendCommand class object with explicit parameters.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal sourceImage As RasterImage, _
   ByVal sourcePoint As Point, _
   ByVal destinationRect As Rectangle, _
   ByVal opacity As Integer _
)
Visual Basic (Usage)Copy Code
Dim sourceImage As RasterImage
Dim sourcePoint As Point
Dim destinationRect As Rectangle
Dim opacity As Integer
 
Dim instance As AlphaBlendCommand(sourceImage, sourcePoint, destinationRect, opacity)
C# 
public AlphaBlendCommand( 
   RasterImage sourceImage,
   Point sourcePoint,
   Rectangle destinationRect,
   int opacity
)
C++/CLI 
public:
AlphaBlendCommand( 
   RasterImage sourceImage,
   Point sourcePoint,
   Rectangle destinationRect,
   int opacity
)

Parameters

sourceImage
RasterImage object that references the source image.
sourcePoint
Point structure that contains the origin of the source rectangle. The width and height are the same width and height for the destination rectangle.
destinationRect
Rectangle structure that contains the destination rectangle.
opacity
Opacity value used when combining the areas from the source and affected images. This value is between 0 and 255.

Example

Run the AlphaBlendCommand on an image.

Visual BasicCopy Code
Public Sub AlphaBlendConstructorExample()
   RasterCodecs.Startup()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg")

   ' Prepare the command
   Dim srcImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Image3.cmp", 24, CodecsLoadByteOrder.Bgr, 1, 1)

   Dim Left As Integer = CType((leadImage.Width / 8), Integer)
   Dim Top As Integer = CType((leadImage.Height / 8), Integer)
   Dim Width As Integer = CType(leadImage.Width, Integer)
   Dim Height As Integer = CType(leadImage.Height, Integer)

   ' Combine srcImage with image, with half opacity.
   Dim command As AlphaBlendCommand = New AlphaBlendCommand(srcImage, New Point(0, 0), New Rectangle(Left, Top, Width, Height), 128)
   command.Run(leadImage)
   codecs.Save(leadImage, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24)

   RasterCodecs.Shutdown()
End Sub
C#Copy Code
public void AlphaBlendConstructorExample() 

   // Load an image 
   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg"); 
 
   // Prepare the command 
   RasterImage srcImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "image3.cmp", 24, CodecsLoadByteOrder.Bgr, 1, 1); 
   AlphaBlendCommand command = new AlphaBlendCommand(srcImage, new Point(0, 0), new Rectangle(image.Width / 8, image.Height / 8, image.Width, image.Height), 128); 
   command.Run(image); 
   codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24); 
 
   RasterCodecs.Shutdown(); 
}

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