ImageAttributes.SetOutputChannel Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Anger CMYK-utdatakanalen (cyan-magenta-yellow-black).
Överlagringar
| Name | Description |
|---|---|
| SetOutputChannel(ColorChannelFlag) |
Anger CMYK-utdatakanalen (cyan-magenta-yellow-black) för standardkategorin. |
| SetOutputChannel(ColorChannelFlag, ColorAdjustType) |
Anger CMYK-utdatakanalen (cyan-magenta-yellow-black) för en angiven kategori. |
SetOutputChannel(ColorChannelFlag)
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
Anger CMYK-utdatakanalen (cyan-magenta-yellow-black) för standardkategorin.
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)
Parametrar
- flags
- ColorChannelFlag
Ett element i ColorChannelFlag som anger utdatakanalen.
Exempel
I följande kodexempel visas hur du använder SetOutputChannel metoden. Om du vill köra det här exemplet klistrar du in följande kod i ett Windows formulär. Hantera formulärets Paint händelse och anropa ShowOutputChannels, skicka e som 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
Kommentarer
Du kan använda SetOutputChannel metoden för att konvertera en bild till ett CMYK-färgutrymme och undersöka intensiteterna i en av CMYK-färgkanalerna. Anta till exempel att du skapar ett ImageAttributes objekt och anger dess bitmappsutdatakanal till ColorChannelC. Om du skickar objektets ImageAttributes sökväg till DrawImage metoden beräknas cyankomponenten för varje pixel och varje bildpunkt i den renderade bilden är en grå nyans som anger intensiteten i dess cyankanal. På samma sätt kan du återge bilder som anger intensiteten i magenta-, gula och svarta kanaler.
Ett ImageAttributes objekt har färg- och gråskaleinställningar för fem justeringskategorier: standard, bitmapp, pensel, penna och text. Du kan till exempel ange en utdatakanal för standardkategorin och en annan utdatakanal för bitmappskategorin.
Standardinställningarna för färgjustering och gråskalejustering gäller för alla kategorier som inte har egna justeringsinställningar. Om du till exempel aldrig anger några justeringsinställningar för bitmappskategorin gäller standardinställningarna för bitmappskategorin.
Gäller för
SetOutputChannel(ColorChannelFlag, ColorAdjustType)
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
- Källa:
- ImageAttributes.cs
Anger CMYK-utdatakanalen (cyan-magenta-yellow-black) för en angiven kategori.
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)
Parametrar
- flags
- ColorChannelFlag
Ett element i ColorChannelFlag som anger utdatakanalen.
- type
- ColorAdjustType
Ett element i ColorAdjustType som anger den kategori som utdatakanalen har angetts för.
Exempel
I följande kodexempel visas hur du använder SetOutputChannel metoden. Om du vill köra det här exemplet klistrar du in följande kod i ett Windows formulär. Hantera formulärets Paint händelse och anropa ShowOutputChannels, skicka e som 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
Kommentarer
Du kan använda SetOutputChannel metoden för att konvertera en bild till ett CMYK-färgutrymme och undersöka intensiteterna i en av CMYK-färgkanalerna. Anta till exempel att du skapar ett ImageAttributes objekt och anger dess bitmappsutdatakanal till ColorChannelC. Om du skickar objektets ImageAttributes sökväg till DrawImage metoden beräknas cyankomponenten för varje pixel och varje bildpunkt i den renderade bilden är en grå nyans som anger intensiteten i dess cyankanal. På samma sätt kan du återge bilder som anger intensiteten i magenta-, gula och svarta kanaler.
Ett ImageAttributes objekt har färg- och gråskaleinställningar för fem justeringskategorier: standard, bitmapp, pensel, penna och text. Du kan till exempel ange en utdatakanal för standardkategorin och en annan utdatakanal för bitmappskategorin.
Standardinställningarna för färgjustering och gråskalejustering gäller för alla kategorier som inte har egna justeringsinställningar. Om du till exempel aldrig anger några justeringsinställningar för bitmappskategorin gäller standardinställningarna för bitmappskategorin.
Så snart du anger en inställning för färgjustering eller gråskalejustering för en viss kategori gäller standardjusteringsinställningarna inte längre för den kategorin. Anta till exempel att du anger en samling justeringsinställningar för standardkategorin. Om du anger utdatakanalen för bitmappskategorin genom att skicka Bitmap till SetOutputChannel metoden gäller ingen av standardjusteringsinställningarna för bitmappar.