Package icyllis.arc3d.engine

# Class Swizzle

java.lang.Object
icyllis.arc3d.engine.Swizzle

public final class Swizzle extends Object
Represents a color component mapping. It's packed as a `short` value.

Do NOT change the packing format, there are inlined code in other places.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final short`
  `AAAA`
  `static final short`
  `BGR1`
  `static final short`
  `BGRA`
  `static final int`
  `COMPONENT_A`
  `static final int`
  `COMPONENT_B`
  `static final int`
  `COMPONENT_G`
  `static final int`
  `COMPONENT_ONE`
  `static final int`
  `COMPONENT_R`
  `static final int`
  `COMPONENT_ZERO`
  `static final short`
  `INVALID`
  `static final short`
  `RGB1`
  `static final short`
  `RGBA`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Swizzle()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `apply(short swizzle, float[] inColor, float[] outColor)`
  Applies this swizzle to the input color and returns the swizzled color.
  `static int`
  `charToIndex(char c)`
  `static short`
  `concat(short a, short b)`
  Concatenates two swizzles (e.g.
  `static int`
  `getA(short swizzle)`
  `static int`
  `getB(short swizzle)`
  `static int`
  `getG(short swizzle)`
  `static int`
  `getR(short swizzle)`
  `static char`
  `indexToChar(int idx)`
  `static short`
  `make(char r, char g, char b, char a)`
  Compact representation of the swizzle suitable for a key.
  `static short`
  `make(int r, int g, int b, int a)`
  `static short`
  `make(CharSequence s)`
  Compact representation of the swizzle suitable for a key.
  `static String`
  `toString(short swizzle)`

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

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

- ## Field Details

  - ### RGBA

    public static final short RGBA
    See Also:
      - Constant Field Values

  - ### BGRA

    public static final short BGRA
    See Also:
      - Constant Field Values

  - ### RGB1

    public static final short RGB1
    See Also:
      - Constant Field Values

  - ### BGR1

    public static final short BGR1
    See Also:
      - Constant Field Values

  - ### AAAA

    public static final short AAAA
    See Also:
      - Constant Field Values

  - ### INVALID

    public static final short INVALID
    See Also:
      - Constant Field Values

  - ### COMPONENT_R

    public static final int COMPONENT_R
    See Also:
      - Constant Field Values

  - ### COMPONENT_G

    public static final int COMPONENT_G
    See Also:
      - Constant Field Values

  - ### COMPONENT_B

    public static final int COMPONENT_B
    See Also:
      - Constant Field Values

  - ### COMPONENT_A

    public static final int COMPONENT_A
    See Also:
      - Constant Field Values

  - ### COMPONENT_ZERO

    public static final int COMPONENT_ZERO
    See Also:
      - Constant Field Values

  - ### COMPONENT_ONE

    public static final int COMPONENT_ONE
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### Swizzle

    public Swizzle()

- ## Method Details

  - ### charToIndex

    @Contract(pure=true) public static int charToIndex(char c)

  - ### indexToChar

    @Contract(pure=true) public static char indexToChar(int idx)

  - ### make

    @Contract(pure=true) public static short make(CharSequence s)
    Compact representation of the swizzle suitable for a key. Letters must be lowercase.

  - ### make

    @Contract(pure=true) public static short make(char r, char g, char b, char a)
    Compact representation of the swizzle suitable for a key. Letters must be lowercase.

  - ### make

    @Contract(pure=true) public static short make(int r, int g, int b, int a)

  - ### getR

    @Contract(pure=true) public static int getR(short swizzle)

  - ### getG

    @Contract(pure=true) public static int getG(short swizzle)

  - ### getB

    @Contract(pure=true) public static int getB(short swizzle)

  - ### getA

    @Contract(pure=true) public static int getA(short swizzle)

  - ### concat

    public static short concat(short a, short b)
    Concatenates two swizzles (e.g. concat("111R", "AAAA") -> "RRRR").

  - ### apply

    public static void apply(short swizzle, @Size(4L) float[] inColor, @Size(4L) float[] outColor)
    Applies this swizzle to the input color and returns the swizzled color.

  - ### toString

    public static String toString(short swizzle)