public class Shaders extends Object
Shader
interface.
Many other lookup tables are available.
See for instance
http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml.
The utility class LutSteal
is available to help turn these into
lut files that can be used here.
Modifier and Type | Field and Description |
---|---|
static Shader |
BLACK_WHITE
Interpolates between black (0) and white (1).
|
static Shader |
BREWER_BRBG
ColorBrewer diverging brown-blue-green shader.
|
static Shader |
BREWER_BUGN
ColorBrewer sequential blue-green shader.
|
static Shader |
BREWER_BUPU
ColorBrewer sequential blue-purple shader.
|
static Shader |
BREWER_ORRD
ColorBrewer sequential orange-red shader.
|
static Shader |
BREWER_PIYG
ColorBrewer diverging pink-green shader.
|
static Shader |
BREWER_PUBU
ColorBrewer sequential purple-blue shader.
|
static Shader |
BREWER_PURD
ColorBrewer sequential purple-red shader.
|
static Shader |
BREWER_RDBU
ColorBrewer diverging red-blue shader.
|
static Shader |
CUBEHELIX
Standard cubehelix shader.
|
static Shader |
CUBEHELIX2
Enhanced hue cubehelix shader.
|
static Shader |
CUBEHELIX3
Lurid cubehelix shader.
|
static Shader |
CYAN_MAGENTA
Interpolates between cyan (0) and magenta (1).
|
static Shader |
DFLT_GRID_SHADER
Shader used by default for the transverse axis of non-absolute ramps.
|
static Shader |
FADE_BLACK
Shader which interpolates between the base colour and black.
|
static Shader |
FADE_WHITE
Shader which interpolates between the base colour and white.
|
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 |
HCL_POLAR
Hue-chroma-luminance cyclic shader.
|
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_ACCENT
Shader based on lookup table Accent.
|
static Shader |
LUT_AIPS0
Shader based on lookup table Aips0.
|
static Shader |
LUT_BACKGR
Shader based on lookup table Backgr.
|
static Shader |
LUT_BRG
Shader copied from Matplotlib BRG lookup table.
|
static Shader |
LUT_BUBBLEGUM
Bubblegum sequential shader from CMasher.
|
static Shader |
LUT_CHROMA
Chroma sequential shader from CMasher.
|
static Shader |
LUT_CIVIDIS
Cividis shader derived from DOI:10.1371/journal.pone.0199239.
|
static Shader |
LUT_COLD
Shader based on lookup table Cold.
|
static Shader |
LUT_COLOR
Shader based on lookup table Color.
|
static Shader |
LUT_COSMIC
Cosmic sequential shader from CMasher.
|
static Shader |
LUT_EMBER
Ember sequential shader from CMasher.
|
static Shader |
LUT_GEM
Gem sequential shader from CMasher.
|
static Shader |
LUT_GLNEMO2
Shader copied from glNemo2 application.
|
static Shader |
LUT_GNUPLOT
Shader copied from Matplotlib Gnuplot lookup table.
|
static Shader |
LUT_GNUPLOT2
Shader copied from Matplotlib Gnuplot2 lookup table.
|
static Shader |
LUT_GOTHIC
Gothic sequential shader from CMasher.
|
static Shader |
LUT_GUPPY
Guppy diverging shader from CMasher.
|
static Shader |
LUT_HEAT
Shader based on lookup table Heat.
|
static Shader |
LUT_HOTCOLD
Diverging hot-cold shader provided by Daniel Michalik.
|
static Shader |
LUT_ICEBURN
Iceburn diverging shader from CMasher.
|
static Shader |
LUT_IDL2
Shader based on lookup table IDL2.
|
static Shader |
LUT_IDL4
Shader based on lookup table IDL4.
|
static Shader |
LUT_INFINITY
Infinity cyclic shader from CMasher.
|
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_MPL2INFERNO
Shader copied from Matplotlib 2.0 Inferno lookup table.
|
static Shader |
LUT_MPL2MAGMA
Shader copied from Matplotlib 2.0 Magma lookup table.
|
static Shader |
LUT_MPL2PLASMA
Shader copied from Matplotlib 2.0 Plasma lookup table.
|
static Shader |
LUT_MPL2VIRIDIS
Shader copied from Matplotlib 2.0 Viridis lookup table.
|
static Shader |
LUT_NEON
Neon sequential shader from CMasher.
|
static Shader |
LUT_PAINBOW
Painbow shader scraped from https://xkcd.com/2537/.
|
static Shader |
LUT_PAIRED
Shader copied from Matplotlib Paired lookup table.
|
static Shader |
LUT_PASTEL
Shader based on lookup table Pastel.
|
static Shader |
LUT_PRIDE
Pride diverging shader from CMasher.
|
static Shader |
LUT_RAINBOW
Shader based on lookup table Rainbow.
|
static Shader |
LUT_RAINBOW3
Shader copied from Matplotlib gist_rainbow lookup table.
|
static Shader |
LUT_RAINFOREST
Rainforest sequential shader from CMasher.
|
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_REDSHIFT
Redshift diverging shader from CMasher.
|
static Shader |
LUT_SET1
Shader copied from Matplotlib Set1 lookup table.
|
static Shader[] |
LUT_SHADERS
Selection of lookup table-based shaders.
|
static Shader |
LUT_SMOOTH
Shader based on lookup table Smooth.
|
static Shader |
LUT_SPECXB2Y
Shader copied from SPECX blue2yellow lookup table.
|
static Shader |
LUT_STAIRCASE
Shader based on lookup table Staircase.
|
static Shader |
LUT_STANDARD
Shader based on lookup table Standard.
|
static Shader |
LUT_TROPICAL
Tropical sequential shader from CMasher.
|
static Shader |
LUT_VOLTAGE
Voltage sequential shader from CMasher.
|
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_H
Scales H in HSV colour space.
|
static Shader |
SCALE_INTENSITY
Shader which scales intensity.
|
static Shader |
SCALE_RED
Scales red level by parameter value.
|
static Shader |
SCALE_S
Scales S in HSV colour space.
|
static Shader |
SCALE_V
Scales V in HSV colour space.
|
static Shader |
SCALE_Y
Scales Y in YUV colour space.
|
static Shader |
SRON_RAINBOW
Rainbow shader copied from SRON technical note SRON/EPS/TN/09-002.
|
static Shader |
SUNSET
Rachel did this one.
|
static Shader |
TRANSPARENCY
Scales alpha channel by parameter value.
|
static Shader |
WHITE_BLACK
Interpolates between white (0) and black (1).
|
Constructor and Description |
---|
Shaders() |
Modifier and Type | Method and Description |
---|---|
static Shader |
applyShader(Shader shader,
Color baseColor,
int nsample)
Creates a shader by applying an existing shader to a given base colour.
|
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[] colors)
Constructs a shader which interpolates between a sequence of colours.
|
static Shader |
createInterpolationShader(String name,
Color color0,
Color color1)
Constructs a shader which interpolates smoothly between two colours.
|
static Shader |
createMaskShader(String name,
float minMask,
float maxMask,
boolean sense)
Creates a shader which for each value either does nothing to a colour
or turns it completely transparent.
|
static Icon |
createShaderIcon(Shader shader,
boolean horizontal,
int width,
int height,
int xpad,
int ypad)
Returns an icon which displays a shader in action,
using a default grid shader if required.
|
static Icon |
createShaderIcon(Shader shader,
Shader gridShader,
boolean horizontal,
int width,
int height,
int xpad,
int ypad)
Returns an icon which displays a shader in action,
using an explicitly provided grid shader.
|
static Shader |
fade(Shader shader,
float scaleAlpha)
Returns a shader which scales the alpha value of all its colours
by a given constant.
|
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).
|
static Shader |
quantise(Shader shader,
double nlevel)
Returns a shader which splits the colour map into a set of
discrete levels.
|
static Shader |
rename(Shader shader,
String name)
Returns a shader which delegates all behaviour to a supplied base
instance, except it has a given name.
|
static Shader |
stretch(Shader shader,
float frac0,
float frac1)
Returns a shader which corresponds to a sub-range of a given shader.
|
public static final String LUTFILES_PROPERTY
getCustomShaders()
,
Constant Field Valuespublic static final Shader FIX_RED
public static final Shader FIX_GREEN
public static final Shader FIX_BLUE
public static final Shader SCALE_RED
public static final Shader SCALE_GREEN
public static final Shader SCALE_BLUE
public static final Shader FIX_Y
public static final Shader FIX_U
public static final Shader FIX_V
public static final Shader SCALE_Y
public static final Shader HSV_H
public static final Shader HSV_S
public static final Shader HSV_V
public static final Shader SCALE_H
public static final Shader SCALE_S
public static final Shader SCALE_V
public static final Shader RED_BLUE
public static final Shader CYAN_MAGENTA
public static final Shader WHITE_BLACK
public static final Shader BLACK_WHITE
public static final Shader SUNSET
public static final Shader SRON_RAINBOW
public static final Shader CUBEHELIX
public static final Shader CUBEHELIX2
public static final Shader CUBEHELIX3
public static final Shader LUT_AIPS0
public static final Shader LUT_BACKGR
public static final Shader LUT_COLOR
public static final Shader LUT_HEAT
public static final Shader LUT_IDL2
public static final Shader LUT_IDL4
public static final Shader LUT_ISOPHOT
public static final Shader LUT_LIGHT
public static final Shader LUT_MANYCOL
public static final Shader LUT_PASTEL
public static final Shader LUT_RAINBOW
public static final Shader LUT_RAMP
public static final Shader LUT_RANDOM
public static final Shader LUT_REAL
public static final Shader LUT_SMOOTH
public static final Shader LUT_STAIRCASE
public static final Shader LUT_STANDARD
public static final Shader LUT_ACCENT
public static final Shader LUT_COLD
public static final Shader LUT_GLNEMO2
public static final Shader LUT_GNUPLOT
public static final Shader LUT_GNUPLOT2
public static final Shader LUT_SPECXB2Y
public static final Shader LUT_BRG
public static final Shader LUT_PAIRED
public static final Shader LUT_RAINBOW3
public static final Shader LUT_SET1
public static final Shader LUT_MPL2MAGMA
public static final Shader LUT_MPL2INFERNO
public static final Shader LUT_MPL2PLASMA
public static final Shader LUT_MPL2VIRIDIS
public static final Shader LUT_HOTCOLD
public static final Shader LUT_CIVIDIS
public static final Shader LUT_PAINBOW
public static final Shader LUT_GUPPY
public static final Shader LUT_ICEBURN
public static final Shader LUT_REDSHIFT
public static final Shader LUT_PRIDE
public static final Shader LUT_INFINITY
public static final Shader LUT_COSMIC
public static final Shader LUT_EMBER
public static final Shader LUT_GOTHIC
public static final Shader LUT_RAINFOREST
public static final Shader LUT_VOLTAGE
public static final Shader LUT_BUBBLEGUM
public static final Shader LUT_GEM
public static final Shader LUT_CHROMA
public static final Shader LUT_NEON
public static final Shader LUT_TROPICAL
public static final Shader[] LUT_SHADERS
public static final Shader BREWER_BUGN
public static final Shader BREWER_BUPU
public static final Shader BREWER_ORRD
public static final Shader BREWER_PUBU
public static final Shader BREWER_PURD
public static final Shader BREWER_RDBU
public static final Shader BREWER_PIYG
public static final Shader BREWER_BRBG
public static final Shader HCL_POLAR
public static final Shader DFLT_GRID_SHADER
public static final Shader NULL
public static final Shader TRANSPARENCY
public static final Shader FIX_INTENSITY
public static final Shader SCALE_INTENSITY
public static final Shader FADE_BLACK
public static final Shader FADE_WHITE
public static final Shader FIX_HUE
public static Shader createInterpolationShader(String name, Color color0, Color color1)
name
- namecolor0
- colour corresponding to parameter value 0color1
- colour corresponding to parameter value 1public static Shader createInterpolationShader(String name, Color[] colors)
name
- namecolors
- sequence of colours; value 0 corresponds to the
first colour and value 1 corresponds to the lastpublic static Shader createFixedShader(String name, Color color)
name
- shader namecolor
- fixed output colourpublic static Shader createMaskShader(String name, float minMask, float maxMask, boolean sense)
name
- shader nameminMask
- minimum value (exclusive) for rangemaxMask
- maximum value (exclusive) for rangesense
- if true, values outside the range are transparent,
if false, values within the range are transparentpublic static Shader[] getCustomShaders()
LUTFILES_PROPERTY
property.public static Shader invert(Shader shader)
shader
- base shaderpublic static Shader fade(Shader shader, float scaleAlpha)
shader
- input shaderscaleAlpha
- alpha scaling factor, in range 0..1scaleAlpha
==1public static Shader rename(Shader shader, String name)
shader
- base shadername
- new namepublic static Shader stretch(Shader shader, float frac0, float frac1)
shader
- base shaderfrac0
- parameter value in base shader corresponding to
value 0 in this one (must be in range 0-1)frac1
- parameter value in base shader corresponding to
value 1 in this one (must be in range 0-1)public static Shader quantise(Shader shader, double nlevel)
shader
- base shadernlevel
- number of discrete colour levels requiredpublic static Shader applyShader(Shader shader, Color baseColor, int nsample)
shader
- shader to apply (presumably non-absolute)baseColor
- colour to which the shader will be appliednsample
- number of samples in the lookup tablepublic static Icon create2dIcon(Shader xShader, Shader yShader, boolean xFirst, Color baseColor, int width, int height, int xpad, int ypad)
xShader
- shader for X directionyShader
- shader for Y directionxFirst
- true if X shader is to be applied firstbaseColor
- base colour for the shaders to work onwidth
- total width of the iconheight
- total height of the iconxpad
- internal padding in the X directionypad
- internal padding in the Y directionpublic static Icon createShaderIcon(Shader shader, Shader gridShader, boolean horizontal, int width, int height, int xpad, int ypad)
shader
- shader to illustrategridShader
- defines the pixels along the transverse direction
of the shader; ignored (may be null) for absolute
shadershorizontal
- true for shading running horizontally,
false for verticallywidth
- total icon width in pixelsheight
- total icon height in pixelsxpad
- internal padding in the X directionypad
- internal padding in the Y directionpublic static Icon createShaderIcon(Shader shader, boolean horizontal, int width, int height, int xpad, int ypad)
shader
- shader to illustratehorizontal
- true for shading running horizontally,
false for verticallywidth
- total icon width in pixelsheight
- total icon height in pixelsxpad
- internal padding in the X directionypad
- internal padding in the Y directionpublic static boolean isTransparent(Shader shader)
shader
- shader to testCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.