VintaSoft Imaging .NET SDK v8.7
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! ]
            ' open an existing image
            Dim image As New Vintasoft.Imaging.VintasoftImage("Flower.jpg")
                
            ' create the command
            Dim command As New Vintasoft.Imaging.ImageProcessing.Color.ColorBlendCommand(Vintasoft.Imaging.ImageProcessing.BlendingMode.SoftLight, System.Drawing.Color.White)
            ' 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)
            ' subscribe to progress event
            AddHandler command.Progress, New System.EventHandler(Of Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs)(AddressOf command_Progress)
                
            Try
                ' execute the command
                command.ExecuteInPlace(image)
            Catch ex As Vintasoft.Imaging.ImageProcessing.ImageProcessingException
                ' show error message if problem occured
                System.Windows.Forms.MessageBox.Show(ex.Message)
                Return
            End Try
                
            ' save the processed image to the new file
            image.Save("processed-image.tif")
        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! ]
            // open an existing image
            Vintasoft.Imaging.VintasoftImage image = new Vintasoft.Imaging.VintasoftImage("Flower.jpg");
                
            // create the command
            Vintasoft.Imaging.ImageProcessing.Color.ColorBlendCommand command =
                new Vintasoft.Imaging.ImageProcessing.Color.ColorBlendCommand(
                    Vintasoft.Imaging.ImageProcessing.BlendingMode.SoftLight,
                    System.Drawing.Color.White);
            // 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);
            // subscribe to progress event
            command.Progress += new System.EventHandler<Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs>(command_Progress);
                
            try
            {
                // execute the command
                command.ExecuteInPlace(image);
            }
            catch (Vintasoft.Imaging.ImageProcessing.ImageProcessingException ex)
            {
                // show error message if problem occured
                System.Windows.Forms.MessageBox.Show(ex.Message);
                return;
            }
                
            // save the processed image to the new file
            image.Save("processed-image.tif");
        }
                
        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: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also