Class ColorPaletteHelper
Helper class for color palettes manipulation.
public static class ColorPaletteHelper
- Inheritance
-
ColorPaletteHelper
- Inherited Members
Methods
Create4Bit()
Creates the 4 bit color palette.
public static IColorPalette Create4Bit()
Returns
- IColorPalette
The 4 bit color palette.
Create4BitGrayscale(bool)
Creates the 4 bit grayscale palette.
public static IColorPalette Create4BitGrayscale(bool minIsWhite)
Parameters
minIsWhite
boolif set to
true
the palette starts with white color, otherwise it starts with black color.
Returns
- IColorPalette
The 4 bit grayscale palette.
Create8Bit()
Creates the 8 bit color palette.
public static IColorPalette Create8Bit()
Returns
- IColorPalette
The 8 bit color palette.
Create8BitGrayscale(bool)
Creates the 8 bit grayscale palette.
public static IColorPalette Create8BitGrayscale(bool minIsWhite)
Parameters
minIsWhite
boolif set to
true
the palette starts with white color, otherwise it starts with black color.
Returns
- IColorPalette
The 8 bit grayscale palette.
CreateMonochrome()
Creates a monochrome color palette containing 2 colors only.
public static IColorPalette CreateMonochrome()
Returns
- IColorPalette
Color palette for monochrome images.
GetCloseImagePalette(RasterImage, Rectangle, int)
Gets color palette from raster image (palletizes image) in case the image does not have one. In case palette exists it will be used instead performing calculations.
public static IColorPalette GetCloseImagePalette(RasterImage image, Rectangle destBounds, int entriesCount)
Parameters
image
RasterImageThe raster image.
destBounds
RectangleThe destination image bounds.
entriesCount
intThe desired entries count.
Returns
- IColorPalette
The color palette which starts with the most frequent colors from the
image
and containsentriesCount
entries.
GetCloseImagePalette(RasterImage, Rectangle, int, bool)
Gets color palette from raster image (palletizes image) in case the image does not have one. In case palette exists it will be used instead performing calculations.
public static IColorPalette GetCloseImagePalette(RasterImage image, Rectangle destBounds, int entriesCount, bool useImagePalette)
Parameters
image
RasterImageThe raster image.
destBounds
RectangleThe destination image bounds.
entriesCount
intThe desired entries count.
useImagePalette
boolIf set, it will use its own image palette if available
Returns
- IColorPalette
The color palette which starts with the most frequent colors from the
image
and containsentriesCount
entries.
GetCloseImagePalette(RasterImage, Rectangle, int, bool, Color)
Gets color palette from raster image (palletizes image) in case the image does not have one. In case palette exists it will be used instead performing calculations.
public static IColorPalette GetCloseImagePalette(RasterImage image, Rectangle destBounds, int entriesCount, bool useImagePalette, Color alphaBlendInColor)
Parameters
image
RasterImageThe raster image.
destBounds
RectangleThe destination image bounds.
entriesCount
intThe desired entries count.
useImagePalette
boolIf set, it will use its own image palette if available
alphaBlendInColor
ColorThe color that should be used as a background color for semi-transparent alpha replacement.
Returns
- IColorPalette
The color palette which starts with the most frequent colors from the
image
and containsentriesCount
entries.
GetCloseImagePalette(RasterImage, Rectangle, int, bool, Color, bool)
Gets color palette from raster image (palletizes image) in case the image does not have one. In case palette exists it will be used instead performing calculations.
public static IColorPalette GetCloseImagePalette(RasterImage image, Rectangle destBounds, int entriesCount, bool useImagePalette, Color alphaBlendInColor, bool keepTransparency)
Parameters
image
RasterImageThe raster image.
destBounds
RectangleThe destination image bounds.
entriesCount
intThe desired entries count.
useImagePalette
boolIf set, it will use its own image palette if available
alphaBlendInColor
ColorThe color that should be used as a background color for semi-transparent alpha replacement.
keepTransparency
boolIf set, it will consider alpha channel bits of the image colors.
Returns
- IColorPalette
The color palette which starts with the most frequent colors from the
image
and containsentriesCount
entries.
GetCloseImagePalette(RasterImage, int)
Gets color palette from raster image (palletizes image) in case the image does not have one. In case palette exists it will be used instead performing calculations.
public static IColorPalette GetCloseImagePalette(RasterImage image, int entriesCount)
Parameters
image
RasterImageThe raster image.
entriesCount
intThe desired entries count.
Returns
- IColorPalette
The color palette which starts with the most frequent colors from the
image
and containsentriesCount
entries.
GetCloseImagePalette(RasterImage, int, PaletteMiningMethod)
Gets color palette from raster image (palletizes image) in case the image does not have one. Palette is about to be optimized for better indexed image quality or taken "AS IS" when PaletteMiningMethod.UseCurrentPalette is used.
public static IColorPalette GetCloseImagePalette(RasterImage image, int entriesCount, PaletteMiningMethod paletteMiningMethod)
Parameters
image
RasterImageThe raster image.
entriesCount
intThe desired entries count.
paletteMiningMethod
PaletteMiningMethodThe palette mining method.
Returns
- IColorPalette
The color palette which starts with the most frequent colors from the
image
and containsentriesCount
entries.
GetCloseTransparentImagePalette(RasterImage, int)
Gets color palette from raster image (palletizes image) in case the image does not have one. In case palette exists it will be used instead performing calculations.
public static IColorPalette GetCloseTransparentImagePalette(RasterImage image, int entriesCount)
Parameters
image
RasterImageThe raster image.
entriesCount
intThe desired entries count.
Returns
- IColorPalette
The color palette which starts with the most frequent colors from the
image
and containsentriesCount
entries.
GetDownscalePalette(RasterImage)
Get 256 color palette, composed from upper bits of initial image color values.
public static ColorPalette GetDownscalePalette(RasterImage image)
Parameters
image
RasterImageThe image.
Returns
- ColorPalette
The ColorPalette.
GetUniformColorPalette(RasterImage)
Get uniform 256 color palette.
public static ColorPalette GetUniformColorPalette(RasterImage image)
Parameters
image
RasterImageThe image.
Returns
- ColorPalette
The ColorPalette.
HasTransparentColors(IColorPalette)
Determines whether the specified palette has transparent colors.
public static bool HasTransparentColors(IColorPalette palette)
Parameters
palette
IColorPaletteThe palette.
Returns
- bool
true
if the specified palette has transparent colors; otherwise,false
.
Exceptions
- ArgumentNullException
palette
is null.