|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.image.io.PaletteFactory
A factory class for IndexColorModel
objects.
Default implementation for this class create IndexColorModel
objects from
palette definition files. Definition files are text files containing an arbitrary
number of lines, each line containing RGB components ranging from 0 to 255 inclusive.
Empty line and line starting with '#' are ignored. Example:
The number of RGB codes doesn't have to match an# RGB codes for SeaWiFs images # (chlorophylle-a concentration) 033 000 096 032 000 097 031 000 099 030 000 101 029 000 102 028 000 104 026 000 106 025 000 107 etc...
IndexColorModel
's
map size. RGB codes will be automatically interpolated RGB values when needed.
Constructor Summary | |
PaletteFactory(PaletteFactory parent,
java.lang.Class loader,
java.io.File directory,
java.lang.String extension,
java.nio.charset.Charset charset,
java.util.Locale locale)
Constructs a palette factory using an optional class for loading palette definition files. |
|
PaletteFactory(PaletteFactory parent,
java.lang.ClassLoader loader,
java.io.File directory,
java.lang.String extension,
java.nio.charset.Charset charset,
java.util.Locale locale)
Constructs a palette factory using an optional class loader for loading palette definition files. |
Method Summary | |
java.lang.String[] |
getAvailableNames()
Returns the list of available palette names. |
java.awt.Color[] |
getColors(java.lang.String name)
Load colors from a definition file. |
java.awt.Color[] |
getColors(java.net.URL url)
Load colors from an URL. |
java.awt.image.IndexColorModel |
getIndexColorModel(java.lang.String name)
Load an index color model from a definition file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PaletteFactory(PaletteFactory parent, java.lang.ClassLoader loader, java.io.File directory, java.lang.String extension, java.nio.charset.Charset charset, java.util.Locale locale)
parent
- An optional parent factory, or if there is none. The parent
factory will be queried if a palette was not found in the current factory.loader
- An optional class loader to use for loading the palette definition files.
If , loading will occurs from the system current working
directory.directory
- The base directory for palette definition files. It may be a Java package
if a were specified. If , then is
assumed.extension
- File name extension, or if there is no extension
to add to filename. If non-null, this extension will be automatically
appended to filename. It should starts with the character.charset
- The charset to use for parsing files, or for the default.locale
- The locale to use for parsing files. or for the default.public PaletteFactory(PaletteFactory parent, java.lang.Class loader, java.io.File directory, java.lang.String extension, java.nio.charset.Charset charset, java.util.Locale locale)
parent
- An optional parent factory, or if there is none. The parent
factory will be queried if a palette was not found in the current factory.loader
- An optional class to use for loading the palette definition files.
If , loading will occurs from the system current working
directory.directory
- The base directory for palette definition files. It may be a Java package
if a were specified. If , then is
assumed.extension
- File name extension, or if there is no extension
to add to filename. If non-null, this extension will be automatically
appended to filename. It should starts with the character.charset
- The charset to use for parsing files, or for the default.locale
- The locale to use for parsing files. or for the default.Method Detail |
public java.lang.String[] getAvailableNames()
getColors(String)
or getIndexColorModel(String)
methods.
public java.awt.Color[] getColors(java.lang.String name) throws java.io.IOException
name
- The palette's name to load. This name doesn't need to contains a path
or an extension. Path and extension are set according value specified
at construction time.
java.io.IOException
- if an error occurs during reading.
javax.imageio.IIOException
- if an error occurs during parsing.public java.awt.Color[] getColors(java.net.URL url) throws java.io.IOException
url
- The palette's URL.
java.io.IOException
- if an error occurs during reading.
javax.imageio.IIOException
- if an error occurs during parsing.public java.awt.image.IndexColorModel getIndexColorModel(java.lang.String name) throws java.io.IOException
name
- The palette's name to load. This name doesn't need to contains a path
or an extension. Path and extension are set according value specified
at construction time.
java.io.IOException
- if an error occurs during reading.
javax.imageio.IIOException
- if an error occurs during parsing.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |