ImageAttributes.SetOutputChannel メソッド

定義

CMYK (シアン-マゼンタ-イエローブラック) 出力チャネルを設定します。

オーバーロード

名前 説明
SetOutputChannel(ColorChannelFlag)

既定のカテゴリの CMYK (シアンマゼンタ-イエローブラック) 出力チャネルを設定します。

SetOutputChannel(ColorChannelFlag, ColorAdjustType)

指定したカテゴリの CMYK (シアンマゼンタ-イエローブラック) 出力チャネルを設定します。

SetOutputChannel(ColorChannelFlag)

ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs

既定のカテゴリの CMYK (シアンマゼンタ-イエローブラック) 出力チャネルを設定します。

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)

パラメーター

flags
ColorChannelFlag

出力チャネルを指定する ColorChannelFlag の要素。

次のコード例は、 SetOutputChannel メソッドの使用方法を示しています。 この例を実行するには、次のコードを Windows フォームに貼り付けます。 フォームの Paint イベントを処理し、 ShowOutputChannelsを呼び出し、 ePaintEventArgsとして渡します。

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

注釈

SetOutputChannelメソッドを使用して、イメージを CMYK カラー空間に変換し、CMYK カラー チャネルの 1 つの強度を調べることができます。 たとえば、 ImageAttributes オブジェクトを作成し、そのビットマップ出力チャネルを ColorChannelC に設定するとします。 その ImageAttributes オブジェクトのパスを DrawImage メソッドに渡すと、各ピクセルのシアン成分が計算され、レンダリングされたイメージ内の各ピクセルは、シアンチャネルの強度を示す灰色の網掛けになります。 同様に、マゼンタ、黄色、黒のチャネルの強度を示すイメージをレンダリングできます。

ImageAttributes オブジェクトは、既定、ビットマップ、ブラシ、ペン、テキストの 5 つの調整カテゴリの色とグレースケールの設定を維持します。 たとえば、既定のカテゴリの出力チャネルと、ビットマップ カテゴリに別の出力チャネルを指定できます。

既定の色調整とグレースケール調整の設定は、独自の調整設定を持たないすべてのカテゴリに適用されます。 たとえば、ビットマップ カテゴリの調整設定を指定しない場合、既定の設定はビットマップ カテゴリに適用されます。

適用対象

SetOutputChannel(ColorChannelFlag, ColorAdjustType)

ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs

指定したカテゴリの CMYK (シアンマゼンタ-イエローブラック) 出力チャネルを設定します。

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)

パラメーター

flags
ColorChannelFlag

出力チャネルを指定する ColorChannelFlag の要素。

type
ColorAdjustType

出力チャネルを設定するカテゴリを指定する ColorAdjustType の要素。

次のコード例は、 SetOutputChannel メソッドの使用方法を示しています。 この例を実行するには、次のコードを Windows フォームに貼り付けます。 フォームの Paint イベントを処理し、 ShowOutputChannelsを呼び出し、 ePaintEventArgsとして渡します。

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

注釈

SetOutputChannelメソッドを使用して、イメージを CMYK カラー空間に変換し、CMYK カラー チャネルの 1 つの強度を調べることができます。 たとえば、 ImageAttributes オブジェクトを作成し、そのビットマップ出力チャネルを ColorChannelC に設定するとします。 その ImageAttributes オブジェクトのパスを DrawImage メソッドに渡すと、各ピクセルのシアン成分が計算され、レンダリングされたイメージ内の各ピクセルは、シアンチャネルの強度を示す灰色の網掛けになります。 同様に、マゼンタ、黄色、黒のチャネルの強度を示すイメージをレンダリングできます。

ImageAttributes オブジェクトは、既定、ビットマップ、ブラシ、ペン、テキストの 5 つの調整カテゴリの色とグレースケールの設定を維持します。 たとえば、既定のカテゴリの出力チャネルと、ビットマップ カテゴリに別の出力チャネルを指定できます。

既定の色調整とグレースケール調整の設定は、独自の調整設定を持たないすべてのカテゴリに適用されます。 たとえば、ビットマップ カテゴリの調整設定を指定しない場合、既定の設定はビットマップ カテゴリに適用されます。

特定のカテゴリに対して色調整またはグレースケール調整設定を指定するとすぐに、既定の調整設定がそのカテゴリに適用されなくなります。 たとえば、既定のカテゴリの調整設定のコレクションを指定するとします。 Bitmap メソッドにSetOutputChannelを渡してビットマップ カテゴリの出力チャネルを設定した場合、既定の調整設定はビットマップに適用されなくなります。

適用対象