Share via


ImageAttributes.SetOutputChannel Método

Definición

Establece el canal de salida CMYK (aguamarina-fucsia-amarillo-negro).

Sobrecargas

SetOutputChannel(ColorChannelFlag)

Establece la configuración del canal de salida CMYK (aguamarina-fucsia-amarillo-negro) para la categoría predeterminada.

SetOutputChannel(ColorChannelFlag, ColorAdjustType)

Establece el canal de salida CMYK (aguamarina-fucsia-amarillo-negro) para la categoría especificada.

SetOutputChannel(ColorChannelFlag)

Source:
ImageAttributes.cs
Source:
ImageAttributes.cs
Source:
ImageAttributes.cs

Establece la configuración del canal de salida CMYK (aguamarina-fucsia-amarillo-negro) para la categoría predeterminada.

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)

Parámetros

flags
ColorChannelFlag

Elemento de ColorChannelFlag que especifica el canal de salida.

Ejemplos

En el ejemplo de código siguiente se muestra cómo utilizar el método SetOutputChannel. Para ejecutar este ejemplo, pegue el código siguiente en un formulario Windows Forms. Controle el evento del Paint formulario y llame a ShowOutputChannels, pasando e como 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

Comentarios

Puede usar el SetOutputChannel método para convertir una imagen en un espacio de colores CMYK y examinar las densidades de uno de los canales de color CMYK. Por ejemplo, supongamos que crea un ImageAttributes objeto y establece su canal ColorChannelCde salida de mapa de bits en . Si pasa la ruta de acceso de ese ImageAttributes objeto al DrawImage método , se calcula el componente cian de cada píxel y cada píxel de la imagen representada es un tono de gris que indica la intensidad de su canal cian. De forma similar, puedes representar imágenes que indiquen las intensidades de los canales magenta, amarillo y negro.

Un ImageAttributes objeto mantiene la configuración de color y escala de grises para cinco categorías de ajuste: predeterminado, mapa de bits, pincel, lápiz y texto. Por ejemplo, puede especificar un canal de salida para la categoría predeterminada y otro canal de salida para la categoría de mapa de bits.

La configuración predeterminada de ajuste de color y ajuste de escala de grises se aplica a todas las categorías que no tienen ajustes de ajuste propios. Por ejemplo, si nunca especifica ninguna configuración de ajuste para la categoría de mapa de bits, la configuración predeterminada se aplica a la categoría de mapa de bits.

Se aplica a

SetOutputChannel(ColorChannelFlag, ColorAdjustType)

Source:
ImageAttributes.cs
Source:
ImageAttributes.cs
Source:
ImageAttributes.cs

Establece el canal de salida CMYK (aguamarina-fucsia-amarillo-negro) para la categoría especificada.

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)

Parámetros

flags
ColorChannelFlag

Elemento de ColorChannelFlag que especifica el canal de salida.

type
ColorAdjustType

Elemento de ColorAdjustType que especifica la categoría cuyo canal de salida se establece.

Ejemplos

En el ejemplo de código siguiente se muestra cómo utilizar el método SetOutputChannel. Para ejecutar este ejemplo, pegue el código siguiente en un formulario Windows Forms. Controle el evento del Paint formulario y llame a ShowOutputChannels, pasando e como 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

Comentarios

Puede usar el SetOutputChannel método para convertir una imagen en un espacio de colores CMYK y examinar las densidades de uno de los canales de color CMYK. Por ejemplo, supongamos que crea un ImageAttributes objeto y establece su canal ColorChannelCde salida de mapa de bits en . Si pasa la ruta de acceso de ese ImageAttributes objeto al DrawImage método , se calcula el componente cian de cada píxel y cada píxel de la imagen representada es un tono de gris que indica la intensidad de su canal cian. De forma similar, puedes representar imágenes que indiquen las intensidades de los canales magenta, amarillo y negro.

Un ImageAttributes objeto mantiene la configuración de color y escala de grises para cinco categorías de ajuste: predeterminado, mapa de bits, pincel, lápiz y texto. Por ejemplo, puede especificar un canal de salida para la categoría predeterminada y otro canal de salida para la categoría de mapa de bits.

La configuración predeterminada de ajuste de color y ajuste de escala de grises se aplica a todas las categorías que no tienen ajustes de ajuste propios. Por ejemplo, si nunca especifica ninguna configuración de ajuste para la categoría de mapa de bits, la configuración predeterminada se aplica a la categoría de mapa de bits.

En cuanto especifique un ajuste de color o ajuste de escala de grises para una categoría determinada, la configuración de ajuste predeterminada ya no se aplica a esa categoría. Por ejemplo, supongamos que especifica una colección de opciones de ajuste para la categoría predeterminada. Si establece el canal de salida para la categoría de mapa de bits pasando Bitmap al SetOutputChannel método , ninguna de las opciones de ajuste predeterminadas se aplicará a los mapas de bits.

Se aplica a