Class LXBlend

All Implemented Interfaces:
LXLoopTask, LXPath, LXSerializable, LXParameterListener
Direct Known Subclasses:
DissolveBlend, LXBlend.FunctionalBlend

public abstract class LXBlend extends LXModulatorComponent
An LXBlend is a loop-based implementation of a compositing algorithm. Two color buffers are blended together using some logic, typically a standard alpha-compositing technique. However, more complex blend modes may be authored, taking into account position information from the model, for instance.
  • Constructor Details

    • LXBlend

      protected LXBlend(LX lx)
  • Method Details

    • setName

      public LXBlend setName(String name)
      Sets name of this blend mode
      Parameters:
      name - UI name of blend
      Returns:
      this
    • getName

      public String getName()
      Returns the name of this blend, to be shown in UI
      Returns:
      Blend name
    • getLabel

      public String getLabel()
      Gets the name of this blend.
      Specified by:
      getLabel in interface LXPath
      Overrides:
      getLabel in class LXComponent
      Returns:
      Label for this component
    • toString

      public String toString()
      Name of the blend
      Overrides:
      toString in class LXComponent
      Returns:
      Debug string identifying this component
    • blend

      public void blend(int[] dst, int[] src, double alpha, LXBuffer buffer, LXModel model)
    • blend

      public abstract void blend(int[] dst, int[] src, double alpha, int[] output, LXModel model)
      Blends the src buffer onto the destination buffer at the specified alpha amount.
      Parameters:
      dst - Destination buffer (lower layer)
      src - Source buffer (top layer)
      alpha - Alpha blend, from 0-1
      output - Output buffer, which may be the same as src or dst
      model - A model which indicates the set of points to blend
    • lerp

      public void lerp(int[] from, int[] to, double amt, int[] output, LXModel model)
      Transitions from one buffer to another. By default, this is used by first blending from-to with alpha 0-1, then blending to-from with alpha 1-0. Blends which are asymmetrical may override this method for custom functionality. This method is used by pattern transitions on channels as well as the crossfader.
      Parameters:
      from - First buffer
      to - Second buffer
      amt - Interpolation from-to (0-1)
      output - Output buffer, which may be the same as from or to
      model - The model with points that should be blended
    • onActive

      public void onActive()
      Subclasses may override this method. It will be invoked when the blend is about to become active for a transition. Blends may take care of any initialization needed or reset parameters if desired. Note that a blend used on a channel fader or crossfader will only receive this message once.
    • onInactive

      public void onInactive()
      Subclasses may override this method. It will be invoked when the transition is no longer active. Resources may be freed if desired. Note that this method will only be received once blends used on channel faders or crossfaders.