LEADTOOLS (Leadtools assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
RasterColor Constructor(Int32,Int32,Int32)
See Also  Example
Leadtools Namespace > RasterColor Structure > RasterColor Constructor : RasterColor Constructor(Int32,Int32,Int32)



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.
Initializes a new RasterColor structure with specific values for red, green and blue. Supported in Silverlight, Windows Phone 7

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal red As Integer, _
   ByVal green As Integer, _
   ByVal blue As Integer _
)
Visual Basic (Usage)Copy Code
Dim red As Integer
Dim green As Integer
Dim blue As Integer
 
Dim instance As New RasterColor(red, green, blue)
C# 
public RasterColor( 
   int red,
   int green,
   int blue
)
C++/CLI 
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.

Example

Visual BasicCopy Code
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#Copy Code
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);
}
SilverlightCSharpCopy Code
[TestMethod]
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);
}
SilverlightVBCopy Code
<TestMethod> _
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

Remarks

The alpha value will be set to MaximumComponent.

Requirements

Target Platforms: Silverlight, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only), Windows Phone 7

See Also