ImageAttributes.SetOutputChannel Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Imposta il canale di output CMYK (ciano-magenta-giallo-nero).
Overload
| Nome | Descrizione |
|---|---|
| SetOutputChannel(ColorChannelFlag) |
Imposta il canale di output CMYK (cyan-magenta-yellow-black) per la categoria predefinita. |
| SetOutputChannel(ColorChannelFlag, ColorAdjustType) |
Imposta il canale di output CMYK (ciano-magenta-giallo-nero) per una categoria specificata. |
SetOutputChannel(ColorChannelFlag)
Imposta il canale di output CMYK (cyan-magenta-yellow-black) per la categoria predefinita.
public:
void SetOutputChannel(System::Drawing::Imaging::ColorChannelFlag flags);
public void SetOutputChannel(System.Drawing.Imaging.ColorChannelFlag flags);
member this.SetOutputChannel : System.Drawing.Imaging.ColorChannelFlag -> unit
Public Sub SetOutputChannel (flags As ColorChannelFlag)
Parametri
- flags
- ColorChannelFlag
Elemento di che specifica il canale di ColorChannelFlag output.
Esempio
Nell'esempio di codice seguente viene illustrato come usare il SetOutputChannel metodo . Per eseguire questo esempio, incollare il codice seguente in un modulo Windows. Gestire l'evento del Paint modulo e chiamare ShowOutputChannels, passando e come PaintEventArgs.
private void ShowOutputChannels(PaintEventArgs e)
{
//Create a bitmap from a file.
Bitmap bmp1 = new Bitmap("c:\\fakePhoto.jpg");
// Create a new bitmap from the original, resizing it for this example.
Bitmap bmp2 = new Bitmap(bmp1, new Size(80, 80));
bmp1.Dispose();
// Create an ImageAttributes object.
ImageAttributes imgAttributes = new ImageAttributes();
// Draw the image unaltered.
e.Graphics.DrawImage(bmp2, 10, 10);
// Draw the image, showing the intensity of the cyan channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelC,
System.Drawing.Imaging.ColorAdjustType.Bitmap);
e.Graphics.DrawImage(bmp2, new Rectangle(100, 10, bmp2.Width, bmp2.Height),
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes);
// Draw the image, showing the intensity of the magenta channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelM,
ColorAdjustType.Bitmap);
e.Graphics.DrawImage(bmp2, new Rectangle(10, 100, bmp2.Width, bmp2.Height),
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes);
// Draw the image, showing the intensity of the yellow channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelY,
ColorAdjustType.Bitmap);
e.Graphics.DrawImage(bmp2, new Rectangle(100, 100, bmp2.Width, bmp2.Height), 0, 0,
bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes);
// Draw the image, showing the intensity of the black channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelK,
System.Drawing.Imaging.ColorAdjustType.Bitmap);
e.Graphics.DrawImage(bmp2, new Rectangle(10, 190, bmp2.Width, bmp2.Height),
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes);
//Dispose of the bitmap.
bmp2.Dispose();
}
Private Sub ShowOutputChannels(ByVal e As PaintEventArgs)
'Create a bitmap from a file.
Dim bmp1 As New Bitmap("c:\fakePhoto.jpg")
' Create a new bitmap from the original, resizing it for this example.
Dim bmp2 As New Bitmap(bmp1, New Size(80, 80))
bmp1.Dispose()
' Create an ImageAttributes object.
Dim imgAttributes As New System.Drawing.Imaging.ImageAttributes()
' Draw the image unaltered.
e.Graphics.DrawImage(bmp2, 10, 10)
' Draw the image, showing the intensity of the cyan channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelC, ColorAdjustType.Bitmap)
e.Graphics.DrawImage(bmp2, New Rectangle(100, 10, bmp2.Width, bmp2.Height), _
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes)
' Draw the image, showing the intensity of the magenta channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelM, ColorAdjustType.Bitmap)
e.Graphics.DrawImage(bmp2, New Rectangle(10, 100, bmp2.Width, bmp2.Height), _
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes)
' Draw the image, showing the intensity of the yellow channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelY, _
ColorAdjustType.Bitmap)
e.Graphics.DrawImage(bmp2, New Rectangle(100, 100, bmp2.Width, bmp2.Height), _
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes)
' Draw the image, showing the intensity of the black channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelK, _
ColorAdjustType.Bitmap)
e.Graphics.DrawImage(bmp2, New Rectangle(10, 190, bmp2.Width, bmp2.Height), _
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes)
'Dispose of the bitmap.
bmp2.Dispose()
End Sub
Commenti
È possibile usare il SetOutputChannel metodo per convertire un'immagine in uno spazio colori CMYK ed esaminare le intensità di uno dei canali di colore CMYK. Si supponga, ad esempio, di creare un ImageAttributes oggetto e di impostarne il canale di output bitmap su ColorChannelC. Se passi il percorso dell'oggetto ImageAttributes al metodo, viene calcolato il componente ciano di ogni pixel e ogni pixel nell'immagine sottoposta a DrawImage rendering è una sfumatura di grigio che indica l'intensità del canale ciano. Analogamente, è possibile eseguire il rendering di immagini che indicano le intensità dei canali magenta, giallo e nero.
Un ImageAttributes oggetto mantiene le impostazioni di colore e gradazioni di grigio per cinque categorie di regolazione: default, bitmap, brush, pen e text. Ad esempio, è possibile specificare un canale di output per la categoria predefinita e un canale di output diverso per la categoria bitmap.
Le impostazioni predefinite per la regolazione del colore e la regolazione della scala di grigi si applicano a tutte le categorie che non dispongono di impostazioni di regolazione personalizzate. Ad esempio, se non si specificano mai impostazioni di regolazione per la categoria bitmap, le impostazioni predefinite si applicano alla categoria bitmap.
Si applica a
SetOutputChannel(ColorChannelFlag, ColorAdjustType)
Imposta il canale di output CMYK (ciano-magenta-giallo-nero) per una categoria specificata.
public:
void SetOutputChannel(System::Drawing::Imaging::ColorChannelFlag flags, System::Drawing::Imaging::ColorAdjustType type);
public void SetOutputChannel(System.Drawing.Imaging.ColorChannelFlag flags, System.Drawing.Imaging.ColorAdjustType type);
member this.SetOutputChannel : System.Drawing.Imaging.ColorChannelFlag * System.Drawing.Imaging.ColorAdjustType -> unit
Public Sub SetOutputChannel (flags As ColorChannelFlag, type As ColorAdjustType)
Parametri
- flags
- ColorChannelFlag
Elemento di che specifica il canale di ColorChannelFlag output.
- type
- ColorAdjustType
Elemento di che specifica la categoria per cui è impostato il canale di ColorAdjustType output.
Esempio
Nell'esempio di codice seguente viene illustrato come usare il SetOutputChannel metodo . Per eseguire questo esempio, incollare il codice seguente in un modulo Windows. Gestire l'evento del Paint modulo e chiamare ShowOutputChannels, passando e come PaintEventArgs.
private void ShowOutputChannels(PaintEventArgs e)
{
//Create a bitmap from a file.
Bitmap bmp1 = new Bitmap("c:\\fakePhoto.jpg");
// Create a new bitmap from the original, resizing it for this example.
Bitmap bmp2 = new Bitmap(bmp1, new Size(80, 80));
bmp1.Dispose();
// Create an ImageAttributes object.
ImageAttributes imgAttributes = new ImageAttributes();
// Draw the image unaltered.
e.Graphics.DrawImage(bmp2, 10, 10);
// Draw the image, showing the intensity of the cyan channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelC,
System.Drawing.Imaging.ColorAdjustType.Bitmap);
e.Graphics.DrawImage(bmp2, new Rectangle(100, 10, bmp2.Width, bmp2.Height),
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes);
// Draw the image, showing the intensity of the magenta channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelM,
ColorAdjustType.Bitmap);
e.Graphics.DrawImage(bmp2, new Rectangle(10, 100, bmp2.Width, bmp2.Height),
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes);
// Draw the image, showing the intensity of the yellow channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelY,
ColorAdjustType.Bitmap);
e.Graphics.DrawImage(bmp2, new Rectangle(100, 100, bmp2.Width, bmp2.Height), 0, 0,
bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes);
// Draw the image, showing the intensity of the black channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelK,
System.Drawing.Imaging.ColorAdjustType.Bitmap);
e.Graphics.DrawImage(bmp2, new Rectangle(10, 190, bmp2.Width, bmp2.Height),
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes);
//Dispose of the bitmap.
bmp2.Dispose();
}
Private Sub ShowOutputChannels(ByVal e As PaintEventArgs)
'Create a bitmap from a file.
Dim bmp1 As New Bitmap("c:\fakePhoto.jpg")
' Create a new bitmap from the original, resizing it for this example.
Dim bmp2 As New Bitmap(bmp1, New Size(80, 80))
bmp1.Dispose()
' Create an ImageAttributes object.
Dim imgAttributes As New System.Drawing.Imaging.ImageAttributes()
' Draw the image unaltered.
e.Graphics.DrawImage(bmp2, 10, 10)
' Draw the image, showing the intensity of the cyan channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelC, ColorAdjustType.Bitmap)
e.Graphics.DrawImage(bmp2, New Rectangle(100, 10, bmp2.Width, bmp2.Height), _
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes)
' Draw the image, showing the intensity of the magenta channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelM, ColorAdjustType.Bitmap)
e.Graphics.DrawImage(bmp2, New Rectangle(10, 100, bmp2.Width, bmp2.Height), _
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes)
' Draw the image, showing the intensity of the yellow channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelY, _
ColorAdjustType.Bitmap)
e.Graphics.DrawImage(bmp2, New Rectangle(100, 100, bmp2.Width, bmp2.Height), _
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes)
' Draw the image, showing the intensity of the black channel.
imgAttributes.SetOutputChannel(ColorChannelFlag.ColorChannelK, _
ColorAdjustType.Bitmap)
e.Graphics.DrawImage(bmp2, New Rectangle(10, 190, bmp2.Width, bmp2.Height), _
0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel, imgAttributes)
'Dispose of the bitmap.
bmp2.Dispose()
End Sub
Commenti
È possibile usare il SetOutputChannel metodo per convertire un'immagine in uno spazio colori CMYK ed esaminare le intensità di uno dei canali di colore CMYK. Si supponga, ad esempio, di creare un ImageAttributes oggetto e di impostarne il canale di output bitmap su ColorChannelC. Se passi il percorso dell'oggetto ImageAttributes al metodo, viene calcolato il componente ciano di ogni pixel e ogni pixel nell'immagine sottoposta a DrawImage rendering è una sfumatura di grigio che indica l'intensità del canale ciano. Analogamente, è possibile eseguire il rendering di immagini che indicano le intensità dei canali magenta, giallo e nero.
Un ImageAttributes oggetto mantiene le impostazioni di colore e gradazioni di grigio per cinque categorie di regolazione: default, bitmap, brush, pen e text. Ad esempio, è possibile specificare un canale di output per la categoria predefinita e un canale di output diverso per la categoria bitmap.
Le impostazioni predefinite per la regolazione del colore e la regolazione della scala di grigi si applicano a tutte le categorie che non dispongono di impostazioni di regolazione personalizzate. Ad esempio, se non si specificano mai impostazioni di regolazione per la categoria bitmap, le impostazioni predefinite si applicano alla categoria bitmap.
Non appena si specifica un'impostazione di regolazione del colore o di regolazione della scala di grigi per una determinata categoria, le impostazioni di regolazione predefinite non si applicano più a tale categoria. Si supponga, ad esempio, di specificare una raccolta di impostazioni di regolazione per la categoria predefinita. Se si imposta il canale di output per la categoria bitmap passando Bitmap al SetOutputChannel metodo , nessuna delle impostazioni di regolazione predefinite verrà applicata alle bitmap.