LEADTOOLS(Leadtoolsアセンブリ)

フレームを表示

FromKnownColorメソッド(RasterColor)








RasterKnownColor列挙体メンバの1つ。
既知のカラーから新しいRasterColor構造体を作成します。
構文
[CLSCompliantAttribute(false)]
public static RasterColor FromKnownColor( 
   RasterKnownColor knownColor
)
'Declaration
 
<CLSCompliantAttribute(False)>
Public Shared Function FromKnownColor( _
   ByVal knownColor As RasterKnownColor _
) As RasterColor
'Usage
 
Dim knownColor As RasterKnownColor
Dim value As RasterColor
 
value = RasterColor.FromKnownColor(knownColor)
[CLSCompliantAttribute(false)]
public static RasterColor FromKnownColor( 
   RasterKnownColor knownColor
)
CLSCompliantAttribute()
 function Leadtools.RasterColor.FromKnownColor( 
   knownColor 
)
[CLSCompliantAttribute(false)]
public:
static RasterColor FromKnownColor( 
   RasterKnownColor knownColor
) 

パラメーター

knownColor
RasterKnownColor列挙体メンバの1つ。

戻り値

新しいRasterColorオブジェクト。
解説

名前で知られている色からRasterColorオブジェクトを構築するために、RasterKnownColor列挙体を使うことができます。

サンプル
Copy Code  
Imports Leadtools

      
Public Sub FromKnownColorExample()
   ' Create a yellow color (R = 255, G = 255, B = 0)
   Dim clr1 As New RasterColor(255, 255, 0)
   ' Now create the same color using the "Yellow" known color
   Dim clr2 As RasterColor = RasterColor.FromKnownColor(RasterKnownColor.Yellow)

   ' Make sure both colors have the same value
   Debug.Assert(clr1.A = clr2.A)
   Debug.Assert(clr1.R = clr2.R)
   Debug.Assert(clr1.G = clr2.G)
   Debug.Assert(clr1.B = clr2.B)
End Sub
using Leadtools;

      
public void FromKnownColorExample()
{
   // Create a yellow color (R = 255, G = 255, B = 0)
   RasterColor clr1 = new RasterColor(255, 255, 0);
   // Now create the same color using the "Yellow" known color
   RasterColor clr2 = RasterColor.FromKnownColor(RasterKnownColor.Yellow);

   // Make sure both colors have the same value
   Assert.IsTrue(clr1.A == clr2.A);
   Assert.IsTrue(clr1.R == clr2.R);
   Assert.IsTrue(clr1.G == clr2.G);
   Assert.IsTrue(clr1.B == clr2.B);
}
RasterColorExamples.prototype.FromKnownColorExample = function ()
{
   with ( Leadtools){
      // Create a yellow color (R = 255, G = 255, B = 0)
      var clr1 = RasterColorHelper.create(255, 255, 0);

      // Now create the same color using the "Yellow" known color
      var clr2 = RasterColorHelper.fromKnownColor(RasterKnownColor.yellow);

      // Make sure both colors have the same value
      console.assert(clr1.a === clr2.a, "clr1.a === clr2.a");
      console.assert(clr1.r === clr2.r, "clr1.r === clr2.r");
      console.assert(clr1.g === clr2.g, "clr1.g === clr2.g");
      console.assert(clr1.b === clr2.b, "clr1.b === clr2.b");
   }
}
using Leadtools;

      
public void FromKnownColorExample()
{
   // Create a yellow color (R = 255, G = 255, B = 0)
   RasterColor clr1 = RasterColorHelper.Create(255, 255, 0);
   // Now create the same color using the "Yellow" known color
   RasterColor clr2 = RasterColorHelper.FromKnownColor(RasterKnownColor.Yellow);

   // Make sure both colors have the same value
   Assert.IsTrue(clr1.A == clr2.A);
   Assert.IsTrue(clr1.R == clr2.R);
   Assert.IsTrue(clr1.G == clr2.G);
   Assert.IsTrue(clr1.B == clr2.B);
}
必要条件

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

参照

参照

RasterColor構造体
RasterColorメンバ