Leadtools.ImageProcessing.Effects Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
SourcePoint Property
See Also  Example
Leadtools.ImageProcessing.Effects Namespace > AlphaBlendCommand Class : SourcePoint Property



Gets or sets the point structure that contains the origin of the source rectangle.

Syntax

Visual Basic (Declaration) 
Public Property SourcePoint As Point
Visual Basic (Usage)Copy Code
Dim instance As AlphaBlendCommand
Dim value As Point
 
instance.SourcePoint = value
 
value = instance.SourcePoint
C# 
public Point SourcePoint {get; set;}
C++/CLI 
public:
property Point SourcePoint {
   Point get();
   void set (Point value);
}

Return Value

Point structure that contain the origin of the source rectangle. the Width and Height are the same Width and Height for the destination rectangle.

Example

Run the AlphaBlendCommand on an image.

Visual BasicCopy Code
Public Sub SourcePointPropertyExample()
   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
   command.DestinationRectangle = New Rectangle(Left, Top, Width, Height)
   command.SourceImage = srcImage
   command.SourcePoint = New Point(0, 0)
   command.Opacity = 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 SourcePointPropertyExample() 

   // 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(); 
   // Combine srcImage with image, with half opacity. 
   //command.DestinationRectangle = new Rectangle(image.Width / 2 - srcImage.Width / 2, image.Height / 2 - srcImage.Height / 2, image.Width / 2 + srcImage.Width / 8, image.Height / 2 + srcImage.Height / 8); 
   command.DestinationRectangle = new Rectangle(image.Width / 8, image.Height / 8, image.Width, image.Height); 
   command.SourceImage = srcImage; 
   command.SourcePoint = new Point(0,0); 
   command.Opacity = 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