ImageAttributes.SetNoOp 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
關閉色彩調整。
多載
SetNoOp() |
關閉預設分類的彩色調整。 您可以呼叫 ClearNoOp 方法,以重新啟用在呼叫 SetNoOp 方法之前既有的彩色調整設定。 |
SetNoOp(ColorAdjustType) |
關閉指定分類的彩色調整。 您可以呼叫 ClearNoOp 方法,以重新啟用在呼叫 SetNoOp 方法之前既有的彩色調整設定。 |
SetNoOp()
public:
void SetNoOp();
public void SetNoOp ();
member this.SetNoOp : unit -> unit
Public Sub SetNoOp ()
範例
下列程式代碼範例是設計來搭配 Windows Forms 使用,而且需要 PaintEventArgse
,這是事件處理程序的參數Paint。 此程式碼會執行下列動作:
Image開啟使用檔案 Camera.jpg 的 。
將物件的 gamma 值 ImageAttributes 設定為 0.25。
將影像繪製到畫面。
呼叫 SetNoOp 方法。
將影像 (第二個相機) 繪製到畫面;不過,由於 SetNoOp 呼叫 方法,gamma 設定預設為 1.0,而且影像會繪製到具有預設 gamma 設定的畫面。
請注意,左側影像非常 ( (gamma 為 0.25) ,而右邊的影像具有 1.0) 的對比 (gamma。
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)
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 值。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應