VintaSoft Imaging .NET SDK v9.1 for .NET
Vintasoft.Imaging.ImageProcessing Namespace / BlendingMode Enumeration
Example Example



In This Topic
    BlendingMode Enumeration
    In This Topic
    Specifies available blending modes.
    Syntax
    'Declaration
     
    Public Enum BlendingMode 
       Inherits System.Enum
    public enum BlendingMode : System.Enum 
    __value public enum BlendingMode : public System.Enum 
    public enum class BlendingMode : public System.Enum 
    Members
    MemberDescription
    BrightnessSelects the brightness of the backdrop and source colors.
    ColorCreates a color with the hue and saturation of the source color and the luminosity of the backdrop color. This preserves the gray levels of the backdrop and is useful for coloring monochrome images or tinting color images.
    ColorBurnDarkens the backdrop color to reflect the source color. Painting with white produces no change.
    ColorDodgeBrightens the backdrop color to reflect the source color. Painting with black produces no changes.
    ContrastSelects the contrast of the backdrop and source colors.
    DarkenSelects the darker of the backdrop and source colors.
    DifferenceSubtracts the darker of the two constituent colors from the lighter color.
    DivisionDivides the backdrop and source color values.
    ExclusionProduces an effect similar to that of the Difference mode but lower in contrast. Painting with white inverts the backdrop color; painting with black produces no change.
    GammaSelects the gamma of the backdrop and source colors.
    HardLightMultiplies or screens the colors, depending on the source color value. The effect is similar to shining a harsh spotlight on the backdrop.
    HueCreates a color with the hue of the source color and the saturation and luminosity of the backdrop color.
    LightenSelects the lighter of the backdrop and source colors.
    LuminosityCreates a color with the luminosity of the source color and the hue and saturation of the backdrop color. This produces an inverse effect to that of the Color mode.
    MaxSelects the max of the backdrop and source colors.
    MinSelects the min of the backdrop and source colors.
    MultiplyMultiplies the backdrop and source color values.
    NormalSelects the source color, ignoring the backdrop.
    OverlayMultiplies or screens the colors, depending on the backdrop color value. Source colors overlay the backdrop while preserving its highlights and shadows. The backdrop color is not replaced but is mixed with the source color to reflect the lightness or darkness of the backdrop.
    SaturationCreates a color with the saturation of the source color and the hue and luminosity of the backdrop color. Painting with this mode in an area of the backdrop that is a pure gray (no saturation) produces no change.
    ScreenMultiplies the complements of the backdrop and source color values, then complements the result.
    SoftLightDarkens or lightens the colors, depending on the source color value. The effect is similar to shining a diffused spotlight on the backdrop
    SubSub of the backdrop and source colors.
    SumSum of the backdrop and source colors.
    Remarks
    Example
    This example shows how to load an image from disk, blend the colors in the specified region of the image and save the result to a new image file.
    Class ColorBlendCommandExample
    	Public Sub ProcessImage()
    		' [ do not forget to set your image file path here! ]
    		' create an image collection
    		Using images As New Vintasoft.Imaging.ImageCollection()
    			' add image to the image collection
    			images.Add("Flower.jpg")
    			Try
    				' create the image processing command
    				Dim command As New Vintasoft.Imaging.ImageProcessing.Color.ColorBlendCommand(Vintasoft.Imaging.ImageProcessing.BlendingMode.SoftLight, System.Drawing.Color.White)
                
    				' subscribe to progress event of image processing command
    				AddHandler command.Progress, New System.EventHandler(Of Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs)(AddressOf command_Progress)
                
    				Try
    					' for each image in image collection
    					For Each image As Vintasoft.Imaging.VintasoftImage In images
    						' set the region-of-interest to the left part of the image
    						command.RegionOfInterest = New Vintasoft.Imaging.RegionOfInterest(0, 0, image.Width \ 2, image.Height)
    						' apply the image processing command to the image
    						command.ExecuteInPlace(image)
    					Next
    				Catch ex As Vintasoft.Imaging.ImageProcessing.ImageProcessingException
    					' show error message
    					System.Windows.Forms.MessageBox.Show(ex.Message)
    					Return
    				End Try
                
    				' save the processed image collection to a new TIFF file
    				images.SaveSync("processed-image.tif")
    			Finally
    				images.ClearAndDisposeItems()
    			End Try
    		End Using
                
    	End Sub
                
    	Private Sub command_Progress(sender As Object, e As Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs)
    		' update progress info using e.Progress property
    		' ...
                
    		' cancel execution of command using e.Cancel property if necessary
    		' ...
    	End Sub
    End Class
    class ColorBlendCommandExample
    {
        public void ProcessImage()
        {
            // [ do not forget to set your image file path here! ]
            // create an image collection
            using (Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection())
            {
                // add image to the image collection
                images.Add("Flower.jpg");
                try
                {
                    // create the image processing command
                    Vintasoft.Imaging.ImageProcessing.Color.ColorBlendCommand command =
                        new Vintasoft.Imaging.ImageProcessing.Color.ColorBlendCommand(
                            Vintasoft.Imaging.ImageProcessing.BlendingMode.SoftLight,
                            System.Drawing.Color.White);
                
                    // subscribe to progress event of image processing command
                    command.Progress +=
                        new System.EventHandler<Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs>(command_Progress);
                
                    try
                    {
                        // for each image in image collection
                        foreach (Vintasoft.Imaging.VintasoftImage image in images)
                        {
                            // set the region-of-interest to the left part of the image
                            command.RegionOfInterest = new Vintasoft.Imaging.RegionOfInterest(0, 0, image.Width / 2, image.Height);
                            // apply the image processing command to the image
                            command.ExecuteInPlace(image);
                        }
                    }
                    catch (Vintasoft.Imaging.ImageProcessing.ImageProcessingException ex)
                    {
                        // show error message
                        System.Windows.Forms.MessageBox.Show(ex.Message);
                        return;
                    }
                
                    // save the processed image collection to a new TIFF file
                    images.SaveSync("processed-image.tif");
                }
                finally
                {
                    images.ClearAndDisposeItems();
                }
            }
                
        }
                
        void command_Progress(object sender, Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs e)
        {
            // update progress info using e.Progress property
            // ...
                
            // cancel execution of command using e.Cancel property if necessary
            // ...
        }
    }
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             Vintasoft.Imaging.ImageProcessing.BlendingMode

    Requirements

    Target Platforms: .NET 5 Preview 7; .NET Core 3.1; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also