語言

ImageAttributes.SetNoOp 方法

定義

關閉色彩調整。

多載

名稱 Description
SetNoOp()

關閉預設類別的色彩調整。 你可以呼叫該 ClearNoOp 方法,恢復呼叫前 SetNoOp 設定的色彩調整。

SetNoOp(ColorAdjustType)

關閉指定類別的色彩調整。 你可以呼叫該 ClearNoOp 方法,恢復呼叫前 SetNoOp 設定的色彩調整。

SetNoOp()

來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs

關閉預設類別的色彩調整。 你可以呼叫該 ClearNoOp 方法,恢復呼叫前 SetNoOp 設定的色彩調整。

public:
 void SetNoOp();
public void SetNoOp();
member this.SetNoOp : unit -> unit
Public Sub SetNoOp ()

範例

以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:

  1. 開啟 Image 並使用檔案 Camera.jpg。

  2. 將物件的 ImageAttributes 伽瑪值設為 0.25。

  3. 將影像繪製到畫面。

  4. 呼叫 SetNoOp 方法。

  5. 將影像(第二台攝影機)繪製到螢幕上;然而,由於 SetNoOp 方法被呼叫,gamma 設定預設為 1.0,影像會以預設 gamma 設定繪製到螢幕上。

請注意,左邊的影像非常洗白(伽瑪值 0.25),而右側的圖片對比度較高(伽瑪值 1.0)。

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.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);    
}
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

備註

物件 ImageAttributes 會維持五個調整類別的色彩與灰階設定:預設、點陣圖、筆刷、筆觸和文字。 例如,你可以為預設類別指定 gamma 值,為點陣分類指定不同的 gamma 值,筆型類別則有不同的 gamma 值。

默認色彩調整和灰階調整設定適用於沒有自己調整設定的所有類別。 例如,如果您從未指定畫筆類別的任何調整設定,則預設設定會套用至畫筆類別。

適用於

SetNoOp(ColorAdjustType)

來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs
來源:
ImageAttributes.cs

關閉指定類別的色彩調整。 你可以呼叫該 ClearNoOp 方法,恢復呼叫前 SetNoOp 設定的色彩調整。

public:
 void SetNoOp(System::Drawing::Imaging::ColorAdjustType type);
public void SetNoOp(System.Drawing.Imaging.ColorAdjustType type);
member this.SetNoOp : System.Drawing.Imaging.ColorAdjustType -> unit
Public Sub SetNoOp (type As ColorAdjustType)

參數

type
ColorAdjustType

其中一個元素 ColorAdjustType 指定了關閉色彩校正的類別。

範例

程式碼範例請參見該 SetNoOp() 方法。

備註

物件 ImageAttributes 會維持五個調整類別的色彩與灰階設定:預設、點陣圖、筆刷、筆觸和文字。 例如,你可以為預設類別指定 gamma 值,為點陣分類指定不同的 gamma 值,筆型類別則有不同的 gamma 值。

適用於