←Select platform

FeatherAlphaBlendCommand Constructor(RasterImage,LeadPoint,LeadRect,RasterImage)

Summary
Initializes a new FeatherAlphaBlendCommand class object with explicit parameters.
Syntax
C#
Objective-C
C++/CLI
Java
Python
- (instancetype)initWithSourceImage:(LTRasterImage *)sourceImage sourcePoint:(LeadPoint)sourcePoint destinationRectangle:(LeadRect)destinationRectangle maskImage:(LTRasterImage *)maskImage; 
__init__(self,sourceImage,sourcePoint,destinationRectangle,maskImage) # Overloaded constructor 

Parameters

sourceImage
RasterImage object that references the source image.

sourcePoint
LeadPoint structure that contains the origin of the source rectangle. The width and height are the same width and height for the destination rectangle.

destinationRectangle
LeadRect structure that contains the destination rectangle.

maskImage
RasterImage object that references the fade mask. If you want to combine the two images just with opacity set this property to null.

Example

Run the FeatherAlphaBlendCommand on an image.

C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Effects; 
 
 
public void FeatherAlphaBlendConstructorExample_S1() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg")); 
 
   // Prepare the command 
   try 
   { 
      RasterImage maskImage; 
      // Loading the maskimage. 
      maskImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Image3.cmp"), 24, CodecsLoadByteOrder.Bgr, 1, 1); 
      FeatherAlphaBlendCommand command = new FeatherAlphaBlendCommand(image, new LeadPoint(image.Width / 2, image.Height / 2), new LeadRect(0, 0, image.Width / 2, image.Height / 2), maskImage); 
      command.Run(image); 
      codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24); 
   } 
   catch (Exception exception) 
   { 
      MessageBox.Show(exception.Message); 
   } 
 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.File; 
import java.io.IOException; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.assertTrue; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.imageprocessing.effects.*; 
 
 
public void featherAlphaBlendConstructorExample_S1() { 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.setThrowExceptionsOnInvalidImages(true); 
 
   RasterImage image = codecs.load(combine(LEAD_VARS_IMAGES_DIR, "Master.jpg")); 
 
   // Prepare the command 
   try { 
      RasterImage maskImage; 
      // Loading the maskimage. 
      maskImage = codecs.load(combine(LEAD_VARS_IMAGES_DIR, "Image3.cmp"), 24, CodecsLoadByteOrder.BGR, 1, 1); 
      FeatherAlphaBlendCommand command = new FeatherAlphaBlendCommand(image, 
            new LeadPoint(image.getWidth() / 2, image.getHeight() / 2), 
            new LeadRect(0, 0, image.getWidth() / 2, image.getHeight() / 2), maskImage); 
      int change = command.run(image); 
      assertTrue(change != RasterImageChangedFlags.NONE); 
      codecs.save(image, combine(LEAD_VARS_IMAGES_DIR, "Result.jpg"), RasterImageFormat.JPEG, 24); 
 
   } catch (Exception exception) { 
      System.out.println(exception.getMessage()); 
   } 
} 
Requirements

Target Platforms

Help Version 23.0.2024.3.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 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.