ImageAttributes.SetOutputChannel Yöntem

Tanım

CMYK (camgöbeği-eflatun-sarı-siyah) çıkış kanalını ayarlar.

Aşırı Yüklemeler

SetOutputChannel(ColorChannelFlag)

Varsayılan kategori için CMYK (camgöbeği-eflatun-sarı-siyah) çıkış kanalını ayarlar.

SetOutputChannel(ColorChannelFlag, ColorAdjustType)

Belirtilen kategori için CMYK (camgöbeği-eflatun-sarı-siyah) çıkış kanalını ayarlar.

SetOutputChannel(ColorChannelFlag)

Kaynak:
ImageAttributes.cs
Kaynak:
ImageAttributes.cs
Kaynak:
ImageAttributes.cs

Varsayılan kategori için CMYK (camgöbeği-eflatun-sarı-siyah) çıkış kanalını ayarlar.

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)

Parametreler

flags
ColorChannelFlag

Çıkış kanalını ColorChannelFlag belirten öğesi.

Örnekler

Aşağıdaki kod örneğinde yönteminin nasıl kullanılacağı gösterilmektedir SetOutputChannel . Bu örneği çalıştırmak için aşağıdaki kodu bir Windows Formuna yapıştırın. Formun Paint olayını işleyip olarak PaintEventArgsgeçirerek öğesini çağırın eShowOutputChannels.

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

Açıklamalar

Bir görüntüyü CMYK renk alanına dönüştürmek ve CMYK renk kanallarından birinin yoğunluklarını incelemek için yöntemini kullanabilirsiniz SetOutputChannel . Örneğin, bir ImageAttributes nesne oluşturduğunuzu ve bit eşlem çıkış kanalını olarak ayarladığınızı ColorChannelCvarsayalım. Bu ImageAttributes nesnenin yolunu yönteme DrawImage geçirirseniz, her pikselin siyan bileşeni hesaplanır ve işlenen görüntüdeki her piksel, siyan kanalının yoğunluğunu gösteren gri bir gölgedir. Benzer şekilde, eflatun, sarı ve siyah kanalların yoğunluğunu gösteren görüntüleri işleyebilirsiniz.

Nesne ImageAttributes , beş ayar kategorisi için renk ve gri tonlama ayarlarını korur: varsayılan, bit eşlem, fırça, kalem ve metin. Örneğin, varsayılan kategori için bir çıkış kanalı ve bit eşlem kategorisi için farklı bir çıkış kanalı belirtebilirsiniz.

Varsayılan renk ayarlaması ve gri tonlamalı ayarlama ayarları, kendi ayarlama ayarlarına sahip olmayan tüm kategoriler için geçerlidir. Örneğin, bit eşlem kategorisi için hiçbir ayarlama ayarı belirtmezseniz, varsayılan ayarlar bit eşlem kategorisine uygulanır.

Şunlara uygulanır

SetOutputChannel(ColorChannelFlag, ColorAdjustType)

Kaynak:
ImageAttributes.cs
Kaynak:
ImageAttributes.cs
Kaynak:
ImageAttributes.cs

Belirtilen kategori için CMYK (camgöbeği-eflatun-sarı-siyah) çıkış kanalını ayarlar.

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)

Parametreler

flags
ColorChannelFlag

Çıkış kanalını ColorChannelFlag belirten öğesi.

type
ColorAdjustType

Çıkış kanalının ColorAdjustType ayarlandığı kategoriyi belirten öğesi.

Örnekler

Aşağıdaki kod örneğinde yönteminin nasıl kullanılacağı gösterilmektedir SetOutputChannel . Bu örneği çalıştırmak için aşağıdaki kodu bir Windows Formuna yapıştırın. Formun Paint olayını işleyip olarak PaintEventArgsgeçirerek öğesini çağırın eShowOutputChannels.

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

Açıklamalar

Bir görüntüyü CMYK renk alanına dönüştürmek ve CMYK renk kanallarından birinin yoğunluklarını incelemek için yöntemini kullanabilirsiniz SetOutputChannel . Örneğin, bir ImageAttributes nesne oluşturduğunuzu ve bit eşlem çıkış kanalını olarak ayarladığınızı ColorChannelCvarsayalım. Bu ImageAttributes nesnenin yolunu yönteme DrawImage geçirirseniz, her pikselin siyan bileşeni hesaplanır ve işlenen görüntüdeki her piksel, siyan kanalının yoğunluğunu gösteren gri bir gölgedir. Benzer şekilde, eflatun, sarı ve siyah kanalların yoğunluğunu gösteren görüntüleri işleyebilirsiniz.

Nesne ImageAttributes , beş ayar kategorisi için renk ve gri tonlama ayarlarını korur: varsayılan, bit eşlem, fırça, kalem ve metin. Örneğin, varsayılan kategori için bir çıkış kanalı ve bit eşlem kategorisi için farklı bir çıkış kanalı belirtebilirsiniz.

Varsayılan renk ayarlaması ve gri tonlamalı ayarlama ayarları, kendi ayarlama ayarlarına sahip olmayan tüm kategoriler için geçerlidir. Örneğin, bit eşlem kategorisi için hiçbir ayarlama ayarı belirtmezseniz, varsayılan ayarlar bit eşlem kategorisine uygulanır.

Belirli bir kategori için renk ayarlaması veya gri tonlamalı ayarlama ayarı belirttiğiniz anda, varsayılan ayarlama ayarları artık bu kategori için geçerli değildir. Örneğin, varsayılan kategori için bir ayarlama ayarları koleksiyonu belirttiğinizi varsayalım. Bit eşlem kategorisi için çıkış kanalını yöntemine SetOutputChannel geçirerek Bitmap ayarlarsanız, varsayılan ayarlama ayarlarının hiçbiri bit eşlemlere uygulanmaz.

Şunlara uygulanır