ImageAttributes.SetThreshold メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
しきい値 (透明度の範囲) を設定します。
オーバーロード
SetThreshold(Single) |
既定のカテゴリのしきい値 (透明度の範囲) を指定します。 |
SetThreshold(Single, ColorAdjustType) |
指定したカテゴリのしきい値 (透明度の範囲) を設定します。 |
SetThreshold(Single)
既定のカテゴリのしきい値 (透明度の範囲) を指定します。
public:
void SetThreshold(float threshold);
public void SetThreshold (float threshold);
member this.SetThreshold : single -> unit
Public Sub SetThreshold (threshold As Single)
パラメーター
- threshold
- Single
しきい値を指定する実数。
例
次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgse
です。 コードは、次のアクションを実行します。
を Image 開き、画面に描画します。
オブジェクトを ImageAttributes 作成し、 メソッドを使用してそのしきい値を SetThreshold 設定します。
オブジェクトのしきい値を使用して、画面に画像を ImageAttributes 描画します。
void SetThresholdExample( PaintEventArgs^ e )
{
// Open an Image file, and draw it to the screen.
Image^ myImage = Image::FromFile( "Camera.jpg" );
e->Graphics->DrawImage( myImage, 20, 20 );
// Create an ImageAttributes object, and set its color threshold.
ImageAttributes^ imageAttr = gcnew ImageAttributes;
imageAttr->SetThreshold( 0.7f );
// Draw the image with the colors bifurcated.
Rectangle rect = Rectangle(300,20,200,200);
e->Graphics->DrawImage( myImage, rect, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr );
}
private void SetThresholdExample(PaintEventArgs e)
{
// Open an Image file, and draw it to the screen.
Image myImage = Image.FromFile("Camera.jpg");
e.Graphics.DrawImage(myImage, 20, 20);
// Create an ImageAttributes object, and set its color threshold.
ImageAttributes imageAttr = new ImageAttributes();
imageAttr.SetThreshold(0.7f);
// Draw the image with the colors bifurcated.
Rectangle rect = new Rectangle(300, 20, 200, 200);
e.Graphics.DrawImage(myImage, rect, 0, 0, 200, 200,
GraphicsUnit.Pixel, imageAttr);
}
Public Sub SetThresholdExample(ByVal e As PaintEventArgs)
' Open an Image file, and draw it to the screen.
Dim myImage As Image = Image.FromFile("Camera.jpg")
e.Graphics.DrawImage(myImage, 20, 20)
' Create an ImageAttributes object, and set its color threshold.
Dim imageAttr As New ImageAttributes
imageAttr.SetThreshold(0.7F)
' Draw the image with the colors bifurcated.
Dim rect As New Rectangle(300, 20, 200, 200)
e.Graphics.DrawImage(myImage, rect, 0, 0, 200, 200, _
GraphicsUnit.Pixel, imageAttr)
End Sub
注釈
しきい値は 0 ~ 1 の値で、各色コンポーネントのカットオフ ポイントを指定します。 たとえば、しきい値が 0.7 に設定されていて、赤、緑、青のコンポーネントがそれぞれ 230、50、220 である色をレンダリングするとします。 赤の成分 (230) は 0.7 x 255 より大きいので、赤のコンポーネントは 255 (完全な強度) に変更されます。 緑のコンポーネント (50) は 0.7x255 未満であるため、緑のコンポーネントは 0 に変更されます。 青いコンポーネント (220) は 0.7x255 より大きいので、青のコンポーネントは 255 に変更されます。
オブジェクトは ImageAttributes 、既定、ビットマップ、ブラシ、ペン、テキストの 5 つの調整カテゴリの色とグレースケールの設定を保持します。 たとえば、既定のカテゴリのしきい値、ビットマップ カテゴリのしきい値、ペン カテゴリに別のしきい値を指定できます。
既定の色調整とグレースケール調整の設定は、独自の調整設定を持たないすべてのカテゴリに適用されます。 たとえば、ペン カテゴリの調整設定を指定しない場合、既定の設定はペン カテゴリに適用されます。
適用対象
SetThreshold(Single, ColorAdjustType)
指定したカテゴリのしきい値 (透明度の範囲) を設定します。
public:
void SetThreshold(float threshold, System::Drawing::Imaging::ColorAdjustType type);
public void SetThreshold (float threshold, System.Drawing.Imaging.ColorAdjustType type);
member this.SetThreshold : single * System.Drawing.Imaging.ColorAdjustType -> unit
Public Sub SetThreshold (threshold As Single, type As ColorAdjustType)
パラメーター
- threshold
- Single
最大値または最小値に変換する色の並べ替えのためのブレークポイントとして使用される、0.0 ~ 1.0 の範囲内のしきい値。
- type
- ColorAdjustType
色のしきい値を設定する対象のカテゴリを指定する ColorAdjustType の要素。
例
コード例については、 メソッドを SetThreshold(Single) 参照してください。
注釈
しきい値は 0 ~ 1 の値で、各色コンポーネントのカットオフ ポイントを指定します。 たとえば、しきい値が 0.7 に設定されていて、赤、緑、青のコンポーネントがそれぞれ 230、50、220 である色をレンダリングするとします。 赤の成分 (230) は 0.7 x 255 より大きいので、赤のコンポーネントは 255 (完全な強度) に変更されます。 緑のコンポーネント (50) は 0.7x255 未満であるため、緑のコンポーネントは 0 に変更されます。 青いコンポーネント (220) は 0.7x255 より大きいので、青のコンポーネントは 255 に変更されます。
オブジェクトは ImageAttributes 、既定、ビットマップ、ブラシ、ペン、テキストの 5 つの調整カテゴリの色とグレースケールの設定を保持します。 たとえば、既定のカテゴリのしきい値、ビットマップ カテゴリのしきい値、ペン カテゴリに別のしきい値を指定できます。
既定の色調整とグレースケール調整の設定は、独自の調整設定を持たないすべてのカテゴリに適用されます。 たとえば、ペン カテゴリの調整設定を指定しない場合、既定の設定はペン カテゴリに適用されます。
特定のカテゴリに対して色調整またはグレースケール調整設定を指定するとすぐに、既定の調整設定がそのカテゴリに適用されなくなります。 たとえば、既定のカテゴリの調整設定のコレクションを指定するとします。 メソッドに渡 Pen してペン カテゴリのしきい値を SetThreshold 設定した場合、既定の調整設定はペンに適用されません。
適用対象
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示