org.jmol.util
Class ColorEncoder

java.lang.Object
  extended by org.jmol.util.ColorEncoder

public class ColorEncoder
extends java.lang.Object


Field Summary
static int ALT
           
static int AMINO
           
private  int[] argbsAmino
           
private  int[] argbsCpk
           
private  int[] argbsRoygb
           
private  int[] argbsRwb
           
private  int[] argbsShapely
           
static int BGYOR
           
static int BW
           
static int BWR
           
private static java.lang.String BYELEMENT_JMOL
           
static java.lang.String BYELEMENT_PREFIX
           
private static java.lang.String BYELEMENT_RASMOL
           
private static java.lang.String BYRESIDUE_AMINO
           
static java.lang.String BYRESIDUE_PREFIX
           
private static java.lang.String BYRESIDUE_SHAPELY
           
private static java.lang.String[] colorSchemes
           
 int currentPalette
           
 int currentSegmentCount
           
static int CUSTOM
           
private static int GRAY
           
 float hi
           
static int HIGH
           
private  int ihalf
           
(package private)  boolean isColorIndex
           
 boolean isReversed
           
 boolean isTranslucent
           
static int JMOL
           
 float lo
           
static int LOW
           
private  int[] paletteBW
           
private  int[] paletteWB
           
(package private)  ColorEncoder propertyColorEncoder
           
static int RASMOL
           
private static int[] rasmolScale
           
static int RESU
           
static int ROYGB
           
static int RWB
           
 java.util.Map<java.lang.String,int[]> schemes
           
static int SHAPELY
           
(package private)  java.lang.String thisName
           
(package private)  int[] thisScale
           
static int USER
           
(package private)  int[] userScale
           
static int WB
           
 
Constructor Summary
ColorEncoder(ColorEncoder propertyColorEncoder)
           
 
Method Summary
private static int colorIndex(int q, int segmentCount)
           
private static java.lang.String fixName(java.lang.String name)
           
 int getArgb(float val)
           
 int getArgbFromPalette(float val, float lo, float hi, int palette)
           
 short getColorIndex(float val)
           
 short getColorIndexFromPalette(float val, float lo, float hi, int palette, boolean isTranslucent)
           
 java.util.Map<java.lang.String,java.lang.Object> getColorKey()
           
 java.lang.String getColorScheme()
           
 int getColorScheme(java.lang.String colorScheme, boolean defaultToRoygb, boolean isOverloaded)
           
 int[] getColorSchemeArray(int palette)
           
static java.lang.String getColorSchemeList(int[] scheme)
           
 java.lang.String getColorSchemeName()
           
 java.lang.String getColorSchemeName(int i)
           
static int[] getPaletteAtoB(int color1, int color2, int n)
           
private  int[] getPaletteBW()
           
 int getPaletteColorCount(int palette)
           
private  int[] getPaletteWB()
           
static int[] getRasmolScale()
           
private static int getSchemeIndex(java.lang.String colorScheme)
           
 int getState(java.lang.StringBuffer s)
           
private  int makeColorScheme(java.lang.String name, int[] scale, boolean isOverloaded)
           
 float quantize(float x, boolean isLowEnd)
          gets the value at the color boundary for this color range fraction
static int quantize(float val, float lo, float hi, int segmentCount)
           
static void RGBtoHSL(float r, float g, float b, float[] ret)
           
 void setColorScheme(java.lang.String colorScheme, boolean isTranslucent)
           
 void setRange(float lo, float hi, boolean isReversed)
           
private  void setThisScheme(java.lang.String name, int[] scale)
           
 void setUserScale(int[] scale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRAY

private static final int GRAY
See Also:
Constant Field Values

BYELEMENT_PREFIX

public static final java.lang.String BYELEMENT_PREFIX
See Also:
Constant Field Values

BYRESIDUE_PREFIX

public static final java.lang.String BYRESIDUE_PREFIX
See Also:
Constant Field Values

BYELEMENT_JMOL

private static final java.lang.String BYELEMENT_JMOL
See Also:
Constant Field Values

BYELEMENT_RASMOL

private static final java.lang.String BYELEMENT_RASMOL
See Also:
Constant Field Values

BYRESIDUE_SHAPELY

private static final java.lang.String BYRESIDUE_SHAPELY
See Also:
Constant Field Values

BYRESIDUE_AMINO

private static final java.lang.String BYRESIDUE_AMINO
See Also:
Constant Field Values

CUSTOM

public static final int CUSTOM
See Also:
Constant Field Values

ROYGB

public static final int ROYGB
See Also:
Constant Field Values

BGYOR

public static final int BGYOR
See Also:
Constant Field Values

JMOL

public static final int JMOL
See Also:
Constant Field Values

RASMOL

public static final int RASMOL
See Also:
Constant Field Values

SHAPELY

public static final int SHAPELY
See Also:
Constant Field Values

AMINO

public static final int AMINO
See Also:
Constant Field Values

RWB

public static final int RWB
See Also:
Constant Field Values

BWR

public static final int BWR
See Also:
Constant Field Values

LOW

public static final int LOW
See Also:
Constant Field Values

HIGH

public static final int HIGH
See Also:
Constant Field Values

BW

public static final int BW
See Also:
Constant Field Values

WB

public static final int WB
See Also:
Constant Field Values

USER

public static final int USER
See Also:
Constant Field Values

RESU

public static final int RESU
See Also:
Constant Field Values

ALT

public static final int ALT
See Also:
Constant Field Values

colorSchemes

private static final java.lang.String[] colorSchemes

paletteBW

private int[] paletteBW

paletteWB

private int[] paletteWB

argbsCpk

private int[] argbsCpk

argbsRoygb

private int[] argbsRoygb

argbsRwb

private int[] argbsRwb

argbsShapely

private int[] argbsShapely

argbsAmino

private int[] argbsAmino

ihalf

private int ihalf

rasmolScale

private static int[] rasmolScale

schemes

public java.util.Map<java.lang.String,int[]> schemes

currentPalette

public int currentPalette

currentSegmentCount

public int currentSegmentCount

isTranslucent

public boolean isTranslucent

lo

public float lo

hi

public float hi

isReversed

public boolean isReversed

userScale

int[] userScale

thisScale

int[] thisScale

thisName

java.lang.String thisName

isColorIndex

boolean isColorIndex

propertyColorEncoder

ColorEncoder propertyColorEncoder
Constructor Detail

ColorEncoder

public ColorEncoder(ColorEncoder propertyColorEncoder)
Method Detail

getSchemeIndex

private static final int getSchemeIndex(java.lang.String colorScheme)

fixName

private static final java.lang.String fixName(java.lang.String name)

makeColorScheme

private int makeColorScheme(java.lang.String name,
                            int[] scale,
                            boolean isOverloaded)
Parameters:
name -
scale - if null, then this is a reset.
isOverloaded - if TRUE,
Returns:
>= 0 for a default color scheme

getColorScheme

public int getColorScheme(java.lang.String colorScheme,
                          boolean defaultToRoygb,
                          boolean isOverloaded)
Parameters:
colorScheme - name or name= or name=[x......] [x......] ....
defaultToRoygb -
isOverloaded -
Returns:
paletteID

setUserScale

public void setUserScale(int[] scale)

getColorSchemeArray

public int[] getColorSchemeArray(int palette)

getColorIndexFromPalette

public short getColorIndexFromPalette(float val,
                                      float lo,
                                      float hi,
                                      int palette,
                                      boolean isTranslucent)

getPaletteColorCount

public int getPaletteColorCount(int palette)

getArgbFromPalette

public int getArgbFromPalette(float val,
                              float lo,
                              float hi,
                              int palette)

setThisScheme

private void setThisScheme(java.lang.String name,
                           int[] scale)

getArgb

public int getArgb(float val)

getColorIndex

public short getColorIndex(float val)

getColorKey

public java.util.Map<java.lang.String,java.lang.Object> getColorKey()

setColorScheme

public void setColorScheme(java.lang.String colorScheme,
                           boolean isTranslucent)
Parameters:
colorScheme -
isTranslucent -

setRange

public void setRange(float lo,
                     float hi,
                     boolean isReversed)

getColorSchemeName

public java.lang.String getColorSchemeName()

getColorSchemeName

public java.lang.String getColorSchemeName(int i)

getColorSchemeList

public static final java.lang.String getColorSchemeList(int[] scheme)

getRasmolScale

public static final int[] getRasmolScale()

getPaletteWB

private int[] getPaletteWB()

getPaletteAtoB

public static int[] getPaletteAtoB(int color1,
                                   int color2,
                                   int n)

getPaletteBW

private int[] getPaletteBW()

quantize

public float quantize(float x,
                      boolean isLowEnd)
gets the value at the color boundary for this color range fraction

Parameters:
x -
isLowEnd -
Returns:
quantized value

quantize

public static final int quantize(float val,
                                 float lo,
                                 float hi,
                                 int segmentCount)

colorIndex

private static final int colorIndex(int q,
                                    int segmentCount)

getState

public int getState(java.lang.StringBuffer s)

getColorScheme

public java.lang.String getColorScheme()

RGBtoHSL

public static void RGBtoHSL(float r,
                            float g,
                            float b,
                            float[] ret)