แก้ไข

แชร์ผ่าน


BitmapPalettes.WebPalette Property

Definition

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.

public:
 static property System::Windows::Media::Imaging::BitmapPalette ^ WebPalette { System::Windows::Media::Imaging::BitmapPalette ^ get(); };
public static System.Windows.Media.Imaging.BitmapPalette WebPalette { get; }
static member WebPalette : System.Windows.Media.Imaging.BitmapPalette
Public Shared ReadOnly Property WebPalette As BitmapPalette

Property Value

An instance of BitmapPalette.

Examples

The following code example demonstrates how to construct a new BitmapSource by using a member of the BitmapPalettes class. Although this example shows how to use the WebPalette property, you can use any 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

The WebPalette is identical to the Halftone216 palette.

Applies to

See also