Package uk.ac.starlink.ttools.plot
Class ShaderTweaker
java.lang.Object
uk.ac.starlink.ttools.plot.ShaderTweaker
- All Implemented Interfaces:
ColorTweaker
,DataColorTweaker
DataColorTweaker implementation which uses an array of Shader objects.
- Since:
- 5 Jun 2007
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionShaderTweaker
(int ioff, Shader[] shaders, double[][] ranges, boolean[] logFlags, boolean[] flipFlags) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic ShaderTweaker
createTweaker
(int ioff, PlotState state) Returns a new tweaker suitable for a given plot.int
Returns the size of coordinate array which should be submitted toDataColorTweaker.setCoords(double[])
.boolean
setCoords
(double[] coords) This implementation returns true unless the scaler results in a NaN for any of the coordinates.void
tweakColor
(float[] rgba) Adjusts in place an array representing the sRGB components of a colour.tweakColor
(Color orig) Returns a tweaked version of the submitted colour.
-
Constructor Details
-
ShaderTweaker
public ShaderTweaker(int ioff, Shader[] shaders, double[][] ranges, boolean[] logFlags, boolean[] flipFlags) Constructor.- Parameters:
ioff
- offset into supplied coordinate arrays at which auxiliary data startsshaders
- array of shaders, one for each aux axisranges
- array of (low,high) range bounds, one for each aux axislogFlags
- array of logarithmic scaling flags, one for each aux axisflipFlags
- array of axis inversion flags, one for each aux axis
-
-
Method Details
-
getNcoord
public int getNcoord()Description copied from interface:DataColorTweaker
Returns the size of coordinate array which should be submitted toDataColorTweaker.setCoords(double[])
.- Specified by:
getNcoord
in interfaceDataColorTweaker
- Returns:
- coordinate size array
-
setCoords
public boolean setCoords(double[] coords) This implementation returns true unless the scaler results in a NaN for any of the coordinates.- Specified by:
setCoords
in interfaceDataColorTweaker
- Parameters:
coords
- full coordinate array- Returns:
- true iff this object has been set to a usable state
-
tweakColor
public void tweakColor(float[] rgba) Description copied from interface:ColorTweaker
Adjusts in place an array representing the sRGB components of a colour. Each element is in the range 0..1 on both input and output.- Specified by:
tweakColor
in interfaceColorTweaker
- Parameters:
rgba
- red, green, blue, alpha array
-
tweakColor
Description copied from interface:ColorTweaker
Returns a tweaked version of the submitted colour.- Specified by:
tweakColor
in interfaceColorTweaker
- Parameters:
orig
- input colour- Returns:
- tweaked colour
-
createTweaker
Returns a new tweaker suitable for a given plot. Iff no colour tweaking will be performed (that is, if such an object would do no work) then null will be returned.- Parameters:
ioff
- offset into supplied coordinate arrays at which auxiliary data startsstate
- describes the plot for which this object will be used- Returns:
- new tweaker, or null
-