BitmapPalette Constructor (BitmapSource^, Int32)
.NET Framework (current version)
Initializes a new instance of the BitmapPalette class based on the specified BitmapSource. The new BitmapPalette is limited to a specified maximum color count.
Assembly: PresentationCore (in PresentationCore.dll)
public: [SecurityCriticalAttribute] BitmapPalette( BitmapSource^ bitmapSource, int maxColorCount )
Parameters
- bitmapSource
-
Type:
System.Windows.Media.Imaging::BitmapSource^
The source bitmap from which the palette is read or constructed.
- maxColorCount
-
Type:
System::Int32
The maximum number of colors the new BitmapPalette can use.
| Exception | Condition |
|---|---|
| ArgumentNullException | The bitmapSource parameter is null. |
If the bitmapSource already has a defined palette, the corresponding palette is returned. Otherwise, a new palette is constructed from an analysis of the bitmap.
The following example demonstrates how to retrieve a BitmapPalette from an image.
.NET Framework
Available since 3.0
Available since 3.0
Show: