Package com.sixlegs.png
Interface SuggestedPalette
-
public interface SuggestedPaletteA suggested palette. Suggested palettes can be useful when the display device is not capable of displaying the full range of colors present in the image.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetFrequency(int index)Retrieve a sample frequency value.java.lang.StringgetName()Returns palette name.voidgetSample(int index, short[] pixel)Retrieve a sample value.intgetSampleCount()Returns the number of samples.intgetSampleDepth()Returns the sample depth.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns palette name. This is any convenient name for referring to the palette. The name will be unique across all suggested palettes in the same image.
-
getSampleCount
int getSampleCount()
Returns the number of samples.
-
getSampleDepth
int getSampleDepth()
Returns the sample depth. This specifies the width of each color and alpha component of each sample in this palette.- Returns:
- 8 or 16
-
getSample
void getSample(int index, short[] pixel)Retrieve a sample value. The red, green, blue, and alpha components of the sample at the given index are stored into the short array. Each component is of the depth specified bygetSampleDepth. The color samples are not premultiplied by alpha. An alpha value of 0 means fully transparent.- Parameters:
index- the sample indexpixel- the array in which to store the sample components- Throws:
java.lang.IndexOutOfBoundsException- if index < 0, index >=getSampleCount, orpixel.lengthis less than 4java.lang.NullPointerException- ifpixelis null
-
getFrequency
int getFrequency(int index)
Retrieve a sample frequency value. The frequency value is proportional to the fraction of pixels in the image that are closest to that palette entry in RGBA space. The range of individual values will reasonably fill 0 to 65535. Entries appear in decreasing order of frequency.- Parameters:
index- the sample index
-
-