LEADTOOLS (Leadtools assembly)
LEAD Technologies, Inc

RasterColor Constructor(Int32,Int32,Int32)

Example 





The red component value for the new Color structure. Valid values are MinimumComponent through MaximumComponent.
The green component value for the new Color structure. Valid values are MinimumComponent through MaximumComponent.
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. .NET support Silverlight support
Syntax
public RasterColor( 
   int red,
   int green,
   int blue
)
'Declaration
 
Public Function New( _
   ByVal red As Integer, _
   ByVal green As Integer, _
   ByVal blue As Integer _
)
'Usage
 
Dim red As Integer
Dim green As Integer
Dim blue As Integer
 
Dim instance As New RasterColor(red, green, blue)
public RasterColor( 
   int red,
   int green,
   int blue
)
function RasterColor( 
   red ,
   green ,
   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
 
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
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);
}
RasterColorExamples.prototype.RasterColorExample2 = function () {   
   with ( Leadtools){
      
      var a = Math.floor(Math.random()*256);
      var r = Math.floor(Math.random()*256);
      var g = Math.floor(Math.random()*256);
      var b = Math.floor(Math.random()*256);

      var clr = RasterColorHelper.create(a, r, g, b);

      // Check
      console.assert(clr.a === a, "clr.A == a");
      console.assert(clr.r === r,"clr.R == r");
      console.assert(clr.g === g, "clr.G == g");
      console.assert(clr.b === b, "clr.B == b");
   }
}
[TestMethod]
public void RasterColorExample2()
{
   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 = RasterColorHelper.Create(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);
}
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);
}
<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
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

RasterColor Structure
RasterColor Members
Overload List

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.