Package uk.ac.starlink.ttools.plot
Class Fogger
java.lang.Object
uk.ac.starlink.ttools.plot.Fogger
Defines how colours are changed at different depths (distances away from
the viewer) by interposing a 'fog' which makes the colours gloomier the
further away you go.
Various methods are provided to fog colours at a given Z coordinate.
For reasonable rendering, z
should be greater than
or equal to zero, and of order of this renderer's scale distance.
Instances of this class are not thread safe.
The fogging algorithm comes from Eric Dumont's fog FAQ.
- Since:
- 18 Jan 2006
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionFogger
(double scale) Constructs a new depth tweaker for rendering distances of the order of a given scale. -
Method Summary
Modifier and TypeMethodDescriptioncreateTweaker
(int ifog, int ncoord) Constructs a DataColorTweaker corresponding to this fogger which just takes care of fogging.createTweaker
(int ifog, DataColorTweaker base) Constructs a DataColorTweaker based on an existing one which appends the affect of this fogger.void
fogAt
(double z, float[] rgba) Returns a fogged version of a given colour at a given depth using normalised components.int
fogAt
(double z, int argb) Returns a fogged version of a given colour at a given depth.void
fogAt
(double z, int[] rgba) Returns a fogged version of a given colour at a given depth.Returns a fogged version of a given colour at a given depth.double
Returns the thickness of the fog.double
getScale()
Returns the depth scale distance.void
setFogginess
(double fogginess) Sets the thickness of the fog.
-
Constructor Details
-
Fogger
public Fogger(double scale) Constructs a new depth tweaker for rendering distances of the order of a given scale.- Parameters:
scale
- depth scale distance
-
-
Method Details
-
getScale
public double getScale()Returns the depth scale distance.- Returns:
- depth scale distance
-
setFogginess
public void setFogginess(double fogginess) Sets the thickness of the fog. A given value of fogginess corresponds to a given amount of obscuration of a mark at a depth of the given multiple of the scale distance. Default value is zero (no fog).- Parameters:
fogginess
- intensity of fog per scale distance
-
getFogginess
public double getFogginess()Returns the thickness of the fog.- Returns:
- intensity of fog per scale distance
-
fogAt
Returns a fogged version of a given colour at a given depth.- Parameters:
z
- distance at which the colour is being viewedcolor
- original colour- Returns:
- fogged colour
-
fogAt
public void fogAt(double z, int[] rgba) Returns a fogged version of a given colour at a given depth.- Parameters:
z
- distance at which the colour is being viewedrgba
- rgba colour components; these will be modified on exit to represent the fogged value
-
fogAt
public void fogAt(double z, float[] rgba) Returns a fogged version of a given colour at a given depth using normalised components.- Parameters:
z
- distance at which the colour is being viewedrgba
- normalised rgba colour components; these will be modified on exit to represent the fogged value
-
fogAt
public int fogAt(double z, int argb) Returns a fogged version of a given colour at a given depth.- Parameters:
z
- distance at which the colour is being viewed- Returns:
- argb packed colour value for the fogged colour
-
createTweaker
Constructs a DataColorTweaker corresponding to this fogger which just takes care of fogging.- Parameters:
ifog
- index in coordinate array of Z coordinatencoord
- size of coordinate array
-
createTweaker
Constructs a DataColorTweaker based on an existing one which appends the affect of this fogger.- Parameters:
ifog
- index in coordinate array of Z coordinatebase
- color tweaker to be additionally fogged
-