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
     
    static final short
     
    static final short
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final short
     
    static final short
     
    static final short
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • 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
    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

  • 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)