ImageAttributes.SetOutputChannel Methode

Definition

Legt den CMYK-Ausgabekanal (cyan-magenta-yellow-black) fest.

Überlädt

Name Beschreibung
SetOutputChannel(ColorChannelFlag)

Legt den CMYK-Ausgabekanal (cyan-magenta-yellow-black) für die Standardkategorie fest.

SetOutputChannel(ColorChannelFlag, ColorAdjustType)

Legt den CMYK-Ausgabekanal (cyan-magenta-yellow-black) für eine angegebene Kategorie fest.

SetOutputChannel(ColorChannelFlag)

Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs

Legt den CMYK-Ausgabekanal (cyan-magenta-yellow-black) für die Standardkategorie fest.

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)

Parameter

flags
ColorChannelFlag

Ein Element davon, das ColorChannelFlag den Ausgabekanal angibt.

Beispiele

Im folgenden Codebeispiel wird die Verwendung der SetOutputChannel Methode veranschaulicht. Zum Ausführen dieses Beispiels fügen Sie den folgenden Code in ein Windows Formular ein. Behandeln Sie das Ereignis und den Aufruf des FormularsPaint, und übergeben Sie es als ShowOutputChannelse .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

Hinweise

Mit der SetOutputChannel Methode können Sie ein Bild in einen CMYK-Farbraum konvertieren und die Intensitäten eines der CMYK-Farbkanäle untersuchen. Angenommen, Sie erstellen ein ImageAttributes Objekt und legen dessen Bitmapausgabekanal auf ColorChannelC. Wenn Sie den Pfad dieses ImageAttributes Objekts an die DrawImage Methode übergeben, wird die Cyan-Komponente jedes Pixels berechnet, und jedes Pixel im gerenderten Bild ist ein Grauschattierung, der die Intensität des Cyankanals angibt. Ebenso können Sie Bilder rendern, die die Intensitäten der Magenta-, Gelb- und Schwarzen Kanäle angeben.

Ein ImageAttributes Objekt verwaltet Farb- und Graustufeneinstellungen für fünf Anpassungskategorien: Standard, Bitmap, Pinsel, Stift und Text. Sie können z. B. einen Ausgabekanal für die Standardkategorie und einen anderen Ausgabekanal für die Bitmapkategorie angeben.

Die Standardeinstellungen für Farbanpassung und Graustufenanpassung gelten für alle Kategorien, die keine eigenen Anpassungseinstellungen aufweisen. Wenn Sie beispielsweise niemals Anpassungseinstellungen für die Bitmapkategorie angeben, gelten die Standardeinstellungen für die Bitmapkategorie.

Gilt für:

SetOutputChannel(ColorChannelFlag, ColorAdjustType)

Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs

Legt den CMYK-Ausgabekanal (cyan-magenta-yellow-black) für eine angegebene Kategorie fest.

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)

Parameter

flags
ColorChannelFlag

Ein Element davon, das ColorChannelFlag den Ausgabekanal angibt.

type
ColorAdjustType

Ein Element davon ColorAdjustType gibt die Kategorie an, für die der Ausgabekanal festgelegt ist.

Beispiele

Im folgenden Codebeispiel wird die Verwendung der SetOutputChannel Methode veranschaulicht. Zum Ausführen dieses Beispiels fügen Sie den folgenden Code in ein Windows Formular ein. Behandeln Sie das Ereignis und den Aufruf des FormularsPaint, und übergeben Sie es als ShowOutputChannelse .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

Hinweise

Mit der SetOutputChannel Methode können Sie ein Bild in einen CMYK-Farbraum konvertieren und die Intensitäten eines der CMYK-Farbkanäle untersuchen. Angenommen, Sie erstellen ein ImageAttributes Objekt und legen dessen Bitmapausgabekanal auf ColorChannelC. Wenn Sie den Pfad dieses ImageAttributes Objekts an die DrawImage Methode übergeben, wird die Cyan-Komponente jedes Pixels berechnet, und jedes Pixel im gerenderten Bild ist ein Grauschattierung, der die Intensität des Cyankanals angibt. Ebenso können Sie Bilder rendern, die die Intensitäten der Magenta-, Gelb- und Schwarzen Kanäle angeben.

Ein ImageAttributes Objekt verwaltet Farb- und Graustufeneinstellungen für fünf Anpassungskategorien: Standard, Bitmap, Pinsel, Stift und Text. Sie können z. B. einen Ausgabekanal für die Standardkategorie und einen anderen Ausgabekanal für die Bitmapkategorie angeben.

Die Standardeinstellungen für Farbanpassung und Graustufenanpassung gelten für alle Kategorien, die keine eigenen Anpassungseinstellungen aufweisen. Wenn Sie beispielsweise niemals Anpassungseinstellungen für die Bitmapkategorie angeben, gelten die Standardeinstellungen für die Bitmapkategorie.

Sobald Sie eine Farbanpassungs- oder Graustufenanpassungseinstellung für eine bestimmte Kategorie angeben, gelten die Standardeinstellungseinstellungen nicht mehr für diese Kategorie. Angenommen, Sie geben eine Sammlung von Anpassungseinstellungen für die Standardkategorie an. Wenn Sie den Ausgabekanal für die Bitmapkategorie durch Übergeben Bitmap an die SetOutputChannel Methode festlegen, gelten keine der Standardeinstellungen für Bitmaps.

Gilt für: