ImageAttributes.SetOutputChannel Metoda

Definice

Nastaví výstupní kanál CMYK (azurově purpurová-žlutá-černá).

Přetížení

Name Description
SetOutputChannel(ColorChannelFlag)

Nastaví výstupní kanál CMYK (azurově purpurová-žlutá-černá) pro výchozí kategorii.

SetOutputChannel(ColorChannelFlag, ColorAdjustType)

Nastaví výstupní kanál CMYK (azurově purpurová-žlutá-černá) pro zadanou kategorii.

SetOutputChannel(ColorChannelFlag)

Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs

Nastaví výstupní kanál CMYK (azurově purpurová-žlutá-černá) pro výchozí kategorii.

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)

Parametry

flags
ColorChannelFlag

Prvek ColorChannelFlag , který určuje výstupní kanál.

Příklady

Následující příklad kódu ukazuje, jak použít metodu SetOutputChannel . Pokud chcete tento příklad spustit, vložte následující kód do formuláře Windows. Zpracování události a volání Paintformuláře ShowOutputChannels , předání e jako 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

Poznámky

Pomocí metody můžete SetOutputChannel převést obrázek na barevný prostor CMYK a prozkoumat intenzity jednoho z barevných kanálů CMYK. Předpokládejme například, že vytvoříte ImageAttributes objekt a nastavíte jeho rastrový výstupní kanál na ColorChannelC. Pokud předáte cestu tohoto ImageAttributes objektu DrawImage metodě, vypočítá se azurová komponenta každého pixelu a každý pixel v vykresleném obrázku je odstín šedé, který označuje intenzitu jeho azurového kanálu. Podobně můžete vykreslit obrázky, které označují intenzity purpurových, žlutých a černých kanálů.

Objekt ImageAttributes udržuje nastavení barev a stupně šedé pro pět kategorií úprav: výchozí, rastrový obrázek, štětec, pero a text. Můžete například zadat výstupní kanál pro výchozí kategorii a jiný výstupní kanál pro kategorii rastrového obrázku.

Výchozí nastavení úprav barev a úprav ve stupních šedé platí pro všechny kategorie, které nemají vlastní nastavení úprav. Pokud například nikdy nezadáte žádné nastavení úprav pro kategorii rastrového obrázku, použije se výchozí nastavení pro kategorii rastrového obrázku.

Platí pro

SetOutputChannel(ColorChannelFlag, ColorAdjustType)

Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs
Zdroj:
ImageAttributes.cs

Nastaví výstupní kanál CMYK (azurově purpurová-žlutá-černá) pro zadanou kategorii.

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)

Parametry

flags
ColorChannelFlag

Prvek ColorChannelFlag , který určuje výstupní kanál.

type
ColorAdjustType

Prvek ColorAdjustType , který určuje kategorii, pro kterou je výstupní kanál nastaven.

Příklady

Následující příklad kódu ukazuje, jak použít metodu SetOutputChannel . Pokud chcete tento příklad spustit, vložte následující kód do formuláře Windows. Zpracování události a volání Paintformuláře ShowOutputChannels , předání e jako 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

Poznámky

Pomocí metody můžete SetOutputChannel převést obrázek na barevný prostor CMYK a prozkoumat intenzity jednoho z barevných kanálů CMYK. Předpokládejme například, že vytvoříte ImageAttributes objekt a nastavíte jeho rastrový výstupní kanál na ColorChannelC. Pokud předáte cestu tohoto ImageAttributes objektu DrawImage metodě, vypočítá se azurová komponenta každého pixelu a každý pixel v vykresleném obrázku je odstín šedé, který označuje intenzitu jeho azurového kanálu. Podobně můžete vykreslit obrázky, které označují intenzity purpurových, žlutých a černých kanálů.

Objekt ImageAttributes udržuje nastavení barev a stupně šedé pro pět kategorií úprav: výchozí, rastrový obrázek, štětec, pero a text. Můžete například zadat výstupní kanál pro výchozí kategorii a jiný výstupní kanál pro kategorii rastrového obrázku.

Výchozí nastavení úprav barev a úprav ve stupních šedé platí pro všechny kategorie, které nemají vlastní nastavení úprav. Pokud například nikdy nezadáte žádné nastavení úprav pro kategorii rastrového obrázku, použije se výchozí nastavení pro kategorii rastrového obrázku.

Jakmile pro určitou kategorii zadáte nastavení úprav barev nebo úprav ve stupních šedé, výchozí nastavení úprav se už na tuto kategorii nevztahuje. Předpokládejme například, že zadáte kolekci nastavení úprav pro výchozí kategorii. Pokud nastavíte výstupní kanál pro kategorii rastrového obrázku Bitmap předáním SetOutputChannel metodě, žádná z výchozích nastavení úprav se nepoužije na rastrové obrázky.

Platí pro