Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.6.28
|
Leadtools Namespace > RasterColor Structure : 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 = RasterColor.FromRgb(rgb)
public static RasterColor FromRgb( int rgb )
function Leadtools.RasterColor.FromRgb( rgb )
public: static RasterColor FromRgb( int rgb )
This example will create an array of RasterColor containing 256 shades of gray.
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