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


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

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。
左側のイメージは強く色あせ (ガンマ 0.25)、右側のイメージの方がコントラストが大きくなっている (ガンマ 1.0) ことに注意してください。
Public Sub SetNoOpExample(ByVal e As PaintEventArgs) ' Create an Image object from the file Camera.jpg. Dim myImage As Image = Image.FromFile("Camera.jpg") ' Create an ImageAttributes object, and set the gamma to 0.25. Dim imageAttr As New ImageAttributes imageAttr.SetGamma(0.25F) ' Draw the image with gamma set to 0.25. Dim rect1 As New Rectangle(20, 20, 200, 200) e.Graphics.DrawImage(myImage, rect1, 0, 0, 200, 200, _ GraphicsUnit.Pixel, imageAttr) ' Call the ImageAttributes NoOp method. imageAttr.SetNoOp() ' Draw the image with gamma set to 0.25, but now NoOp is set, ' so the uncorrected image will be shown. Dim rect2 As New Rectangle(250, 20, 200, 200) e.Graphics.DrawImage(myImage, rect2, 0, 0, 200, 200, _ GraphicsUnit.Pixel, imageAttr) ' Image End Sub
private void SetNoOpExample(PaintEventArgs e) { // Create an Image object from the file Camera.jpg. Image myImage = Image.FromFile("Camera.jpg"); // Create an ImageAttributes object, and set the gamma to 0.25. ImageAttributes imageAttr = new ImageAttributes(); imageAttr.SetGamma(0.25f); // Draw the image with gamma set to 0.25. Rectangle rect1 = new Rectangle(20, 20, 200, 200); e.Graphics.DrawImage(myImage, rect1, 0, 0, 200, 200, GraphicsUnit.Pixel, imageAttr); // Call the ImageAttributes NoOp method. imageAttr.SetNoOp(); // Draw the image after NoOp is set, so the default gamma value // of 1.0 will be used. Rectangle rect2 = new Rectangle(250, 20, 200, 200); e.Graphics.DrawImage(myImage, rect2, 0, 0, 200, 200, GraphicsUnit.Pixel, imageAttr); }
private: void SetNoOpExample( PaintEventArgs^ e ) { // Create an Image object from the file Camera.jpg. Image^ myImage = Image::FromFile( "Camera.jpg" ); // Create an ImageAttributes object, and set the gamma to 0.25. ImageAttributes^ imageAttr = gcnew ImageAttributes; imageAttr->SetGamma( 0.25f ); // Draw the image with gamma set to 0.25. Rectangle rect1 = Rectangle(20,20,200,200); e->Graphics->DrawImage( myImage, rect1, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr ); // Call the ImageAttributes NoOp method. imageAttr->SetNoOp(); // Draw the image after NoOp is set, so the default gamma value // of 1.0 will be used. Rectangle rect2 = Rectangle(250,20,200,200); e->Graphics->DrawImage( myImage, rect2, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr ); }
private void SetNoOpExample(PaintEventArgs e) { // Create an Image object from the file Camera.jpg. Image myImage = Image.FromFile("Camera.jpg"); // Create an ImageAttributes object, and set the gamma to 0.25. ImageAttributes imageAttr = new ImageAttributes(); imageAttr.SetGamma(0.25F); // Draw the image with gamma set to 0.25. Rectangle rect1 = new Rectangle(20, 20, 200, 200); e.get_Graphics().DrawImage(myImage, rect1, 0, 0, 200, 200, GraphicsUnit.Pixel, imageAttr); // Call the ImageAttributes NoOp method. imageAttr.SetNoOp(); // Draw the image after NoOp is set, so the default gamma value // of 1.0 will be used. Rectangle rect2 = new Rectangle(250, 20, 200, 200); e.get_Graphics().DrawImage(myImage, rect2, 0, 0, 200, 200, GraphicsUnit.Pixel, imageAttr); } //SetNoOpExample

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.SetNoOp メソッド (ColorAdjustType)
アセンブリ: System.Drawing (system.drawing.dll 内)

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

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


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.SetNoOp メソッド
- ImageAttributes.SetNoOpのページへのリンク