Package org.pushingpixels.substance.api

# Class SubstanceColorSchemeBundle

java.lang.Object
org.pushingpixels.substance.api.SubstanceColorSchemeBundle

public class SubstanceColorSchemeBundle extends Object
Color scheme bundle. Defines the visual appearance of a single decoration area of a skin.

See Also:
  - `DecorationAreaType`
  - `ColorSchemeAssociationKind`
  - `SubstanceSkin`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected SubstanceColorScheme`
`activeColorScheme`
The active color scheme of this bundle.
`protected Map<ColorSchemeAssociationKind,Map<ComponentState,ComponentState>>`
`bestFillMap`
`protected Map<ColorSchemeAssociationKind,Map<ComponentState,SubstanceColorScheme>>`
`colorSchemeMap`
Maps from color scheme association kinds to the map of color schemes.
`protected SubstanceColorScheme`
`disabledColorScheme`
The disabled color scheme of this bundle.
`protected SubstanceColorScheme`
`disabledSelectedScheme`
If there is no explicitly registered color scheme for the disabled selected component state, this field will contain a synthesized color scheme for the disabled selected state.
`protected SubstanceColorScheme`
`enabledColorScheme`
The enabled color scheme of this bundle.
`protected SubstanceColorScheme`
`pressedScheme`
If there is no explicitly registered color scheme for pressed component state, this field will contain a synthesized color scheme for a pressed state.
`protected SubstanceColorScheme`
`rolloverSelectedScheme`
If there is no explicitly registered color scheme for the rollover selected component state, this field will contain a synthesized color scheme for the rollover selected state.
`protected SubstanceColorScheme`
`selectedScheme`
If there is no explicitly registered color scheme for the selected component state, this field will contain a synthesized color scheme for the selected state.
`protected Map<ComponentState,Float>`
`stateAlphaMap`
Maps from component state to the alpha channel applied on color scheme.
`protected Map<ComponentState,Float>`
`stateHighlightSchemeAlphaMap`
Maps from component state to the alpha channel applied on highlight color scheme.

## Constructor Summary

Constructors
Constructor
Description
`SubstanceColorSchemeBundle(SubstanceColorScheme activeColorScheme, SubstanceColorScheme enabledColorScheme, SubstanceColorScheme disabledColorScheme)`
Creates a new color scheme bundle.

## Method Summary

Modifier and Type
Method
Description
`SubstanceColorScheme`
`getActiveColorScheme()`
Returns the active color scheme of this bundle.
`float`
`getAlpha(Component comp, ComponentState componentState)`
Returns the alpha channel of the color scheme of the component.
`SubstanceColorScheme`
`getColorScheme(ColorSchemeAssociationKind associationKind, ComponentState componentState)`
Returns the color scheme to be used for painting the specified visual area of the component under the specified component state.
`SubstanceColorScheme`
`getColorScheme(ComponentState componentState)`
Returns the color scheme of the specified component in the specified component state.
`SubstanceColorScheme`
`getDisabledColorScheme()`
Returns the disabled color scheme of this bundle.
`SubstanceColorScheme`
`getEnabledColorScheme()`
Returns the enabled color scheme of this bundle.
`float`
`getHighlightAlpha(Component comp, ComponentState componentState)`
Returns the alpha channel of the highlight color scheme of the component.
`void`
`registerColorScheme(SubstanceColorScheme stateColorScheme, float alpha, ComponentState... states)`
Registers a color scheme for the specific component state.
`void`
`registerColorScheme(SubstanceColorScheme scheme, ColorSchemeAssociationKind associationKind, ComponentState... states)`
Registers the color scheme to be used for the specified visual area of controls under the specified states.
`void`
`registerColorScheme(SubstanceColorScheme stateColorScheme, ComponentState... states)`
Registers a color scheme for the specific component state.
`void`
`registerHighlightColorScheme(SubstanceColorScheme highlightScheme, float alpha, ComponentState... states)`
Registers a highlight color scheme for the specific component state if the component state is not `null`, or a global highlight color scheme otherwise.
`void`
`registerHighlightColorScheme(SubstanceColorScheme stateHighlightScheme, ComponentState... states)`
Registers a highlight color scheme for the specific component state if the component state is not `null`, or a global highlight color scheme otherwise.

### Methods inherited from class java.lang.Object

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

## Field Details

### activeColorScheme

protected SubstanceColorScheme activeColorScheme
The active color scheme of this bundle.

### enabledColorScheme

protected SubstanceColorScheme enabledColorScheme
The enabled color scheme of this bundle.

### disabledColorScheme

protected SubstanceColorScheme disabledColorScheme
The disabled color scheme of this bundle.

### stateAlphaMap

protected Map<ComponentState,Float> stateAlphaMap
Maps from component state to the alpha channel applied on color scheme. This map doesn't have to contain entries for all `ComponentState` instances.

### stateHighlightSchemeAlphaMap

protected Map<ComponentState,Float> stateHighlightSchemeAlphaMap
Maps from component state to the alpha channel applied on highlight color scheme. This map doesn't have to contain entries for all `ComponentState` instances.

### pressedScheme

protected SubstanceColorScheme pressedScheme
If there is no explicitly registered color scheme for pressed component state, this field will contain a synthesized color scheme for a pressed state.

### disabledSelectedScheme

protected SubstanceColorScheme disabledSelectedScheme
If there is no explicitly registered color scheme for the disabled selected component state, this field will contain a synthesized color scheme for the disabled selected state.

### selectedScheme

protected SubstanceColorScheme selectedScheme
If there is no explicitly registered color scheme for the selected component state, this field will contain a synthesized color scheme for the selected state.

### rolloverSelectedScheme

protected SubstanceColorScheme rolloverSelectedScheme
If there is no explicitly registered color scheme for the rollover selected component state, this field will contain a synthesized color scheme for the rollover selected state.

### colorSchemeMap

protected Map<ColorSchemeAssociationKind,Map<ComponentState,SubstanceColorScheme>> colorSchemeMap
Maps from color scheme association kinds to the map of color schemes. Different visual parts of controls in the specific decoration are can be painted with different color schemes. For example, a rollover button can use a light orange scheme for the gradient fill and a dark gray scheme for the border. In this case, this map will have:

- An entry with key `ColorSchemeAssociationKind.FILL`. This entry has a map entry with key `ComponentState.SELECTED` and value that points to the light orange scheme.
- An entry with key `ColorSchemeAssociationKind.BORDER`. This entry has a map entry with key `ComponentState.SELECTED` and value that points to the dark gray scheme.

### bestFillMap

protected Map<ColorSchemeAssociationKind,Map<ComponentState,ComponentState>> bestFillMap

## Constructor Details

### SubstanceColorSchemeBundle

public SubstanceColorSchemeBundle(SubstanceColorScheme activeColorScheme, SubstanceColorScheme enabledColorScheme, SubstanceColorScheme disabledColorScheme)
Creates a new color scheme bundle.

Parameters:
  `activeColorScheme` - The active color scheme of this bundle.
  `enabledColorScheme` - The enabled color scheme of this bundle.
  `disabledColorScheme` - The disabled color scheme of this bundle.

## Method Details

### registerColorScheme

public void registerColorScheme(SubstanceColorScheme stateColorScheme, float alpha, ComponentState... states)
Registers a color scheme for the specific component state.

Parameters:
  `stateColorScheme` - Color scheme for the specified component state.
  `alpha` - Alpha channel for the color scheme.
  `states` - Component states.

### registerColorScheme

public void registerColorScheme(SubstanceColorScheme stateColorScheme, ComponentState... states)
Registers a color scheme for the specific component state.

Parameters:
  `stateColorScheme` - Color scheme for the specified component state.
  `states` - Component states.

### registerHighlightColorScheme

public void registerHighlightColorScheme(SubstanceColorScheme stateHighlightScheme, ComponentState... states)
Registers a highlight color scheme for the specific component state if the component state is not `null`, or a global highlight color scheme otherwise.

Parameters:
  `stateHighlightScheme` - Highlight color scheme for the specified component state.
  `states` - Component states. If `null`, the specified color scheme will be applied for all states left unspecified.

### registerHighlightColorScheme

public void registerHighlightColorScheme(SubstanceColorScheme highlightScheme, float alpha, ComponentState... states)
Registers a highlight color scheme for the specific component state if the component state is not `null`, or a global highlight color scheme otherwise.

Parameters:
  `highlightScheme` - Highlight color scheme for the specified component states.
  `alpha` - Alpha channel for the highlight color scheme.
  `states` - Component states. If `null`, the specified color scheme will be applied for all states left unspecified.

### getColorScheme

public SubstanceColorScheme getColorScheme(ComponentState componentState)
Returns the color scheme of the specified component in the specified component state.

Parameters:
  `componentState` - Component state.
Returns:
  The color scheme of the component in the specified component state.

### getHighlightAlpha

public float getHighlightAlpha(Component comp, ComponentState componentState)
Returns the alpha channel of the highlight color scheme of the component.

Parameters:
  `comp` - Component.
  `componentState` - Component state.
Returns:
  Highlight color scheme alpha channel.

### getAlpha

public float getAlpha(Component comp, ComponentState componentState)
Returns the alpha channel of the color scheme of the component.

Parameters:
  `comp` - Component.
  `componentState` - Component state.
Returns:
  Color scheme alpha channel.

### getActiveColorScheme

public SubstanceColorScheme getActiveColorScheme()
Returns the active color scheme of this bundle.

Returns:
  The active color scheme of this bundle.

### getEnabledColorScheme

public SubstanceColorScheme getEnabledColorScheme()
Returns the enabled color scheme of this bundle.

Returns:
  The enabled color scheme of this bundle.

### getDisabledColorScheme

public SubstanceColorScheme getDisabledColorScheme()
Returns the disabled color scheme of this bundle.

Returns:
  The disabled color scheme of this bundle.

### registerColorScheme

public void registerColorScheme(SubstanceColorScheme scheme, ColorSchemeAssociationKind associationKind, ComponentState... states)
Registers the color scheme to be used for the specified visual area of controls under the specified states. For example, if the light orange scheme has to be used for gradient fill of rollover selected and rollover controls, the parameters would be:

- `scheme`=light orange scheme
- `associationKind`=`ColorSchemeAssociationKind.FILL`
- `states`=`ComponentState.ROLLOVER_SELECTED`, `ComponentState.ROLLOVER_UNSELECTED`

Parameters:
  `scheme` - Color scheme.
  `associationKind` - Color scheme association kind that specifies the visual areas of controls to be painted with this color scheme.
  `states` - Component states that further restrict the usage of the specified color scheme.
Since:
  version 5.1

### getColorScheme

public SubstanceColorScheme getColorScheme(ColorSchemeAssociationKind associationKind, ComponentState componentState)
Returns the color scheme to be used for painting the specified visual area of the component under the specified component state.

Parameters:
  `associationKind` - Color scheme association kind.
  `componentState` - Component state.
Returns:
  Color scheme to be used for painting the specified visual area of the component under the specified component state.
Since:
  version 5.1
See Also:
  - `registerColorScheme(SubstanceColorScheme, ComponentState...)`