ImageAttributes.SetGamma メソッド (Single, ColorAdjustType)
アセンブリ: System.Drawing (system.drawing.dll 内)

Dim instance As ImageAttributes Dim gamma As Single Dim type As ColorAdjustType instance.SetGamma(gamma, type)
戻り値
このメソッドは値を返しません。

gamma パラメータは通常、1.0 ~ 2.2 の範囲の値です。ただし、状況によっては、0.1 ~ 5.0 の値が有効な場合があります。
ImageAttributes オブジェクトは、5 つの調整カテゴリ (既定、ビットマップ、ブラシ、ペン、テキスト) に関して色とグレースケールの設定を保持します。たとえば、既定のカテゴリに対してあるガンマ値を指定し、ビットマップ カテゴリには別のガンマ値を指定し、さらにペン カテゴリにも異なるガンマ値を指定できます。
既定のカラー調整設定値およびグレースケール調整設定値は、調整設定値が設定されていないすべてのカテゴリに対して適用されます。たとえば、ペン カテゴリの調整設定を一切指定していない場合、ペン カテゴリには既定の設定が適用されます。
特定のカテゴリに対してカラー調整設定値またはグレースケール調整設定値を指定すると、そのカテゴリに適用されていた既定の調整設定値は解除されます。たとえば、既定のカテゴリに対して調整設定値のコレクションを指定するとします。Pen を SetGamma メソッドに渡してペン カテゴリのガンマ値を設定すると、ペンには既定の調整設定は一切適用されません。
旧式の CRT モニタや、特殊な照明環境 (工場やウィンドウ ディスプレイなど) で使用されるモニタなどでは、通常の範囲外のガンマ値を使用した方がよい場合もあります。


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ImageAttributes.SetGamma メソッド (Single)
アセンブリ: System.Drawing (system.drawing.dll 内)


gamma パラメータは通常、1.0 ~ 2.2 の範囲の値です。ただし、状況によっては、0.1 ~ 5.0 の値が有効な場合があります。
ImageAttributes オブジェクトは、5 つの調整カテゴリ (既定、ビットマップ、ブラシ、ペン、テキスト) に関して色とグレースケールの設定を保持します。たとえば、既定のカテゴリに対してあるガンマ値を指定し、ビットマップ カテゴリには別のガンマ値を指定し、さらにペン カテゴリにも異なるガンマ値を指定できます。
既定のカラー調整設定値およびグレースケール調整設定値は、調整設定値が設定されていないすべてのカテゴリに対して適用されます。たとえば、ペン カテゴリの調整設定を一切指定していない場合、ペン カテゴリには既定の設定が適用されます。
旧式の CRT モニタや、特殊な照明環境 (工場やウィンドウ ディスプレイなど) で使用されるモニタなどでは、通常の範囲外のガンマ値を使用した方がよい場合もあります。

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。
-
ファイル Camera.jpg を使用する Image を開き、ガンマの既定値を使用してそのファイルを画面に描画します。
-
ImageAttributes オブジェクトを作成し、SetGamma メソッドを呼び出すことにより、そのオブジェクトのガンマを 2.2 に設定します。
-
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

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ImageAttributes.SetGamma メソッド
Weblioに収録されているすべての辞書からImageAttributes.SetGammaを検索する場合は、下記のリンクをクリックしてください。

- ImageAttributes.SetGammaのページへのリンク