ImageAttributes.SetGammaとは? わかりやすく解説

ImageAttributes.SetGamma メソッド (Single, ColorAdjustType)

指定したカテゴリガンマ値設定します

名前空間: System.Drawing.Imaging
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub SetGamma ( _
    gamma As Single, _
    type As ColorAdjustType _
)
Dim instance As ImageAttributes
Dim gamma As Single
Dim type As ColorAdjustType

instance.SetGamma(gamma, type)
public void SetGamma (
    float gamma,
    ColorAdjustType type
)
public:
void SetGamma (
    float gamma, 
    ColorAdjustType type
)
public void SetGamma (
    float gamma, 
    ColorAdjustType type
)
public function SetGamma (
    gamma : float, 
    type : ColorAdjustType
)

パラメータ

gamma

ガンマ補正値。

type

ガンマ値設定する対象カテゴリ指定する ColorAdjustType の要素

戻り値
このメソッドは値を返しません。

解説解説

gamma パラメータ通常1.02.2範囲の値です。ただし、状況によっては、0.15.0 の値が有効な場合あります

ImageAttributes オブジェクトは、5 つ調整カテゴリ (既定ビットマップブラシペンテキスト) に関して色とグレースケール設定保持します。たとえば、既定カテゴリに対してあるガンマ値指定しビットマップ カテゴリには別のガンマ値指定し、さらにペン カテゴリにも異なガンマ値指定できます

既定カラー調整設定値およびグレースケール調整設定値は、調整設定値設定されていないすべてのカテゴリに対して適用されます。たとえば、ペン カテゴリ調整設定一切指定してない場合ペン カテゴリには既定設定適用されます。

特定のカテゴリに対してカラー調整設定値またはグレースケール調整設定値指定すると、そのカテゴリ適用されていた既定調整設定値解除されます。たとえば、既定カテゴリに対して調整設定値コレクション指定するとしますPen を SetGamma メソッド渡してペン カテゴリガンマ値設定すると、ペンには既定調整設定一切適用されません。

旧式CRT モニタや、特殊な照明環境 (工場ウィンドウ ディスプレイなど) で使用されるモニタなどでは、通常の範囲外ガンマ値使用した方がよい場合あります

使用例使用例
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ImageAttributes クラス
ImageAttributes メンバ
System.Drawing.Imaging 名前空間

ImageAttributes.SetGamma メソッド (Single)

既定カテゴリガンマ値設定します

名前空間: System.Drawing.Imaging
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub SetGamma ( _
    gamma As Single _
)
Dim instance As ImageAttributes
Dim gamma As Single

instance.SetGamma(gamma)
public void SetGamma (
    float gamma
)
public:
void SetGamma (
    float gamma
)
public void SetGamma (
    float gamma
)

パラメータ

gamma

ガンマ補正値。

戻り値
このメソッドは値を返しません。

解説解説
使用例使用例

次の例は、Windows フォームでの使用意図してデザインされており、Paint イベント ハンドラパラメータである PaintEventArgse が必要です。このコード次のアクション実行します

  1. ファイル Camera.jpg を使用する Image開きガンマ既定値使用してそのファイル画面描画ます。

  2. ImageAttributes オブジェクト作成し、SetGamma メソッド呼び出すことにより、そのオブジェクトガンマ2.2設定します

  3. ImageAttributes オブジェクト内に設定されガンマ値使用してイメージ (2 回目カメラ) を画面描画ます。

Public Sub SetGammaExample(ByVal
 e As PaintEventArgs)

    ' Create an Image object from the file Camera.jpg, and draw

    ' it to screen.
    Dim myImage As Image = Image.FromFile("Camera.jpg")
    e.Graphics.DrawImage(myImage, 20, 20)

    ' Create an ImageAttributes object and set the gamma to 2.2.
    Dim imageAttr As New
 ImageAttributes
    imageAttr.SetGamma(2.2F)

    ' Draw the image with gamma set to 2.2.
    Dim rect As New Rectangle(250,
 20, 200, 200)
    e.Graphics.DrawImage(myImage, rect, 0, 0, 200, 200, _
    GraphicsUnit.Pixel, imageAttr)
    ' Image
End Sub
private void SetGammaExample(PaintEventArgs
 e)
{
             
    // Create an Image object from the file Camera.jpg, and draw it
 to
    // the screen.
    Image myImage = Image.FromFile("Camera.jpg");
    e.Graphics.DrawImage(myImage, 20, 20);
             
    // Create an ImageAttributes object and set the gamma to 2.2.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetGamma(2.2f);
             
    // Draw the image with gamma set to 2.2.
    Rectangle rect = new Rectangle(250, 20, 200, 200);
    e.Graphics.DrawImage(myImage, rect, 0, 0, 200, 200, 
        GraphicsUnit.Pixel, imageAttr);    
}
private:
   void SetGammaExample( PaintEventArgs^ e )
   {
      // Create an Image object from the file Camera.jpg, and draw it
 to
      // the screen.
      Image^ myImage = Image::FromFile( "Camera.jpg" );
      e->Graphics->DrawImage( myImage, 20, 20 );

      // Create an ImageAttributes object and set the gamma to 2.2.
      ImageAttributes^ imageAttr = gcnew ImageAttributes;
      imageAttr->SetGamma( 2.2f );

      // Draw the image with gamma set to 2.2.
      Rectangle rect = Rectangle(250,20,200,200);
      e->Graphics->DrawImage( myImage, rect, 0, 0, 200, 200, GraphicsUnit::Pixel,
 imageAttr );
   }
private void SetGammaExample(PaintEventArgs
 e)
{
    // Create an Image object from the file Camera.jpg, and draw it
 to
    // the screen.
    Image myImage = Image.FromFile("Camera.jpg");

    e.get_Graphics().DrawImage(myImage, 20, 20);

    // Create an ImageAttributes object and set the gamma to 2.2.
    ImageAttributes imageAttr = new ImageAttributes();

    imageAttr.SetGamma(2.2F);

    // Draw the image with gamma set to 2.2.
    Rectangle rect = new Rectangle(250, 20, 200, 200);

    e.get_Graphics().DrawImage(myImage, rect, 0, 0, 200, 200, 
        GraphicsUnit.Pixel, imageAttr);
} //SetGammaExample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ImageAttributes クラス
ImageAttributes メンバ
System.Drawing.Imaging 名前空間

ImageAttributes.SetGamma メソッド

ガンマ設定します
オーバーロードの一覧オーバーロードの一覧

名前 説明
ImageAttributes.SetGamma (Single) 既定カテゴリガンマ値設定します
ImageAttributes.SetGamma (Single, ColorAdjustType) 指定したカテゴリガンマ値設定します
参照参照

関連項目

ImageAttributes クラス
ImageAttributes メンバ
System.Drawing.Imaging 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からImageAttributes.SetGammaを検索した結果を表示しています。
Weblioに収録されているすべての辞書からImageAttributes.SetGammaを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からImageAttributes.SetGamma を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ImageAttributes.SetGamma」の関連用語

ImageAttributes.SetGammaのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ImageAttributes.SetGammaのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS