ImageAttributes.SetBrushRemapTable Method

Definition

Overloads

SetBrushRemapTable(ColorMap[])

Sets the color-remap table for the brush category.

SetBrushRemapTable(ReadOnlySpan<ColorMap>)

Sets the color-remap table for a specified category.

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

Sets the color-remap table for a specified category.

SetBrushRemapTable(ColorMap[])

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

Sets the color-remap table for the brush category.

C#
public void SetBrushRemapTable(params System.Drawing.Imaging.ColorMap[] map);
C#
public void SetBrushRemapTable(System.Drawing.Imaging.ColorMap[] map);

Parameters

map
ColorMap[]

An array of ColorMap objects.

Examples

The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The code performs the following actions:

  1. Creates a single-element ColorMap array that holds red as the old color and green as the new color.

  2. Passes this array to a newly created ImageAttributes object.

C#
public void SetBrushRemapTableExample(PaintEventArgs e)
{
             
    // 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, passing it to the myColorMap
             
    // array.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetBrushRemapTable(myColorMap);
}

Remarks

A color-remap table is an array of ColorMap structures. Each ColorMap structure has two Color objects: one that specifies an old color and one that specifies a corresponding new color. During rendering, any color that matches one of the old colors in the remap table is changed to the corresponding new color.

Calling the SetBrushRemapTable method has the same effect as passing Brush to the SetRemapTable method. The specified remap table applies to items in metafiles that are filled with a brush.

This method is intended to be used only with metafiles.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

SetBrushRemapTable(ReadOnlySpan<ColorMap>)

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

Sets the color-remap table for a specified category.

C#
public void SetBrushRemapTable(scoped ReadOnlySpan<System.Drawing.Imaging.ColorMap> map);

Parameters

map
ReadOnlySpan<ColorMap>

A series of color pairs mapping an existing color to a new color.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 9 (package-provided), 10 (package-provided)
Windows Desktop 9, 10

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

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

Sets the color-remap table for a specified category.

C#
public void SetBrushRemapTable(scoped ReadOnlySpan<(System.Drawing.Color OldColor, System.Drawing.Color NewColor)> map);

Parameters

map
ReadOnlySpan<ValueTuple<Color,Color>>

A series of color pairs mapping an existing color to a new color.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 9 (package-provided), 10 (package-provided)
Windows Desktop 9, 10