LEADTOOLS (Leadtools assembly)

FromRgb Method (RasterColorHelper)

Show in webframe
Example 







The RGB value.
Creates a RasterColor from an RGB value.
Syntax
public static RasterColor FromRgb( 
   int rgb
)
'Declaration
 
Public Shared Function FromRgb( _
   ByVal rgb As Integer _
) As RasterColor
'Usage
 
Dim rgb As Integer
Dim value As RasterColor
 
value = RasterColorHelper.FromRgb(rgb)
public static RasterColor FromRgb( 
   int rgb
)

            

            
 function Leadtools.RasterColorHelper.FromRgb( 
   rgb 
)
public:
static RasterColor FromRgb( 
   int rgb
) 

Parameters

rgb
The RGB value.

Return Value

The RasterColor structure that this method creates.
Example
Copy Code  
Imports Leadtools

  Public Sub FromRgbExample()
   Dim colors As RasterColor() = New RasterColor(RasterColor.MaximumComponent - RasterColor.MinimumComponent) {}
   Dim i As Integer = RasterColor.MinimumComponent
   Do While i < RasterColor.MaximumComponent
      colors(i) = RasterColor.FromRgb(i)
      i += 1
   Loop

   i = RasterColor.MinimumComponent
   Do While i < RasterColor.MaximumComponent
      Debug.Assert(colors(i).ToRgb() = i)
      i += 1
   Loop
End Sub
using Leadtools;

      
public void FromRgbExample()
{
   RasterColor[] colors = new RasterColor[RasterColor.MaximumComponent - RasterColor.MinimumComponent + 1];
   for(int i = RasterColor.MinimumComponent; i < RasterColor.MaximumComponent; i++)
   {
      colors[i] = RasterColor.FromRgb(i);
   }
   for(int i = RasterColor.MinimumComponent; i < RasterColor.MaximumComponent; i++)
   {
      Assert.IsTrue(colors[i].ToRgb() == i);
   }
}
RasterColorExamples.prototype.FromRgbExample = function () {
   with (Leadtools) {
      var colors = new Array(RasterColorHelper.maximumComponent - RasterColorHelper.minimumComponent);


      for (var i = RasterColorHelper.minimumComponent; i < RasterColorHelper.maximumComponent; i++) {
         colors[i] = RasterColorHelper.fromRgb(i);
      }

      for (var i = RasterColorHelper.minimumComponent; i < RasterColorHelper.maximumComponent; i++) {
         console.assert((RasterColorHelper.toRgb(colors[i]) === i), "Color not RGB");
      }
   }
}
using Leadtools;

      
public void FromRgbExample()
{
   RasterColor[] colors = new RasterColor[RasterColorHelper.MaximumComponent - RasterColorHelper.MinimumComponent + 1];
   for (int i = RasterColorHelper.MinimumComponent; i < RasterColorHelper.MaximumComponent; i++)
   {
      colors[i] = RasterColorHelper.FromRgb(i);
   }
   for (int i = RasterColorHelper.MinimumComponent; i < RasterColorHelper.MaximumComponent; i++)
   {
      Assert.IsTrue(RasterColorHelper.ToRgb(colors[i]) == i);
   }
}
using Leadtools;
using Leadtools.Windows.Media;

public void FromRgbExample()
{
   RasterColor[] colors = new RasterColor[RasterColor.MaximumComponent - RasterColor.MinimumComponent + 1];
   for(int i = RasterColor.MinimumComponent; i < RasterColor.MaximumComponent; i++)
   {
      colors[i] = RasterColor.FromRgb(i);
   }

   for(int i = RasterColor.MinimumComponent; i < RasterColor.MaximumComponent; i++)
   {
      Debug.Assert(colors[i].ToRgb() == i);
   }
}
Imports Leadtools
Imports Leadtools.Windows.Media

      
Public Sub FromRgbExample()
   Dim colors As RasterColor() = New RasterColor(RasterColor.MaximumComponent - RasterColor.MinimumComponent){}
   Dim i As Integer = RasterColor.MinimumComponent
   Do While i < RasterColor.MaximumComponent
      colors(i) = RasterColor.FromRgb(i)
      i += 1
   Loop
   i = RasterColor.MinimumComponent
   Do While i < RasterColor.MaximumComponent
      Debug.Assert(colors(i).ToRgb() = i)
      i += 1
   Loop
End Sub
Requirements

Target Platforms

See Also

Reference

RasterColorHelper Class
RasterColorHelper Members

 

 


Products | Support | Contact Us | Copyright Notices

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