ImageAttributes.SetRemapTable Yöntem

Tanım

Color-remap tablosunu ayarlar.

Aşırı Yüklemeler

Name Description
SetRemapTable(ColorMap[])

Varsayılan kategori için color-remap tablosunu ayarlar.

SetRemapTable(ReadOnlySpan<ColorMap>)

Belirtilen kategori için color-remap tablosunu ayarlar.

SetRemapTable(ReadOnlySpan<ValueTuple<Color,Color>>)

Belirtilen kategori için color-remap tablosunu ayarlar.

SetRemapTable(ColorAdjustType, ReadOnlySpan<ColorMap>)

Belirtilen kategori için color-remap tablosunu ayarlar.

SetRemapTable(ColorAdjustType, ReadOnlySpan<ValueTuple<Color,Color>>)

Belirtilen kategori için color-remap tablosunu ayarlar.

SetRemapTable(ColorMap[], ColorAdjustType)

Belirtilen kategori için color-remap tablosunu ayarlar.

SetRemapTable(ColorMap[])

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

Varsayılan kategori için color-remap tablosunu ayarlar.

public:
 void SetRemapTable(... cli::array <System::Drawing::Imaging::ColorMap ^> ^ map);
public:
 void SetRemapTable(cli::array <System::Drawing::Imaging::ColorMap ^> ^ map);
public void SetRemapTable(params System.Drawing.Imaging.ColorMap[] map);
public void SetRemapTable(System.Drawing.Imaging.ColorMap[] map);
member this.SetRemapTable : System.Drawing.Imaging.ColorMap[] -> unit
Public Sub SetRemapTable (ParamArray map As ColorMap())
Public Sub SetRemapTable (map As ColorMap())

Parametreler

map
ColorMap[]

türünde ColorMaprenk çiftleri dizisi. Her renk çifti, var olan bir rengi (ilk değer) ve eşleştirileceği rengi (ikinci değer) içerir.

Örnekler

Aşağıdaki kod örneği Windows Forms ile kullanılmak üzere tasarlanmıştır ve PaintEventArgs olay işleyicisinin bir parametresi olan ePaint gerektirir. Kod aşağıdaki eylemleri gerçekleştirir:

  1. Bir resim (kırmızı daire) oluşturur, Circle2.jpgolarak kaydeder, bu görüntüyü açar ve ekrana çizer.

  2. Kırmızı rengi yeşil renkle eşleyen bir renk haritası oluşturur.

  3. Daha önce oluşturulan görüntüyü yeniden ekrana çizer, ancak bu kez renk haritasını kullanır.

private:
   void SetRemapTableExample( PaintEventArgs^ e )
   {
      // Create a filled, red image, and save it to Circle2.jpg.
      Bitmap^ myBitmap = gcnew Bitmap( 50,50 );
      Graphics^ g = Graphics::FromImage( myBitmap );
      g->Clear( Color::White );
      g->FillEllipse( gcnew SolidBrush( Color::Red ), Rectangle(0,0,50,50) );
      myBitmap->Save( "Circle2.jpg" );

      // Create an Image object from the Circle2.jpg file, and draw it to
      // the screen.
      Image^ myImage = Image::FromFile( "Circle2.jpg" );
      e->Graphics->DrawImage( myImage, 20, 20 );

      // Create a color map.
      array<ColorMap^>^myColorMap = gcnew array<ColorMap^>(1);
      myColorMap[ 0 ] = gcnew ColorMap;
      myColorMap[ 0 ]->OldColor = Color::Red;
      myColorMap[ 0 ]->NewColor = Color::Green;

      // Create an ImageAttributes object, and then pass the
      // myColorMap object to the SetRemapTable method.
      ImageAttributes^ imageAttr = gcnew ImageAttributes;
      imageAttr->SetRemapTable( myColorMap );

      // Draw the image with the remap table set.
      Rectangle rect = Rectangle(150,20,50,50);
      e->Graphics->DrawImage( myImage, rect, 0, 0, 50, 50, GraphicsUnit::Pixel, imageAttr );
   }
private void SetRemapTableExample(PaintEventArgs e)
{
             
    // Create a filled, red image, and save it to Circle2.jpg.
    Bitmap myBitmap = new Bitmap(50, 50);
    Graphics g = Graphics.FromImage(myBitmap);
    g.Clear(Color.White);
    g.FillEllipse(new SolidBrush(Color.Red),
        new Rectangle(0, 0, 50, 50));
    myBitmap.Save("Circle2.jpg");
             
    // Create an Image object from the Circle2.jpg file, and draw it to
             
    // the screen.
    Image myImage = Image.FromFile("Circle2.jpg");
    e.Graphics.DrawImage(myImage, 20, 20);
             
    // Create a color map.
    ColorMap[] myColorMap = new ColorMap[1];
    myColorMap[0] = new ColorMap();
    myColorMap[0].OldColor = Color.Red;
    myColorMap[0].NewColor = Color.Green;
             
    // Create an ImageAttributes object, and then pass the
   // myColorMap object to the SetRemapTable method.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetRemapTable(myColorMap);
             
    // Draw the image with the remap table set.
    Rectangle rect = new Rectangle(150, 20, 50, 50);
    e.Graphics.DrawImage(myImage, rect, 0, 0, 50, 50, 
        GraphicsUnit.Pixel, imageAttr);    
}
Public Sub SetRemapTableExample(ByVal e As PaintEventArgs)

    ' Create a filled, red image and save it to Circle2.jpg.
    Dim myBitmap As New Bitmap(50, 50)
    Dim g As Graphics = Graphics.FromImage(myBitmap)
    g.Clear(Color.White)
    g.FillEllipse(New SolidBrush(Color.Red), New Rectangle(0, 0, _
    50, 50))
    myBitmap.Save("Circle2.jpg")

    ' Create an Image object from the Circle2.jpg file, and draw

    ' it to the screen.
    Dim myImage As Image = Image.FromFile("Circle2.jpg")
    e.Graphics.DrawImage(myImage, 20, 20)

    ' Create a color map.
    Dim myColorMap(0) As ColorMap
    myColorMap(0) = New ColorMap
    myColorMap(0).OldColor = Color.Red
    myColorMap(0).NewColor = Color.Green

    ' Create an ImageAttributes object, and then pass the

    ' myColorMap object to the SetRemapTable method.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetRemapTable(myColorMap)

    ' Draw the image with the remap table set.
    Dim rect As New Rectangle(150, 20, 50, 50)
    e.Graphics.DrawImage(myImage, rect, 0, 0, 50, 50, _
    GraphicsUnit.Pixel, imageAttr)
    ' Image
End Sub

Açıklamalar

Color-remap tablosu bir yapı dizisidir ColorMap . Her ColorMap yapıda iki Color nesne vardır: biri eski bir rengi, diğeri de buna karşılık gelen yeni rengi belirtir. İşleme sırasında, yeniden eşleme tablosundaki eski renklerden biriyle eşleşen tüm renkler ilgili yeni renkle değiştirilir.

Nesne ImageAttributes , beş ayarlama 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 renk yeniden eşlemesi, bit eşlem kategorisi için bir renk yeniden eşleme tablosu ve kalem kategorisi için farklı bir renk yeniden eşleme tablosu belirtebilirsiniz.

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

Şunlara uygulanır

SetRemapTable(ReadOnlySpan<ColorMap>)

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

Belirtilen kategori için color-remap tablosunu ayarlar.

public:
 void SetRemapTable(ReadOnlySpan<System::Drawing::Imaging::ColorMap ^> map);
public void SetRemapTable(scoped ReadOnlySpan<System.Drawing.Imaging.ColorMap> map);
member this.SetRemapTable : ReadOnlySpan<System.Drawing.Imaging.ColorMap> -> unit
Public Sub SetRemapTable (map As ReadOnlySpan(Of ColorMap))

Parametreler

map
ReadOnlySpan<ColorMap>

türünde ColorMaprenk çiftleri dizisi. Her renk çifti, var olan bir rengi (ilk değer) ve eşleştirileceği rengi (ikinci değer) içerir.

Şunlara uygulanır

SetRemapTable(ReadOnlySpan<ValueTuple<Color,Color>>)

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

Belirtilen kategori için color-remap tablosunu ayarlar.

public:
 void SetRemapTable(ReadOnlySpan<ValueTuple<System::Drawing::Color, System::Drawing::Color>> map);
public void SetRemapTable(scoped ReadOnlySpan<(System.Drawing.Color OldColor, System.Drawing.Color NewColor)> map);
member this.SetRemapTable : ReadOnlySpan<ValueTuple<System.Drawing.Color, System.Drawing.Color>> -> unit
Public Sub SetRemapTable (map As ReadOnlySpan(Of ValueTuple(Of Color, Color)))

Parametreler

map
ReadOnlySpan<ValueTuple<Color,Color>>

türünde ColorMaprenk çiftleri dizisi. Her renk çifti, var olan bir rengi (ilk değer) ve eşleştirileceği rengi (ikinci değer) içerir.

Şunlara uygulanır

SetRemapTable(ColorAdjustType, ReadOnlySpan<ColorMap>)

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

Belirtilen kategori için color-remap tablosunu ayarlar.

public:
 void SetRemapTable(System::Drawing::Imaging::ColorAdjustType type, ReadOnlySpan<System::Drawing::Imaging::ColorMap ^> map);
public void SetRemapTable(System.Drawing.Imaging.ColorAdjustType type, scoped ReadOnlySpan<System.Drawing.Imaging.ColorMap> map);
member this.SetRemapTable : System.Drawing.Imaging.ColorAdjustType * ReadOnlySpan<System.Drawing.Imaging.ColorMap> -> unit
Public Sub SetRemapTable (type As ColorAdjustType, map As ReadOnlySpan(Of ColorMap))

Parametreler

type
ColorAdjustType

Color-remap tablosunun ayarlandığı kategoriyi belirten öğesi ColorAdjustType .

map
ReadOnlySpan<ColorMap>

Var olan bir rengi yeni bir renge eşlenen bir dizi renk çifti.

Şunlara uygulanır

SetRemapTable(ColorAdjustType, ReadOnlySpan<ValueTuple<Color,Color>>)

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

Belirtilen kategori için color-remap tablosunu ayarlar.

public:
 void SetRemapTable(System::Drawing::Imaging::ColorAdjustType type, ReadOnlySpan<ValueTuple<System::Drawing::Color, System::Drawing::Color>> map);
public void SetRemapTable(System.Drawing.Imaging.ColorAdjustType type, scoped ReadOnlySpan<(System.Drawing.Color OldColor, System.Drawing.Color NewColor)> map);
member this.SetRemapTable : System.Drawing.Imaging.ColorAdjustType * ReadOnlySpan<ValueTuple<System.Drawing.Color, System.Drawing.Color>> -> unit
Public Sub SetRemapTable (type As ColorAdjustType, map As ReadOnlySpan(Of ValueTuple(Of Color, Color)))

Parametreler

type
ColorAdjustType

Color-remap tablosunun ayarlandığı kategoriyi belirten öğesi ColorAdjustType .

map
ReadOnlySpan<ValueTuple<Color,Color>>

Var olan bir rengi yeni bir renge eşlenen bir dizi renk çifti.

Şunlara uygulanır

SetRemapTable(ColorMap[], ColorAdjustType)

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

Belirtilen kategori için color-remap tablosunu ayarlar.

public:
 void SetRemapTable(cli::array <System::Drawing::Imaging::ColorMap ^> ^ map, System::Drawing::Imaging::ColorAdjustType type);
public void SetRemapTable(System.Drawing.Imaging.ColorMap[] map, System.Drawing.Imaging.ColorAdjustType type);
member this.SetRemapTable : System.Drawing.Imaging.ColorMap[] * System.Drawing.Imaging.ColorAdjustType -> unit
Public Sub SetRemapTable (map As ColorMap(), type As ColorAdjustType)

Parametreler

map
ColorMap[]

türünde ColorMaprenk çiftleri dizisi. Her renk çifti, var olan bir rengi (ilk değer) ve eşleştirileceği rengi (ikinci değer) içerir.

type
ColorAdjustType

Color-remap tablosunun ayarlandığı kategoriyi belirten öğesi ColorAdjustType .

Örnekler

Kod örneği için yöntemine SetRemapTable(ColorMap[]) bakın.

Açıklamalar

Color-remap tablosu bir yapı dizisidir ColorMap . Her ColorMap yapıda iki Color nesne vardır: biri eski bir rengi, diğeri de buna karşılık gelen yeni rengi belirtir. İşleme sırasında, yeniden eşleme tablosundaki eski renklerden biriyle eşleşen tüm renkler ilgili yeni renkle değiştirilir.

Nesne ImageAttributes , beş ayarlama 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 renk yeniden eşlemesi, bit eşlem kategorisi için bir renk yeniden eşleme tablosu ve kalem kategorisi için farklı bir renk yeniden eşleme tablosu belirtebilirsiniz.

Varsayılan renk ayarlama ve gri tonlamalı ayarlama ayarları, kendi ayarlama ayarları olmayan tüm kategoriler için geçerlidir. Örneğin, kalem kategorisi için hiçbir ayarlama ayarı belirtmezseniz, varsayılan ayarlar kalem 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 kategoriye uygulanmaz. Örneğin, varsayılan kategori için bir ayarlama ayarları koleksiyonu belirttiğinizi varsayalım. Kalem kategorisi için color-remap tablosunu yöntemine Pen geçirerek SetRemapTable ayarlarsanız, varsayılan ayarlama ayarlarının hiçbiri kalemlere uygulanmaz.

Şunlara uygulanır