Package uk.ac.starlink.ttools.plot
Class ShaderTweaker
- java.lang.Object
-
- uk.ac.starlink.ttools.plot.ShaderTweaker
-
- All Implemented Interfaces:
ColorTweaker,DataColorTweaker
public class ShaderTweaker extends java.lang.Object implements DataColorTweaker
DataColorTweaker implementation which uses an array of Shader objects.- Since:
- 5 Jun 2007
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description ShaderTweaker(int ioff, Shader[] shaders, double[][] ranges, boolean[] logFlags, boolean[] flipFlags)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ShaderTweakercreateTweaker(int ioff, PlotState state)Returns a new tweaker suitable for a given plot.intgetNcoord()Returns the size of coordinate array which should be submitted toDataColorTweaker.setCoords(double[]).booleansetCoords(double[] coords)This implementation returns true unless the scaler results in a NaN for any of the coordinates.voidtweakColor(float[] rgba)Adjusts in place an array representing the sRGB components of a colour.java.awt.ColortweakColor(java.awt.Color orig)Returns a tweaked version of the submitted colour.
-
-
-
Constructor Detail
-
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 Detail
-
getNcoord
public int getNcoord()
Description copied from interface:DataColorTweakerReturns the size of coordinate array which should be submitted toDataColorTweaker.setCoords(double[]).- Specified by:
getNcoordin 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:
setCoordsin 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:ColorTweakerAdjusts 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:
tweakColorin interfaceColorTweaker- Parameters:
rgba- red, green, blue, alpha array
-
tweakColor
public java.awt.Color tweakColor(java.awt.Color orig)
Description copied from interface:ColorTweakerReturns a tweaked version of the submitted colour.- Specified by:
tweakColorin interfaceColorTweaker- Parameters:
orig- input colour- Returns:
- tweaked colour
-
createTweaker
public static ShaderTweaker createTweaker(int ioff, PlotState state)
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
-
-