Export (0) Print
Expand All

ColorPalette Class

Defines an array of colors that make up a color palette. The colors are 32-bit ARGB colors. Not inheritable.

System.Object
  System.Drawing.Imaging.ColorPalette

Namespace:  System.Drawing.Imaging
Assembly:  System.Drawing (in System.Drawing.dll)

public sealed class ColorPalette

The ColorPalette type exposes the following members.

  NameDescription
Public propertyEntriesGets an array of Color structures.
Public propertyFlagsGets a value that specifies how to interpret the color information in the array of colors.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

You are not allowed to construct a ColorPalette object directly. If you created a ColorPalette object, you could then manipulate the palette size for a particular image, which is not allowed. Use the Image.Palette property to obtain a ColorPalette object.

The colors in the palette are limited to 32-bit ARGB colors. A 32-bit ARGB color has 8 bits each for alpha, red, green, and blue values. The lowest 8 bits make up the blue bit, the next 8 bits are green, the next 8 bits are red, and the most significant 8 bits are alpha. This means each component can vary from 0 to 255. Fully on is 255 and fully off is 0. Alpha is used to make the color value transparent (alpha = 0) or opaque (alpha = 255). The number of intensity levels in the image can be increased without increasing the number of colors used. This process creates what is called a halftone, and it offers increased contrast at a cost of decreased resolution.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft