Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

BitmapPalettes Class

Defines several color palettes that are commonly used by bitmap images.

System.Object
  System.Windows.Media.Imaging.BitmapPalettes

Namespace:  System.Windows.Media.Imaging
Assembly:  PresentationCore (in PresentationCore.dll)
public static class BitmapPalettes

The BitmapPalettes type exposes the following members.

  NameDescription
Public propertyStatic memberBlackAndWhiteGets a value that represents a black-and-white color palette. This palette consists of 2 colors total.
Public propertyStatic memberBlackAndWhiteTransparentGets a value that represents a black, white, and transparent color palette. This palette consists of 3 colors total.
Public propertyStatic memberGray16Gets a value that represents a color palette that contains 16 shades of gray. The palette ranges from black to gray to white. This palette contains 16 total colors.
Public propertyStatic memberGray16TransparentGets a value that represents a color palette that contains 16 shades of gray. The palette ranges from black to gray to white with an additional transparent color. This palette contains 17 total colors.
Public propertyStatic memberGray256Gets a value that represents a color palette that contains 256 shades of gray, ranging from black to gray to white. This palette contains 256 total colors.
Public propertyStatic memberGray256TransparentGets a value that represents a color palette that contains 256 shades of gray, ranging from black to gray to white with an additional transparent color. This palette contains 257 total colors.
Public propertyStatic memberGray4Gets a value that represents a color palette that contains 4 shades of gray, ranging from black to gray to white. This palette contains 4 total colors.
Public propertyStatic memberGray4TransparentGets a value that represents a color palette that contains 4 shades of gray, ranging from black to gray to white with an additional transparent color. This palette contains 5 total colors.
Public propertyStatic memberHalftone125Gets a value that represents a color palette that contains 125 primary colors and 16 system colors, with duplicate colors removed. There are a total of 133 colors in this palette.
Public propertyStatic memberHalftone125TransparentGets a value that represents a color palette that contains 125 primary colors, 16 system colors, and 1 additional transparent color. Duplicate colors in the palette are removed. There are a total of 134 colors in this palette.
Public propertyStatic memberHalftone216Gets a value that represents a color palette that contains 216 primary colors and 16 system colors, with duplicate colors removed. There are a total of 224 colors in this palette.
Public propertyStatic memberHalftone216TransparentGets a value that represents a color palette that contains 216 primary colors, 16 system colors, and 1 additional transparent color. Duplicate colors in the palette are removed. There are a total of 225 colors in this palette.
Public propertyStatic memberHalftone252Gets a value that represents a color palette that contains 252 primary colors and 16 system colors, with duplicate colors removed. There are a total of 256 colors in this palette.
Public propertyStatic memberHalftone252TransparentGets a value that represents a color palette that contains 252 primary colors, 16 system colors, and 1 additional transparent color. Duplicate colors in the palette are removed. There are a total of 256 colors in this palette.
Public propertyStatic memberHalftone256Gets a value that represents a color palette that contains 256 primary colors and 16 system colors, with duplicate colors removed. There are a total of 256 colors in this palette.
Public propertyStatic memberHalftone256TransparentGets a value that represents a color palette that contains 256 primary colors, 16 system colors, and 1 additional transparent color that replaces the final color in the sequence. Duplicate colors in the palette are removed. There are a total of 256 colors in this palette.
Public propertyStatic memberHalftone27Gets a value that represents a color palette that contains 27 primary colors and 16 system colors, with duplicate colors removed. There are a total of 35 colors in this palette.
Public propertyStatic memberHalftone27TransparentGets a value that represents a color palette that contains 27 primary colors and 16 system colors, with duplicate colors removed and 1 additional transparent color. There are a total of 36 colors in this palette.
Public propertyStatic memberHalftone64Gets a value that represents a color palette that contains 64 primary colors and 16 system colors, with duplicate colors removed. There are a total of 72 colors in this palette.
Public propertyStatic memberHalftone64TransparentGets a value that represents a color palette that contains 64 primary colors and 16 system colors, with duplicate colors removed and 1 additional transparent color. There are a total of 73 colors in this palette.
Public propertyStatic memberHalftone8Gets a value that represents a color palette that contains 8 primary colors and 16 system colors, with duplicate colors removed. There are a total of 16 colors in this palette, which are the same as the system palette.
Public propertyStatic memberHalftone8TransparentGets a value that represents a color palette that contains 8 primary colors and 16 system colors, with duplicate colors removed and 1 additional transparent color. There are a total of 17 colors in this palette.
Public propertyStatic memberWebPaletteGets a value that represents a color palette that contains 216 primary colors and 16 system colors, with duplicate colors removed. There are a total of 224 colors in this palette.
Public propertyStatic memberWebPaletteTransparentGets a value that represents a color palette that contains 216 primary colors and 16 system colors, with duplicate colors removed and 1 additional transparent color. There are a total of 225 colors in this palette.
Top

BitmapPalettes properties whose names end with "Transparent" have an additional "color" that is fully transparent. In the case of palettes that already have 256 colors, the last color is replaced by the transparent color.

Only Tagged Image File Format (TIFF) and Graphics Interchange Format (GIF) image formats support palettes.

The following code example demonstrates how to construct a new BitmapSource by using a member of the BitmapPalettes class in a similar way.

BitmapSource image5 = BitmapSource.Create(
    width,
    height,
    96,
    96,
    PixelFormats.Indexed1,
    BitmapPalettes.WebPalette,
    pixels,
    stride);

FileStream stream5 = new FileStream("palette.tif", FileMode.Create);
TiffBitmapEncoder encoder5 = new TiffBitmapEncoder();
encoder5.Frames.Add(BitmapFrame.Create(image5));
encoder5.Save(stream5);

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, 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.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.