Leadtools.Windows.Media.Effects Send comments on this topic. | Back to Introduction - LEADTOOLS WPF | Help Version 16.5.9.25
NewColor Property
See Also  Example
Leadtools.Windows.Media.Effects.Color Namespace > GrayScaleToDuotoneCommandBitmapEffect Class : NewColor Property





Array of Color structures that specifies an array of colors that will be mixed with the original gray values.

Syntax

Visual Basic (Declaration) 
Public Property NewColor As Color()
Visual Basic (Usage)Copy Code
Dim instance As GrayScaleToDuotoneCommandBitmapEffect
Dim value() As Color
 
instance.NewColor = value
 
value = instance.NewColor
C# 
public Color[] NewColor {get; set;}
C++/CLI 
public:
property array<Color>^ NewColor {
   array<Color>^ get();
   void set (Colorarray<value>^ value);
}
XAML Syntax 
cannot be used in XAML directly.Instead use x:Array Markup Extension.
XAML Attributes Usage 

<object Color =Color >

Dependencies Property Information 

Identifier field

NewColorProperty

Metadata properties set to true

None

XAML Syntax 
cannot be used in XAML directly.Instead use x:Array Markup Extension.
XAML Attributes Usage 

<object Color =Color >

Dependencies Property Information 

Identifier field

NewColorProperty

Metadata properties set to true

None

Return Value

Array of Color structures that specifies an array of colors that will be mixed with the original gray values. If this parameter is set to null, the Color property must contain a valid color. Pass null when you want the command to create the array of colors, two colors when replacing both colors in a binary image, or 256 colors when using a custom array of colors.

Example

Run the GrayScaleToDuotoneCommandBitmapEffect on an image.

Visual BasicCopy Code
' Run the GrayScaleToDuetone command on an image.
Public Sub NewColorPropertyExample(ByVal element As FrameworkElement)
   Dim effect As GrayScaleToDuotoneCommandBitmapEffect = New GrayScaleToDuotoneCommandBitmapEffect()
   Dim array() As Color
   Dim i As Integer
   ReDim array(255)
   For i = 0 To 255
      array(i) = Color.FromRgb(255, CType(i \ 4, Byte), CType(i, Byte))
   Next

   'Apply duotone conversion.
   effect.Type = GrayScaleToDuotoneCommandBitmapEffectsMixingType.ReplaceOldWithNew
   effect.NewColor = array
   element.BitmapEffect = effect

End Sub
C#Copy Code
//Run the GrayScaleToDuotone command on an image 
 public void NewColorPropertyExample(FrameworkElement element) 

   GrayScaleToDuotoneCommandBitmapEffect effect = new GrayScaleToDuotoneCommandBitmapEffect(); 
   // Prepare the command 
   System.Windows.Media.Color[] array = new System.Windows.Media.Color[256]; 
   for (int i = 0; i < 256; i++) 
      array[i] = System.Windows.Media.Color.FromRgb(255, (byte)(i / 4), (byte)(i)); 
   effect.NewColor = array; 
   effect.Type = GrayScaleToDuotoneCommandBitmapEffectsMixingType.ReplaceOldWithNew;  
   element.BitmapEffect = effect; 
}

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, Windows Server 2008 family

See Also