ImageAttributes.SetOutputChannel Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Define o canal de saída CMYK (ciano-magenta-amarelo-preto).
Sobrecargas
| Name | Description |
|---|---|
| SetOutputChannel(ColorChannelFlag) |
Define o canal de saída CMYK (ciano-magenta-amarelo-preto) para a categoria padrão. |
| SetOutputChannel(ColorChannelFlag, ColorAdjustType) |
Define o canal de saída CMYK (ciano-magenta-amarelo-preto) para uma categoria especificada. |
SetOutputChannel(ColorChannelFlag)
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
Define o canal de saída CMYK (ciano-magenta-amarelo-preto) para a categoria padrão.
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
Um elemento de ColorChannelFlag isso especifica o canal de saída.
Exemplos
O exemplo de código seguinte demonstra como usar o SetOutputChannel método. Para executar este exemplo, cole o código seguinte num Windows Form. Tratar do evento e Paintda ShowOutputChannels chamada do formulário, passando 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
Observações
Pode usar o SetOutputChannel método para converter uma imagem num espaço de cor CMYK e examinar as intensidades de um dos canais de cor CMYK. Por exemplo, suponha que cria um ImageAttributes objeto e define o seu canal de saída bitmap para ColorChannelC. Se passar o caminho desse ImageAttributes objeto para o DrawImage método, o componente ciano de cada píxel é calculado, e cada píxel na imagem renderizada tem um tom de cinzento que indica a intensidade do seu canal ciano. De forma semelhante, pode renderizar imagens que indicam as intensidades dos canais magenta, amarelo e preto.
Um ImageAttributes objeto mantém definições de cor e tons de cinzento para cinco categorias de ajuste: padrão, bitmap, pincel, caneta e texto. Por exemplo, pode especificar um canal de saída para a categoria padrão e um canal de saída diferente para a categoria bitmap.
As definições padrão de ajuste de cor e de escala de cinzentos aplicam-se a todas as categorias que não tenham definições próprias de ajuste. Por exemplo, se nunca especificar quaisquer definições de ajuste para a categoria bitmap, as definições padrão aplicam-se à categoria bitmap.
Aplica-se a
SetOutputChannel(ColorChannelFlag, ColorAdjustType)
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
- Origem:
- ImageAttributes.cs
Define o canal de saída CMYK (ciano-magenta-amarelo-preto) para uma categoria 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
Um elemento de ColorChannelFlag isso especifica o canal de saída.
- type
- ColorAdjustType
Um elemento de ColorAdjustType isso especifica a categoria para a qual o canal de saída está definido.
Exemplos
O exemplo de código seguinte demonstra como usar o SetOutputChannel método. Para executar este exemplo, cole o código seguinte num Windows Form. Tratar do evento e Paintda ShowOutputChannels chamada do formulário, passando 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
Observações
Pode usar o SetOutputChannel método para converter uma imagem num espaço de cor CMYK e examinar as intensidades de um dos canais de cor CMYK. Por exemplo, suponha que cria um ImageAttributes objeto e define o seu canal de saída bitmap para ColorChannelC. Se passar o caminho desse ImageAttributes objeto para o DrawImage método, o componente ciano de cada píxel é calculado, e cada píxel na imagem renderizada tem um tom de cinzento que indica a intensidade do seu canal ciano. De forma semelhante, pode renderizar imagens que indicam as intensidades dos canais magenta, amarelo e preto.
Um ImageAttributes objeto mantém definições de cor e tons de cinzento para cinco categorias de ajuste: padrão, bitmap, pincel, caneta e texto. Por exemplo, pode especificar um canal de saída para a categoria padrão e um canal de saída diferente para a categoria bitmap.
As definições padrão de ajuste de cor e de escala de cinzentos aplicam-se a todas as categorias que não tenham definições próprias de ajuste. Por exemplo, se nunca especificar quaisquer definições de ajuste para a categoria bitmap, as definições padrão aplicam-se à categoria bitmap.
Assim que especificas uma definição de ajuste de cor ou de escala de cinzentos para uma determinada categoria, as definições de ajuste padrão deixam de se aplicar a essa categoria. Por exemplo, suponha que especifica uma coleção de definições de ajuste para a categoria padrão. Se definires o canal de saída para a categoria bitmap passando Bitmap para o SetOutputChannel método, nenhuma das definições de ajuste padrão se aplicará aos bitmaps.