本文整理汇总了C#中System.Drawing.Imaging.ImageAttributes.SetOutputChannel方法的典型用法代码示例。如果您正苦于以下问题:C# ImageAttributes.SetOutputChannel方法的具体用法?C# ImageAttributes.SetOutputChannel怎么用?C# ImageAttributes.SetOutputChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Imaging.ImageAttributes
的用法示例。
在下文中一共展示了ImageAttributes.SetOutputChannel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowOutputChannels
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();
}