ImageAttributes.SetOutputChannel メソッド (ColorChannelFlag, ColorAdjustType)
アセンブリ: System.Drawing (system.drawing.dll 内)

Dim instance As ImageAttributes Dim flags As ColorChannelFlag Dim type As ColorAdjustType instance.SetOutputChannel(flags, type)
戻り値
このメソッドは値を返しません。

SetOutputChannel メソッドを使用して、イメージを CMYK カラー領域に変換し、CMYK カラー チャネルの 1 つの輝度を調べることができます。たとえば、ImageAttributes オブジェクトを作成し、ビットマップの出力チャネルを ColorChannelC に設定したとします。ImageAttributes オブジェクトのパスを DrawImage メソッドに渡した場合、ピクセルごとに水色の要素が計算され、イメージの各ピクセルは水色チャネルの輝度を示す灰色の網かけで表現されます。同様に、マゼンダ、黄、黒の輝度を示すイメージを表示できます。
ImageAttributes オブジェクトは、5 つの調整カテゴリ (既定、ビットマップ、ブラシ、ペン、テキスト) に関して色とグレースケールの設定を保持します。たとえば、既定のカテゴリにある出力チャネルを指定し、ビットマップ カテゴリには別の出力チャネルを指定できます。
既定のカラー調整設定値およびグレースケール調整設定値は、調整設定値が設定されていないすべてのカテゴリに対して適用されます。たとえば、ビットマップ カテゴリの調整設定を一切指定していない場合、ビットマップ カテゴリには既定の設定が適用されます。
特定のカテゴリに対してカラー調整設定値またはグレースケール調整設定値を指定すると、そのカテゴリに適用されていた既定の調整設定値は解除されます。たとえば、既定のカテゴリに対して調整設定値のコレクションを指定するとします。Bitmap をSetOutputChannel メソッドに渡してビットマップ カテゴリの出力チャネルを設定すると、ビットマップには既定の調整設定は一切適用されません。

SetOutputChannel メソッドを使用する方法を次のコード例に示します。この例を実行するには、次のコードを Windows フォームに貼り付けます。フォームの Paint イベントを処理し、ShowOutputChannels を呼び出し、e を PaintEventArgs 値として渡します。
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
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(); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ImageAttributes.SetOutputChannel メソッド (ColorChannelFlag)
アセンブリ: System.Drawing (system.drawing.dll 内)

戻り値
このメソッドは値を返しません。

SetOutputChannel メソッドを使用して、イメージを CMYK カラー領域に変換し、CMYK カラー チャネルの 1 つの輝度を調べることができます。たとえば、ImageAttributes オブジェクトを作成し、ビットマップの出力チャネルを ColorChannelC に設定したとします。ImageAttributes オブジェクトのパスを DrawImage メソッドに渡した場合、ピクセルごとに水色の要素が計算され、イメージの各ピクセルは水色チャネルの輝度を示す灰色の網かけで表現されます。同様に、マゼンダ、黄、黒の輝度を示すイメージを表示できます。
ImageAttributes オブジェクトは、5 つの調整カテゴリ (既定、ビットマップ、ブラシ、ペン、テキスト) に関して色とグレースケールの設定を保持します。たとえば、既定のカテゴリにある出力チャネルを指定し、ビットマップ カテゴリには別の出力チャネルを指定できます。
既定のカラー調整設定値およびグレースケール調整設定値は、調整設定値が設定されていないすべてのカテゴリに対して適用されます。たとえば、ビットマップ カテゴリの調整設定を一切指定していない場合、ビットマップ カテゴリには既定の設定が適用されます。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ImageAttributes.SetOutputChannel メソッド
- ImageAttributes.SetOutputChannel メソッドのページへのリンク