ImageAttributes.SetRemapTable Methode

Definition

Legt die Farbumwandlungstabelle fest.

Überlädt

SetRemapTable(ColorMap[])

Legt die Farbumwandlungstabelle für die Standardkategorie fest.

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

Legt die Farbumwandlungstabelle für eine angegebene Kategorie fest.

SetRemapTable(ColorMap[])

Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs

Legt die Farbumwandlungstabelle für die Standardkategorie fest.

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())

Parameter

map
ColorMap[]

Ein Array von Farbpaaren vom Typ ColorMap. Jedes Farbpaar enthält eine vorhandene Farbe (den ersten Wert) und die Farbe, der diese zugeordnet wird (der zweite Wert).

Beispiele

Das folgende Codebeispiel ist für die Verwendung mit Windows Forms konzipiert und erfordert PaintEventArgse, was ein Parameter des Paint Ereignishandlers ist. Der Code führt die folgenden Aktionen aus:

  1. Erstellt ein Bild (einen roten Kreis), speichert es als Circle2.jpg, öffnet dieses Bild und zeichnet es auf den Bildschirm.

  2. Erstellt eine Farbzuordnung, die die Farbe Rot der Farbe Grün zuordnet.

  3. Zeichnet das zuvor erstellte Bild erneut auf den Bildschirm, diesmal jedoch mithilfe der Farbzuordnung.

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

Hinweise

Eine Farbzuordnungstabelle ist ein Array von ColorMap Strukturen. Jede ColorMap Struktur verfügt über zwei Color Objekte: eines, das eine alte Farbe angibt, und eines, das eine entsprechende neue Farbe angibt. Während des Renderns wird jede Farbe, die mit einer der alten Farben in der Neuzuordnungstabelle übereinstimmt, in die entsprechende neue Farbe geändert.

Ein ImageAttributes Objekt verwaltet Farb- und Graustufeneinstellungen für fünf Anpassungskategorien: Standard, Bitmap, Pinsel, Stift und Text. Sie können z. B. eine Farbwiedenzuordnung für die Standardkategorie, eine Farbwiedenzuordnungstabelle für die Bitmapkategorie und weiterhin eine andere Farbzuordnungstabelle für die Stiftkategorie angeben.

Die Standardeinstellungen für Farbanpassung und Graustufenanpassung gelten für alle Kategorien, die keine eigenen Anpassungseinstellungen haben. Wenn Sie beispielsweise nie Anpassungseinstellungen für die Stiftkategorie angeben, gelten die Standardeinstellungen für die Stiftkategorie.

Gilt für:

SetRemapTable(ReadOnlySpan<ColorMap>)

Quelle:
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))

Parameter

Gilt für:

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

Quelle:
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)))

Parameter

Gilt für:

SetRemapTable(ColorAdjustType, ReadOnlySpan<ColorMap>)

Quelle:
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))

Parameter

Gilt für:

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

Quelle:
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)))

Parameter

Gilt für:

SetRemapTable(ColorMap[], ColorAdjustType)

Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs
Quelle:
ImageAttributes.cs

Legt die Farbumwandlungstabelle für eine angegebene Kategorie fest.

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)

Parameter

map
ColorMap[]

Ein Array von Farbpaaren vom Typ ColorMap. Jedes Farbpaar enthält eine vorhandene Farbe (den ersten Wert) und die Farbe, der diese zugeordnet wird (der zweite Wert).

type
ColorAdjustType

Ein Element von ColorAdjustType, das die Kategorie angibt, für die die Farbumwandlungstabelle festgelegt ist.

Beispiele

Ein Codebeispiel finden Sie in der SetRemapTable(ColorMap[]) -Methode.

Hinweise

Eine Farbzuordnungstabelle ist ein Array von ColorMap Strukturen. Jede ColorMap Struktur verfügt über zwei Color Objekte: eines, das eine alte Farbe angibt, und eines, das eine entsprechende neue Farbe angibt. Während des Renderns wird jede Farbe, die mit einer der alten Farben in der Neuzuordnungstabelle übereinstimmt, in die entsprechende neue Farbe geändert.

Ein ImageAttributes Objekt verwaltet Farb- und Graustufeneinstellungen für fünf Anpassungskategorien: Standard, Bitmap, Pinsel, Stift und Text. Sie können z. B. eine Farbwiedenzuordnung für die Standardkategorie, eine Farbwiedenzuordnungstabelle für die Bitmapkategorie und weiterhin eine andere Farbzuordnungstabelle für die Stiftkategorie angeben.

Die Standardeinstellungen für Farbanpassung und Graustufenanpassung gelten für alle Kategorien, die keine eigenen Anpassungseinstellungen haben. Wenn Sie beispielsweise nie Anpassungseinstellungen für die Stiftkategorie angeben, gelten die Standardeinstellungen für die Stiftkategorie.

Sobald Sie eine Farbanpassungs- oder Graustufenanpassungseinstellung für eine bestimmte Kategorie angeben, gelten die Standardeinstellungseinstellungen nicht mehr für diese Kategorie. Angenommen, Sie geben eine Sammlung von Anpassungseinstellungen für die Standardkategorie an. Wenn Sie die Farbzuordnungstabelle für die Stiftkategorie festlegen, indem Sie an die SetRemapTable -Methode übergebenPen, gilt keine der Standardanpassungseinstellungen für Stifte.

Gilt für: