public final class ColorPalette extends Object implements IColorPalette
Defines an array of colors that make up a color palette. The colors are 32-bit ARGB colors. Not inheritable.
| Constructor and Description |
|---|
ColorPalette(Color[] entries)
Initializes a new instance of the
ColorPalette class and IsCompactPalette is false. |
ColorPalette(Color[] entries,
boolean isCompactPalette)
Initializes a new instance of the
ColorPalette class. |
ColorPalette(int[] argb32Entries)
Initializes a new instance of the
ColorPalette class and IsCompactPalette is false. |
ColorPalette(int[] argb32Entries,
boolean isCompactPalette)
Initializes a new instance of the
ColorPalette class. |
| Modifier and Type | Method and Description |
|---|---|
static ColorPalette |
copyPalette(IColorPalette colorPalette)
Copies the palette.
|
static ColorPalette |
copyPalette(IColorPalette colorPalette,
boolean useCompactPalette)
Copies the palette.
|
int |
getArgb32Color(int index)
Gets the 32-bit ARGB palette color by index.
|
int[] |
getArgb32Entries()
Gets an array of 32-bit ARGB structures.
|
Color |
getColor(int index)
Gets the palette color by index.
|
Color[] |
getEntries()
Gets an array of
com.aspose.imaging.Color structures. |
int |
getEntriesCount()
Gets the entries count.
|
int |
getNearestColorIndex(Color color)
Gets the index of the nearest color.
|
int |
getNearestColorIndex(int argb32Color)
Gets the index of the nearest color.
|
boolean |
isCompactPalette()
Gets or sets a value indicating whether compact palette is used.
|
public ColorPalette(int[] argb32Entries,
boolean isCompactPalette)
Initializes a new instance of the ColorPalette class.
argb32Entries - The 32-bit ARGB color palette entries.isCompactPalette - Indicating whether compact it palette.public ColorPalette(int[] argb32Entries)
Initializes a new instance of the ColorPalette class and IsCompactPalette is false.
argb32Entries - The 32-bit ARGB color palette entries.public ColorPalette(Color[] entries, boolean isCompactPalette)
Initializes a new instance of the ColorPalette class.
entries - The color palette entries.isCompactPalette - Indicating whether compact it palette.public ColorPalette(Color[] entries)
Initializes a new instance of the ColorPalette class and IsCompactPalette is false.
entries - The color palette entries.public int getEntriesCount()
Gets the entries count.
getEntriesCount in interface IColorPalettepublic int[] getArgb32Entries()
Gets an array of 32-bit ARGB structures.
getArgb32Entries in interface IColorPaletteColorPalette.public Color[] getEntries()
Gets an array of com.aspose.imaging.Color structures.
getEntries in interface IColorPaletteColor structures that make up this ColorPalette.public boolean isCompactPalette()
Gets or sets a value indicating whether compact palette is used.
isCompactPalette in interface IColorPalettetrue if compact palette is used; otherwise, false.Compact palette means that image will contain only the specified palette entries if possible or in other words the image will be more compact and occupy less space; otherwise there will be 2^BitsPerPixel entries and image will reserve more space for all possible palette entries. Setting this value to true and changing palette entries may cause performance penalty since data movement may occur so use it carefully.
public static ColorPalette copyPalette(IColorPalette colorPalette, boolean useCompactPalette)
Copies the palette.
colorPalette - The color palette.useCompactPalette - Indicating whether compact palette.public static ColorPalette copyPalette(IColorPalette colorPalette)
Copies the palette.
colorPalette - The color palette.public int getNearestColorIndex(int argb32Color)
Gets the index of the nearest color.
getNearestColorIndex in interface IColorPaletteargb32Color - The 32-bit ARGB color.public int getNearestColorIndex(Color color)
Gets the index of the nearest color.
getNearestColorIndex in interface IColorPalettecolor - The color.public int getArgb32Color(int index)
Gets the 32-bit ARGB palette color by index.
getArgb32Color in interface IColorPaletteindex - The 32-bit ARGB palette color index.index.com.aspose.ms.System.ArgumentOutOfRangeException - if color palette index specified is out of the palette entries range.public Color getColor(int index)
Gets the palette color by index.
getColor in interface IColorPaletteindex - The palette color index.index.com.aspose.ms.System.ArgumentOutOfRangeException - if color palette index specified is out of the palette entries range.Copyright (c) 2008-2022 Aspose Pty Ltd. All Rights Reserved.