|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpslib.PSColourMap
public class PSColourMap
PSColourMap Class
The PSColourMap object permits the generation of colour maps derived from either image scripts or stored values. Once generated, the resultant map may be output as a two-dimensional PSColour array, a WeightedList array. Individual layers may also be output as either a PSColour array or WeightedList.
This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.
Constructor Summary | |
---|---|
PSColourMap()
Create a new object instance |
Method Summary | |
---|---|
boolean |
generateFromScript(java.lang.String f)
Generate the colour map from the specified script. |
int |
layers()
Return the amount of layers within the stored map |
boolean |
read(java.lang.String f)
Generate the colour map from the specified file |
void |
setMap(PSColour[][] m)
Copy the values of the specified map into this object |
void |
setWeights(int[][] w)
Set the weights for the stored colour map |
int |
size(int i)
Return the size of the specified map layer |
PSColour[][] |
toArray()
Return the map stored in this object as a two-dimensional PSColour array |
PSColour[] |
toArray(int i)
Return the specified layer of the map stored in this object as a PSColour array |
WeightedList<PSColour>[] |
toWeightedList()
Return the map stored in this object as a WeightedList array |
WeightedList<PSColour> |
toWeightedList(int i)
Return the specified layer of the map stored in this object as a WeightedList object |
boolean |
write(java.lang.String f)
Write the map stored in this object to file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PSColourMap()
Method Detail |
---|
public final boolean generateFromScript(java.lang.String f)
Script lines should be in the format: layer#[index]=[file],[values]
f
- script file
public final boolean read(java.lang.String f)
File lines should be in the format: layer#[index]=[red],[green],[blue],[alpha] or weight#[index]=[v1],[v2], ... [vn]
f
- colour map file
public final boolean write(java.lang.String f)
The output format of the file matches that of the input format specified by read().
f
- file
public final void setMap(PSColour[][] m)
The map stored within this object will be resized to match the input.
m
- colour mappublic final void setWeights(int[][] w)
The weight values are stored within the WeightedList output and dictate the likelihood of value selection.
If the specified array does not match the dimensions of the stored map, this will be reflected in the output file. Such invariances will however be corrected prior to WeightedList output.
w
- weightspublic final PSColour[][] toArray()
If the map stored in this object is empty then a null value will be returned. If any layers within the map are empty or null then the returned array will contain null entries.
public final PSColour[] toArray(int i)
If the map stored in this object is empty or the specified index is invalid then a null value will be returned.
i
- layer index
public final WeightedList<PSColour>[] toWeightedList()
The output WeightedList array stores all PSColour values alongside their respective weightings.
If the map stored in this object is empty then a null value will be returned. If any layers within the map are empty or null then the returned array will contain null entries.
public final WeightedList<PSColour> toWeightedList(int i)
The output WeightedList object stores all of the layer PSColour values alongside their respective weightings.
If the map stored in this object is empty or the specified index is invalid then a null value will be returned.
i
- layer index
public final int layers()
A value of -1 will be returned if the stored map is empty
public final int size(int i)
A value of -1 will be returned if the stored map is empty, the specified index is invalid, or the specified layer is empty.
i
- layer index
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |