ImageAttributes.SetRemapTable 메서드

정의

색 매핑 변경 테이블을 설정합니다.

오버로드

SetRemapTable(ColorMap[])

기본 범주에 대한 색 다시 매핑 테이블을 설정합니다.

SetRemapTable(ReadOnlySpan<ColorMap>)
SetRemapTable(ReadOnlySpan<ValueTuple<Color,Color>>)
SetRemapTable(ColorAdjustType, ReadOnlySpan<ColorMap>)
SetRemapTable(ColorAdjustType, ReadOnlySpan<ValueTuple<Color,Color>>)
SetRemapTable(ColorMap[], ColorAdjustType)

지정된 범주에 대한 색 매핑 변경 테이블을 설정합니다.

SetRemapTable(ColorMap[])

Source:
ImageAttributes.cs
Source:
ImageAttributes.cs
Source:
ImageAttributes.cs

기본 범주에 대한 색 다시 매핑 테이블을 설정합니다.

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

매개 변수

map
ColorMap[]

ColorMap 형식의 색 쌍 배열입니다. 각 색 쌍은 기존 색(첫째 값)과 매핑될 색(둘째 값)으로 구성됩니다.

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  1. 이미지(빨간색 원)를 만들고, Circle2.jpg 저장하고, 해당 이미지를 열고, 화면에 그립니다.

  2. 빨간색을 녹색 색에 매핑하는 색 맵을 만듭니다.

  3. 이전에 만든 이미지를 화면에 다시 그립니다. 이번에는 색 맵을 사용합니다.

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

설명

색 다시 매핑 테이블은 구조체의 ColorMap 배열입니다. 각 ColorMap 구조체에는 두 개의 Color 개체가 있습니다. 하나는 이전 색을 지정하고 다른 하나는 해당 새 색을 지정합니다. 렌더링하는 동안 다시 매핑 테이블의 이전 색 중 하나와 일치하는 모든 색이 해당 새 색으로 변경됩니다.

개체는 ImageAttributes 기본, 비트맵, 브러시, 펜 및 텍스트의 다섯 가지 조정 범주에 대해 색 및 회색조 설정을 유지합니다. 예를 들어 기본 범주에 대한 색 다시 매핑, 비트맵 범주에 대한 색 다시 매핑 테이블, 펜 범주에 대해 다른 색 다시 매핑 테이블을 지정할 수 있습니다.

기본 색 조정 및 회색조 조정 설정은 자체 조정 설정이 없는 모든 범주에 적용됩니다. 예를 들어 펜 범주에 대한 조정 설정을 지정하지 않으면 기본 설정이 펜 범주에 적용됩니다.

적용 대상

SetRemapTable(ReadOnlySpan<ColorMap>)

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

매개 변수

적용 대상

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

Source:
ImageAttributes.cs
public:
 void SetRemapTable(ReadOnlySpan<ValueTuple<System::Drawing::Color, System::Drawing::Color>> map);
public void SetRemapTable (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)))

매개 변수

적용 대상

SetRemapTable(ColorAdjustType, ReadOnlySpan<ColorMap>)

Source:
ImageAttributes.cs
public:
 void SetRemapTable(System::Drawing::Imaging::ColorAdjustType type, ReadOnlySpan<System::Drawing::Imaging::ColorMap ^> map);
public void SetRemapTable (System.Drawing.Imaging.ColorAdjustType type, 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))

매개 변수

적용 대상

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

Source:
ImageAttributes.cs
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, 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)))

매개 변수

적용 대상

SetRemapTable(ColorMap[], ColorAdjustType)

Source:
ImageAttributes.cs
Source:
ImageAttributes.cs
Source:
ImageAttributes.cs

지정된 범주에 대한 색 매핑 변경 테이블을 설정합니다.

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)

매개 변수

map
ColorMap[]

ColorMap 형식의 색 쌍 배열입니다. 각 색 쌍은 기존 색(첫째 값)과 매핑될 색(둘째 값)으로 구성됩니다.

type
ColorAdjustType

색 매핑 변경 테이블이 설정되는 범주를 지정하는 ColorAdjustType의 요소입니다.

예제

코드 예제는 메서드를 참조하세요 SetRemapTable(ColorMap[]) .

설명

색 다시 매핑 테이블은 구조체의 ColorMap 배열입니다. 각 ColorMap 구조체에는 두 개의 Color 개체가 있습니다. 하나는 이전 색을 지정하고 다른 하나는 해당 새 색을 지정합니다. 렌더링하는 동안 다시 매핑 테이블의 이전 색 중 하나와 일치하는 모든 색이 해당 새 색으로 변경됩니다.

개체는 ImageAttributes 기본, 비트맵, 브러시, 펜 및 텍스트의 다섯 가지 조정 범주에 대해 색 및 회색조 설정을 유지합니다. 예를 들어 기본 범주에 대한 색 다시 매핑, 비트맵 범주에 대한 색 다시 매핑 테이블, 펜 범주에 대해 다른 색 다시 매핑 테이블을 지정할 수 있습니다.

기본 색 조정 및 회색조 조정 설정은 자체 조정 설정이 없는 모든 범주에 적용됩니다. 예를 들어 펜 범주에 대한 조정 설정을 지정하지 않으면 기본 설정이 펜 범주에 적용됩니다.

특정 범주에 대한 색 조정 또는 회색조 조정 설정을 지정하는 즉시 기본 조정 설정이 해당 범주에 더 이상 적용되지 않습니다. 예를 들어 기본 범주에 대한 조정 설정 컬렉션을 지정한다고 가정합니다. 메서드에 전달 PenSetRemapTable 하여 펜 범주에 대한 색 다시 매핑 테이블을 설정하는 경우 펜에 기본 조정 설정이 적용되지 않습니다.

적용 대상