Leadtools Namespace > RasterColorHelper Class : FromRgb Method |
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 )
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
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); } }
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"); } } }
[TestMethod] 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); } }
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); } }
<TestMethod> _ 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
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