Class AddressableLEDBufferView

java.lang.Object
ca.team4308.absolutelib.leds.AddressableLEDBufferView

public class AddressableLEDBufferView extends Object
Represents a view into a portion of an AddressableLEDBuffer. Allows treating a section of LEDs as its own buffer.
  • Constructor Details

    • AddressableLEDBufferView

      public AddressableLEDBufferView(AddressableLEDBuffer buffer, int startIndex, int length)
      Creates a new view into an LED buffer.
      Parameters:
      buffer - The parent LED buffer
      startIndex - The starting index in the parent buffer
      length - The number of LEDs in this view
  • Method Details

    • setColor

      public void setColor(int index, Color color)
      Sets the RGB values for an LED in this view.
      Parameters:
      index - The index within this view
      color - Red value (0-255)
    • setRGB

      public void setRGB(int index, int r, int g, int b)
      Sets the RGB values for an LED in this view.
      Parameters:
      index - The index within this view
      r - Red value (0-255)
      g - Green value (0-255)
      b - Blue value (0-255)
    • setHSV

      public void setHSV(int index, int h, int s, int v)
      Sets the HSV values for an LED in this view.
      Parameters:
      index - The index within this view
      h - Hue (0-180)
      s - Saturation (0-255)
      v - Value/Brightness (0-255)
    • getLED

      public Color getLED(int index)
      Gets the color of an LED in this view.
      Parameters:
      index - The index within this view
      Returns:
      The Color object representing the LED's color
    • getLength

      public int getLength()
      Gets the length of this buffer view.
      Returns:
      The number of LEDs in this view
    • getStartIndex

      public int getStartIndex()
      Gets the starting index of this view in the parent buffer.
      Returns:
      The start index