←Select platform

Opacity Property

Summary
Gets or set the opacity value used when combining the areas from the result of feathering and destination images.
Syntax
C#
C++/CLI
Python
public int Opacity { get; set; } 
public: 
property int Opacity { 
   int get(); 
   void set (    int ); 
} 
Opacity # get and set (TextureAlphaBlendCommand) 

Property Value

Opacity value used when combining the areas from the result of feathering and destination images. This value ranges from 0 to 255.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Effects; 
 
 
public void TextureAlphaBlendCommandExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg")); 
 
   // Prepare the command 
   RasterImage SrcImage; 
   RasterImage MaskImage; 
   RasterImage underlayImage; 
 
   SrcImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Image3.cmp"), 4, CodecsLoadByteOrder.Bgr, 1, 1); 
   //Load the fade mask image. 
   MaskImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\FadeMask.bmp"), 4, CodecsLoadByteOrder.Bgr, 1, 1); 
 
   underlayImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg"), 4, CodecsLoadByteOrder.Bgr, 1, 1); 
 
   TextureAlphaBlendCommand command = new TextureAlphaBlendCommand(); 
   command.DestinationRectangle = new LeadRect(image.Width / 2 - MaskImage.Width / 2, image.Height / 2 - MaskImage.Height / 2, MaskImage.Width, MaskImage.Height); 
   command.MaskImage = MaskImage; 
   command.Opacity = 100; 
   command.SourceImage = SrcImage; 
   command.SourcePoint = new LeadPoint(0, 0); 
   command.UnderlayImage = underlayImage; 
   // Combine ImageSource with the affected image, with MaskImage and a 100 opacity. 
   command.Run(image); 
   codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24); 
 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

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

Leadtools.ImageProcessing.Effects Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.