uk.ac.starlink.ttools.plot
Class Shaders

java.lang.Object
  extended by uk.ac.starlink.ttools.plot.Shaders

public class Shaders
extends Object

Provides some implementations of the Shader interface.

Since:
5 Jun 2007
Author:
Mark Taylor

Field Summary
static Shader BLACK_WHITE
          Interpolates between black (0) and white (1).
static Shader FIX_BLUE
          Fixes blue level at parameter value.
static Shader FIX_GREEN
          Fixes green level at parameter value.
static Shader FIX_HUE
          Shader which fixes hue.
static Shader FIX_INTENSITY
          Shader which sets intensity.
static Shader FIX_RED
          Fixes red level at parameter value.
static Shader FIX_U
          Fixes U in YUV colour space.
static Shader FIX_V
          Fixes V in YUV colour space.
static Shader FIX_Y
          Fixes Y in YUV colour space.
static Shader HSV_H
          Fixes H in HSV colour space.
static Shader HSV_S
          Fixes S in HSV colour space.
static Shader HSV_V
          Fixes V in HSV colour space.
static Shader LUT_AIPS0
          Shader based on lookup table Aips0.
static Shader LUT_BACKGR
          Shader based on lookup table Backgr.
static Shader LUT_COLOR
          Shader based on lookup table Color.
static Shader LUT_HEAT
          Shader based on lookup table Heat.
static Shader LUT_IDL2
          Shader based on lookup table IDL2.
static Shader LUT_IDL4
          Shader based on lookup table IDL4.
static Shader LUT_ISOPHOT
          Shader based on lookup table Isophot.
static Shader LUT_LIGHT
          Shader based on lookup table Light.
static Shader LUT_MANYCOL
          Shader based on lookup table Manycol.
static Shader LUT_PASTEL
          Shader based on lookup table Pastel.
static Shader LUT_RAINBOW
          Shader based on lookup table Rainbow.
static Shader LUT_RAMP
          Shader based on lookup table Ramp.
static Shader LUT_RANDOM
          Shader based on lookup table Random.
static Shader LUT_REAL
          Shader based on lookup table Real.
static Shader[] LUT_SHADERS
          Selection of lookup table-based shaders.
static Shader LUT_SMOOTH
          Shader based on lookup table Smooth.
static Shader LUT_STAIRCASE
          Shader based on lookup table Staircase.
static Shader LUT_STANDARD
          Shader based on lookup table Standard.
static String LUTFILES_PROPERTY
          Property containing a File.pathSeparator-separated list of text files containing custom lookup tables.
static Shader NULL
          Shader which does nothing.
static Shader RED_BLUE
          Interpolates between red (0) and blue (1).
static Shader SCALE_BLUE
          Scales blue level by parameter value.
static Shader SCALE_GREEN
          Scales green level by parameter value.
static Shader SCALE_INTENSITY
          Shader which scales intensity.
static Shader SCALE_RED
          Scales red level by parameter value.
static Shader TRANSPARENCY
          Scales alpha channel by parameter value.
static Shader WHITE_BLACK
          Interpolates between white (0) and black (1).
 
Constructor Summary
Shaders()
           
 
Method Summary
static Icon create2dIcon(Shader xShader, Shader yShader, boolean xFirst, Color baseColor, int width, int height, int xpad, int ypad)
          Constructs an icon which represents two shaders in two dimensions.
static Shader createFixedShader(String name, Color color)
          Creates a shader which always returns a fixed colour regardless of the supplied parameter.
static Shader createInterpolationShader(String name, Color color0, Color color1)
          Constructs a shader which interpolates smoothly between two colours.
static Shader[] getCustomShaders()
          Returns an array of any custom shaders specified by the LUTFILES_PROPERTY property.
static Shader invert(Shader shader)
          Returns a shader which runs in the opposite direction to a given one.
static boolean isTransparent(Shader shader)
          Indicates whether the given shader object is capable of introducing transparency into a colour (modifying rgba[3] from 1 to a lower value).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LUTFILES_PROPERTY

public static final String LUTFILES_PROPERTY
Property containing a File.pathSeparator-separated list of text files containing custom lookup tables. Each line should contain three space-separated floating point values between zero and one giving the Red, Green and Blue components of a colour.

See Also:
getCustomShaders(), Constant Field Values

FIX_RED

public static final Shader FIX_RED
Fixes red level at parameter value.


FIX_GREEN

public static final Shader FIX_GREEN
Fixes green level at parameter value.


FIX_BLUE

public static final Shader FIX_BLUE
Fixes blue level at parameter value.


SCALE_RED

public static final Shader SCALE_RED
Scales red level by parameter value.


SCALE_GREEN

public static final Shader SCALE_GREEN
Scales green level by parameter value.


SCALE_BLUE

public static final Shader SCALE_BLUE
Scales blue level by parameter value.


FIX_Y

public static final Shader FIX_Y
Fixes Y in YUV colour space.


FIX_U

public static final Shader FIX_U
Fixes U in YUV colour space.


FIX_V

public static final Shader FIX_V
Fixes V in YUV colour space.


HSV_H

public static final Shader HSV_H
Fixes H in HSV colour space.


HSV_S

public static final Shader HSV_S
Fixes S in HSV colour space.


HSV_V

public static final Shader HSV_V
Fixes V in HSV colour space.


RED_BLUE

public static final Shader RED_BLUE
Interpolates between red (0) and blue (1).


WHITE_BLACK

public static final Shader WHITE_BLACK
Interpolates between white (0) and black (1).


BLACK_WHITE

public static final Shader BLACK_WHITE
Interpolates between black (0) and white (1).


LUT_AIPS0

public static final Shader LUT_AIPS0
Shader based on lookup table Aips0.


LUT_BACKGR

public static final Shader LUT_BACKGR
Shader based on lookup table Backgr.


LUT_COLOR

public static final Shader LUT_COLOR
Shader based on lookup table Color.


LUT_HEAT

public static final Shader LUT_HEAT
Shader based on lookup table Heat.


LUT_IDL2

public static final Shader LUT_IDL2
Shader based on lookup table IDL2.


LUT_IDL4

public static final Shader LUT_IDL4
Shader based on lookup table IDL4.


LUT_ISOPHOT

public static final Shader LUT_ISOPHOT
Shader based on lookup table Isophot.


LUT_LIGHT

public static final Shader LUT_LIGHT
Shader based on lookup table Light.


LUT_MANYCOL

public static final Shader LUT_MANYCOL
Shader based on lookup table Manycol.


LUT_PASTEL

public static final Shader LUT_PASTEL
Shader based on lookup table Pastel.


LUT_RAINBOW

public static final Shader LUT_RAINBOW
Shader based on lookup table Rainbow.


LUT_RAMP

public static final Shader LUT_RAMP
Shader based on lookup table Ramp.


LUT_RANDOM

public static final Shader LUT_RANDOM
Shader based on lookup table Random.


LUT_REAL

public static final Shader LUT_REAL
Shader based on lookup table Real.


LUT_SMOOTH

public static final Shader LUT_SMOOTH
Shader based on lookup table Smooth.


LUT_STAIRCASE

public static final Shader LUT_STAIRCASE
Shader based on lookup table Staircase.


LUT_STANDARD

public static final Shader LUT_STANDARD
Shader based on lookup table Standard.


LUT_SHADERS

public static final Shader[] LUT_SHADERS
Selection of lookup table-based shaders.


NULL

public static final Shader NULL
Shader which does nothing.


TRANSPARENCY

public static final Shader TRANSPARENCY
Scales alpha channel by parameter value.


FIX_INTENSITY

public static final Shader FIX_INTENSITY
Shader which sets intensity.


SCALE_INTENSITY

public static final Shader SCALE_INTENSITY
Shader which scales intensity.


FIX_HUE

public static final Shader FIX_HUE
Shader which fixes hue.

Constructor Detail

Shaders

public Shaders()
Method Detail

createInterpolationShader

public static Shader createInterpolationShader(String name,
                                               Color color0,
                                               Color color1)
Constructs a shader which interpolates smoothly between two colours.

Parameters:
name - name
color0 - colour corresponding to parameter value 0
color1 - colour corresponding to parameter value 1

createFixedShader

public static Shader createFixedShader(String name,
                                       Color color)
Creates a shader which always returns a fixed colour regardless of the supplied parameter.

Parameters:
name - shader name
color - fixed output colour
Returns:
fixed colour shader

getCustomShaders

public static Shader[] getCustomShaders()
Returns an array of any custom shaders specified by the LUTFILES_PROPERTY property.

Returns:
array of zero or more custom shaders

invert

public static Shader invert(Shader shader)
Returns a shader which runs in the opposite direction to a given one.

Parameters:
shader - base shader
Returns:
inverted version

create2dIcon

public static Icon create2dIcon(Shader xShader,
                                Shader yShader,
                                boolean xFirst,
                                Color baseColor,
                                int width,
                                int height,
                                int xpad,
                                int ypad)
Constructs an icon which represents two shaders in two dimensions.

Parameters:
xShader - shader for X direction
yShader - shader for Y direction
xFirst - true if X shader is to be applied first
baseColor - base colour for the shaders to work on
width - total width of the icon
height - total height of the icon
xpad - internal padding in the X direction
ypad - internal padding in the Y direction
Returns:
icon

isTransparent

public static boolean isTransparent(Shader shader)
Indicates whether the given shader object is capable of introducing transparency into a colour (modifying rgba[3] from 1 to a lower value).

Parameters:
shader - shader to test
Returns:
true if shader adjusts transparency or is null


Copyright © 2009 Central Laboratory of the Research Councils. All Rights Reserved.