public class LXPalette extends LXComponent implements LXLoopTask, LXOscComponent
Modifier and Type | Class and Description |
---|---|
static class |
LXPalette.AutoCycleMode |
static interface |
LXPalette.Listener |
static class |
LXPalette.TransitionMode |
LXComponent.Placeholder, LXComponent.Renamable
LXSerializable.Utils
Modifier and Type | Field and Description |
---|---|
DiscreteParameter |
autoCycleCursor |
BooleanParameter |
autoCycleEnabled |
EnumParameter<LXPalette.AutoCycleMode> |
autoCycleMode
Auto-cycle to a random palette, not the next one
|
BoundedParameter |
autoCycleTimeSecs
Time in seconds after which transition thru the pattern set is automatically initiated.
|
LXDynamicColor |
color
The primary active color value
|
LXSwatch |
swatch
The active color swatch
|
List<LXSwatch> |
swatches
A read-only list of all the saved color swatches
|
BooleanParameter |
transitionEnabled |
EnumParameter<LXPalette.TransitionMode> |
transitionMode |
BoundedParameter |
transitionTimeSecs
Amount of time taken in seconds to transition into a new snapshot view
|
BooleanParameter |
triggerSwatchCycle |
controlSurfaceSemaphore, KEY_CLASS, KEY_COMPONENT_ID, KEY_ID, KEY_PARAMETER_PATH, KEY_PATH, label, lx, modulationColor
Modifier and Type | Method and Description |
---|---|
LXPalette |
addListener(LXPalette.Listener listener)
Registers a listener to the palette
|
LXSwatch |
addSwatch(JsonObject swatchObj,
int index)
Adds a swatch at the given index
|
void |
dispose()
Invoked when a component is being removed from the system and will no longer be used at all.
|
double |
getAutoCycleProgress() |
double |
getBrightness()
Gets the brightness of the primary color in active swatch
|
float |
getBrightnessf()
Gets the brightness of the primary color in active swatch
|
int |
getColor()
Gets the primary color of the currently active swatch
|
double |
getHue()
Gets the hue of the primary color in active swatch
|
float |
getHuef()
Gets the hue of the primary color in active swatch
|
double |
getSaturation()
Gets the saturation of the primary color in active swatch
|
float |
getSaturationf()
Gets the saturation of the primary color in active swatch
|
LXDynamicColor |
getSwatchColor(int index)
Gets the color in the active swatch at the given index.
|
double |
getTransitionProgress() |
void |
load(LX lx,
JsonObject obj)
Loads the LX component.
|
void |
loop(double deltaMs) |
LXPalette |
moveSwatch(LXSwatch swatch,
int index)
Moves a saved swatch to a different position in the list
|
void |
onParameterChanged(LXParameter p)
Subclasses are free to override this if desired.
|
LXPalette |
removeListener(LXPalette.Listener listener)
Unregisters a listener to the palette
|
LXPalette |
removeSwatch(LXSwatch swatch)
Removes a swatch from the color palette's saved swatch list
|
void |
save(LX lx,
JsonObject obj)
Serializes the LX component.
|
LXSwatch |
saveSwatch()
Saves the current swatch to the list of saved swatches
|
LXPalette |
setSwatch(LXSwatch swatch) |
addArray, addChild, addInternalParameter, addParameter, addParameter, contains, copyParameters, getChild, getComponentName, getComponentName, getComponentName, getId, getLabel, getLX, getOscAddress, getOscLabel, getOscPath, getParameter, getParameters, getParent, getPath, handleOscMessage, loadParameters, removeParameter, removeParameter, saveParameters, setParent, toString, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getOscAddress, handleOscMessage
get, get, getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, getComponent, getComponent, getParameter, getParameter
public final LXSwatch swatch
public final LXDynamicColor color
public final BooleanParameter autoCycleEnabled
public final EnumParameter<LXPalette.AutoCycleMode> autoCycleMode
public final BoundedParameter autoCycleTimeSecs
public final DiscreteParameter autoCycleCursor
public final BooleanParameter triggerSwatchCycle
public final BoundedParameter transitionTimeSecs
public final BooleanParameter transitionEnabled
public final EnumParameter<LXPalette.TransitionMode> transitionMode
public LXPalette(LX lx)
public void onParameterChanged(LXParameter p)
LXComponent
onParameterChanged
in interface LXParameterListener
onParameterChanged
in class LXComponent
p
- Parameter that has a value changepublic int getColor()
public LXDynamicColor getSwatchColor(int index)
index
- Index in swatchpublic float getHuef()
public double getHue()
public float getSaturationf()
public double getSaturation()
public float getBrightnessf()
public double getBrightness()
public LXSwatch saveSwatch()
public LXSwatch addSwatch(JsonObject swatchObj, int index)
swatchObj
- Saved swatch objectindex
- Index to save atpublic LXPalette removeSwatch(LXSwatch swatch)
swatch
- Swatch to removepublic double getTransitionProgress()
public double getAutoCycleProgress()
public void loop(double deltaMs)
loop
in interface LXLoopTask
public LXPalette moveSwatch(LXSwatch swatch, int index)
swatch
- Saved swatchindex
- New index for that swatchpublic LXPalette addListener(LXPalette.Listener listener)
listener
- Palette listenerpublic LXPalette removeListener(LXPalette.Listener listener)
listener
- Palette listenerpublic void dispose()
LXComponent
super.dispose()
at the appropriate
time to perform the basic cleanup, which may need to happen either before or after cleaning
up other objects.dispose
in class LXComponent
public void save(LX lx, JsonObject obj)
LXComponent
super.save(lx, obj)
at the appropriate time.save
in interface LXSerializable
save
in class LXComponent
lx
- LX instanceobj
- Object to serialize intopublic void load(LX lx, JsonObject obj)
LXComponent
load
in interface LXSerializable
load
in class LXComponent
lx
- LX instanceobj
- Object to deserializeLX library by Mark C. Slee. © 2012-2020