←Select platform

RasterColor Constructor(int,int,int)

Summary

Initializes a new RasterColor structure with specific values for red, green and blue.

Syntax
C#
VB
Objective-C
C++
Java
public RasterColor( 
   int red, 
   int green, 
   int blue 
) 
Public Function New( _ 
   ByVal red As Integer, _ 
   ByVal green As Integer, _ 
   ByVal blue As Integer _ 
) 
- (instancetype)initWithRed:(NSInteger)red  
                      green:(NSInteger)green  
                       blue:(NSInteger)blue 
public RasterColor( 
  int red,  
  int green,  
  int blue 
) 
public: 
RasterColor(  
   int red, 
   int green, 
   int blue 
) 

Parameters

red
The red component value for the new Color structure. Valid values are MinimumComponent through MaximumComponent.

green
The green component value for the new Color structure. Valid values are MinimumComponent through MaximumComponent.

blue
The blue component value for the new Color structure. Valid values are MinimumComponent through MaximumComponent.

Remarks

The alpha value will be set to MaximumComponent.

Example
C#
VB
using Leadtools; 
 
public void RasterColorExample() 
{ 
   Random rand = new Random(); 
 
   byte a = (byte)rand.Next(256); 
   byte r = (byte)rand.Next(256); 
   byte g = (byte)rand.Next(256); 
   byte b = (byte)rand.Next(256); 
 
   RasterColor clr = new RasterColor(a, r, g, b); 
 
   // Check 
   Assert.IsTrue(clr.A == a); 
   Assert.IsTrue(clr.R == r); 
   Assert.IsTrue(clr.G == g); 
   Assert.IsTrue(clr.B == b); 
} 
Imports Leadtools 
 
Public Sub RasterColorExample() 
   Dim rand As Random = New Random() 
 
   Dim a As Byte = CByte(rand.Next(256)) 
   Dim r As Byte = CByte(rand.Next(256)) 
   Dim g As Byte = CByte(rand.Next(256)) 
   Dim b As Byte = CByte(rand.Next(256)) 
 
   Dim clr As RasterColor = New RasterColor(a, r, g, b) 
 
   ' Check 
   Debug.Assert(clr.A = a) 
   Debug.Assert(clr.R = r) 
   Debug.Assert(clr.G = g) 
   Debug.Assert(clr.B = b) 
End Sub 
c#[Silverlight C# Example] 
using Leadtools; 
using Leadtools.Windows.Media; 
 
public void RasterColorExample() 
{ 
   Random rand = new Random(); 
 
   byte a = (byte)rand.Next(256); 
   byte r = (byte)rand.Next(256); 
   byte g = (byte)rand.Next(256); 
   byte b = (byte)rand.Next(256); 
 
   RasterColor clr = new RasterColor(a, r, g, b); 
 
   // Check 
   Debug.Assert(clr.A == a); 
   Debug.Assert(clr.R == r); 
   Debug.Assert(clr.G == g); 
   Debug.Assert(clr.B == b); 
} 
vb[Silverlight VB Example] 
Imports Leadtools 
Imports Leadtools.Windows.Media 
 
Public Sub RasterColorExample() 
   Dim rand As Random = New Random() 
 
   Dim a As Byte = CByte(rand.Next(256)) 
   Dim r As Byte = CByte(rand.Next(256)) 
   Dim g As Byte = CByte(rand.Next(256)) 
   Dim b As Byte = CByte(rand.Next(256)) 
 
   Dim clr As RasterColor = New RasterColor(a, r, g, b) 
 
   ' Check 
   Debug.Assert(clr.A = a) 
   Debug.Assert(clr.R = r) 
   Debug.Assert(clr.G = g) 
   Debug.Assert(clr.B = b) 
End Sub 

Requirements

Target Platforms

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

Leadtools Assembly