LEADTOOLS(Leadtoolsアセンブリ)

フレームを表示

FromRgbメソッド(RasterColor)








rgb値。
rgb値からRasterColorを作成します。
構文
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
) 

パラメーター

rgb
rgb値。

戻り値

このメソッドが作成するRasterColor構造体。
サンプル

このサンプルは、256の濃淡のレベルを格納しているRasterColorの配列を作成します。

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
必要条件

ターゲットプラットホーム

参照

参照

RasterColor構造体
RasterColorメンバ