# Class ShaderTweaker

java.lang.Object
uk.ac.starlink.ttools.plot.ShaderTweaker

All Implemented Interfaces:
  `ColorTweaker, DataColorTweaker`

public class ShaderTweaker extends 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

Modifier and Type
Method
Description
`static ShaderTweaker`
`createTweaker(int ioff, PlotState state)`
Returns a new tweaker suitable for a given plot.
`int`
`getNcoord()`
Returns the size of coordinate array which should be submitted to `DataColorTweaker.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.
`Color`
`tweakColor(Color orig)`
Returns a tweaked version of the submitted colour.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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 starts
  `shaders` - array of shaders, one for each aux axis
  `ranges` - array of (low,high) range bounds, one for each aux axis
  `logFlags` - array of logarithmic scaling flags, one for each aux axis
  `flipFlags` - 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 to `DataColorTweaker.setCoords(double[])`.

Specified by:
  `getNcoord` in interface `DataColorTweaker`
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 interface `DataColorTweaker`
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 interface `ColorTweaker`
Parameters:
  `rgba` - red, green, blue, alpha array

### tweakColor

public Color tweakColor(Color orig)
Description copied from interface: `ColorTweaker`
Returns a tweaked version of the submitted colour.

Specified by:
  `tweakColor` in interface `ColorTweaker`
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 starts
  `state` - describes the plot for which this object will be used
Returns:
  new tweaker, or null