This class is used to set various color-manipulation effects when
rendering on a graphics surface. You can pass an
ImageAttributes object to the
System.Drawing.Graphics.DrawImage() and
System.Drawing.Graphics.EnumerateMetafile()
There are two methods to remap colors using a
ColorMap: SetBrushRemapTable()
and SetRemapTable(). You can apply a
ColorMatrix using the SetColorMatrix() method. If you want to set separate matrixes for the
color and grayscale parts of an image, you can use the
SetColorMatrices() variant.
SetThreshold() applies a bi-level threshold to
the image (everything below the threshold is clamped to 0, and
everything above is clamped to the maximum representable value). You
can control the gamma with SetGamma().
You can enable basic color keying with SetColorKey(). This allows you to set a range of colors that will be
rendered as transparent, allowing the background to show through.
The SetOutputChannel() allows you to limit the
image rendered to one or more of the CMYK channels (as listed in the
ColorChannelFlag enumeration). This allows you to
perform basic color separations for printing.
SetOutputChannelColorProfile() allows you to
choose a color-match profile file for the CMYK conversion, to better
match the characteristics of the target output device. Installed
color profiles are found in the
%SystemRoot%\System32\Spool\Drivers\Color\
directory, and the system will look in here for the filename you
specify. If the profile file is not installed in that directory, you
have to specify a fully qualified filename.
Each of these methods prefixed by
"Set" can be made to apply to any
and all the GDI+ object types specified in the
ColorAdjustType enumeration. There is also an
equivalent Clear... method to remove the specified
color transform. You can also use the SetNoOp()
method to disable all color transforms for a particular
ColorAdjustType.
public sealed class ImageAttributes : ICloneable, IDisposable {
// Public Constructors
public ImageAttributes();
// Public Instance Methods
public void ClearBrushRemapTable();
public void ClearColorKey();
public void ClearColorKey(ColorAdjustType type);
public void ClearColorMatrix();
public void ClearColorMatrix(ColorAdjustType type);
public void ClearGamma();
public void ClearGamma(ColorAdjustType type);
public void ClearNoOp();
public void ClearNoOp(ColorAdjustType type);
public void ClearOutputChannel();
public void ClearOutputChannel(ColorAdjustType type);
public void ClearOutputChannelColorProfile();
public void ClearOutputChannelColorProfile(ColorAdjustType type);
public void ClearRemapTable();
public void ClearRemapTable(ColorAdjustType type);
public void ClearThreshold();
public void ClearThreshold(ColorAdjustType type);
public object Clone(); // implements ICloneable
public void Dispose(); // implements IDisposable
public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type);
public void SetBrushRemapTable(ColorMap[ ] map);
public void SetColorKey(System.Drawing.Color colorLow, System.Drawing.Color colorHigh);
public void SetColorKey(System.Drawing.Color colorLow, System.Drawing.Color colorHigh, ColorAdjustType type);
public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix grayMatrix);
public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix grayMatrix, ColorMatrixFlag flags);
public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix grayMatrix, ColorMatrixFlag mode,
ColorAdjustType type);
public void SetColorMatrix(ColorMatrix newColorMatrix);
public void SetColorMatrix(ColorMatrix newColorMatrix, ColorMatrixFlag flags);
public void SetColorMatrix(ColorMatrix newColorMatrix, ColorMatrixFlag mode, ColorAdjustType type);
public void SetGamma(float gamma);
public void SetGamma(float gamma, ColorAdjustType type);
public void SetNoOp();
public void SetNoOp(ColorAdjustType type);
public void SetOutputChannel(ColorChannelFlag flags);
public void SetOutputChannel(ColorChannelFlag flags, ColorAdjustType type);
public void SetOutputChannelColorProfile(string colorProfileFilename);
public void SetOutputChannelColorProfile(string colorProfileFilename, ColorAdjustType type);
public void SetRemapTable(ColorMap[ ] map);
public void SetRemapTable(ColorMap[ ] map, ColorAdjustType type);
public void SetThreshold(float threshold);
public void SetThreshold(float threshold, ColorAdjustType type);
public void SetWrapMode(System.Drawing.Drawing2D.WrapMode mode);
public void SetWrapMode(System.Drawing.Drawing2D.WrapMode mode, System.Drawing.Color color);
public void SetWrapMode(System.Drawing.Drawing2D.WrapMode mode, System.Drawing.Color color, bool clamp);
// Protected Instance Methods
protected override void Finalize(); // overrides object
}