Bewerken

Share via


BitmapPalettes Class

Definition

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

public ref class BitmapPalettes abstract sealed
public static class BitmapPalettes
type BitmapPalettes = class
Public Class BitmapPalettes
Inheritance
BitmapPalettes

Examples

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);
Dim image5 As BitmapSource = System.Windows.Media.Imaging.BitmapSource.Create(width, height, 96, 96, PixelFormats.Indexed1, BitmapPalettes.WebPalette, pixels, stride)

Dim stream5 As New FileStream("palette.tif", FileMode.Create)
Dim encoder5 As New TiffBitmapEncoder()
encoder5.Frames.Add(BitmapFrame.Create(image5))
encoder5.Save(stream5)

Remarks

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.

Properties

BlackAndWhite

Gets a value that represents a black-and-white color palette. This palette consists of 2 colors total.

BlackAndWhiteTransparent

Gets a value that represents a black, white, and transparent color palette. This palette consists of 3 colors total.

Gray16

Gets 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.

Gray16Transparent

Gets 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.

Gray256

Gets 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.

Gray256Transparent

Gets 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.

Gray4

Gets 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.

Gray4Transparent

Gets 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.

Halftone125

Gets 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.

Halftone125Transparent

Gets 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.

Halftone216

Gets 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.

Halftone216Transparent

Gets 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.

Halftone252

Gets 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.

Halftone252Transparent

Gets 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.

Halftone256

Gets 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.

Halftone256Transparent

Gets 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.

Halftone27

Gets 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.

Halftone27Transparent

Gets 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.

Halftone64

Gets 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.

Halftone64Transparent

Gets 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.

Halftone8

Gets 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.

Halftone8Transparent

Gets 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.

WebPalette

Gets 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.

WebPaletteTransparent

Gets 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.

Applies to

See also