# Class ColorEncoder

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

public class ColorEncoder extends Object

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`ALT`
`static final int`
`AMINO`
`static int[]`
`argbsChainAtom`
`static int[]`
`argbsChainHetero`
`static final int`
`BGYOR`
`static final int`
`BW`
`static final int`
`BWR`
`static final String`
`BYELEMENT_PREFIX`
`static final String`
`BYRESIDUE_PREFIX`
`int`
`currentPalette`
`int`
`currentSegmentCount`
`static final int`
`CUSTOM`
`static final int`
`FRIENDLY`
`float`
`hi`
`static final int`
`HIGH`
`static final int`
`INHERIT`
`boolean`
`isReversed`
`boolean`
`isTranslucent`
`static final int`
`JMOL`
`float`
`lo`
`static final int`
`LOW`
`static final int`
`NUCLEIC`
`static final int`
`RASMOL`
`static final int`
`RESU`
`static final int`
`ROYGB`
`static final int`
`RWB`
`Map<String,int[]>`
`schemes`
`static final int`
`SHAPELY`
`static final int`
`USER`
`static final int`
`WB`

## Constructor Summary

Constructors
Constructor
Description
`ColorEncoder(ColorEncoder ce, Viewer vwr)`

## Method Summary

Modifier and Type
Method
Description
`void`
`clearCache()`
`int`
`createColorScheme(String colorScheme, boolean defaultToRoygb, boolean isOverloaded)`
`int`
`getArgb(float val)`
`int`
`getArgbFromPalette(float val, float lo, float hi, int palette)`
`int`
`getArgbMinMax(float val, float min, float max)`
`short`
`getColorIndex(float val)`
`short`
`getColorIndexFromPalette(float val, float lo, float hi, int palette, boolean isTranslucent)`
`Map<String,Object>`
`getColorKey()`
`String`
`getColorScheme()`
`int[]`
`getColorSchemeArray(int palette)`
`static final String`
`getColorSchemeList(int[] scheme)`
`String`
`getColorSchemeName(int i)`
`String`
`getCurrentColorSchemeName()`
`static int[]`
`getPaletteAtoB(int color1, int color2, int n)`
`static final int[]`
`getRasmolScale()`
`float`
`quantize(float x, boolean isLowEnd)`
gets the value at the color boundary for this color range fraction
`static final int`
`quantize4(float val, float lo, float hi, int segmentCount)`
`void`
`setColorScheme(String colorScheme, boolean isTranslucent)`
`void`
`setRange(float lo, float hi, boolean isReversed)`
`void`
`setUserScale(int[] scale)`

### Methods inherited from class Object

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

## Field Details

### BYELEMENT_PREFIX

public static final String BYELEMENT_PREFIX

See Also:
  - Constant Field Values

### BYRESIDUE_PREFIX

public static final String BYRESIDUE_PREFIX

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

### FRIENDLY

public static final int FRIENDLY

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

### INHERIT

public static final int INHERIT

See Also:
  - Constant Field Values

### ALT

public static final int ALT

See Also:
  - Constant Field Values

### NUCLEIC

public static final int NUCLEIC

See Also:
  - Constant Field Values

### schemes

public Map<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

### argbsChainAtom

public static int[] argbsChainAtom

### argbsChainHetero

public static int[] argbsChainHetero

## Constructor Details

### ColorEncoder

public ColorEncoder(ColorEncoder ce, Viewer vwr)

## Method Details

### clearCache

public void clearCache()

### createColorScheme

public int createColorScheme(String colorScheme, boolean defaultToRoygb, boolean isOverloaded)

Parameters:
  `colorScheme` - name or name= or name=[x......] [x......] .... or name=red,green,blue or filename or https://...
  `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)

### getArgbFromPalette

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

### getArgb

public int getArgb(float val)

### getArgbMinMax

public int getArgbMinMax(float val, float min, float max)

### getColorIndex

public short getColorIndex(float val)

### getColorKey

public Map<String,Object> getColorKey()

### getColorScheme

public String getColorScheme()

### setColorScheme

public void setColorScheme(String colorScheme, boolean isTranslucent)

Parameters:
  `colorScheme` -
  `isTranslucent` -

### setRange

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

### getCurrentColorSchemeName

public String getCurrentColorSchemeName()

### getColorSchemeName

public String getColorSchemeName(int i)

### getColorSchemeList

public static final String getColorSchemeList(int[] scheme)

### getRasmolScale

public static final int[] getRasmolScale()

### getPaletteAtoB

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

### 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

### quantize4

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