Class ColorTypes.ConversionCache32

java.lang.Object
dev.lukebemish.dynamicassetgenerator.api.colors.ColorTypes.ConversionCache32
Enclosing class:
ColorTypes

public static class ColorTypes.ConversionCache32 extends Object
Tool for making conversions between 32-bit color spaces more performant. This should be used if it will have a known, short lifespan; hold a comparatively small number of items; and likely have many duplicate conversions. Otherwise, it is likely more performant to simply do conversions as needed.
  • Constructor Details

    • ConversionCache32

      public ConversionCache32(IntUnaryOperator converter)
      Creates a new cache that will use the provided converter to convert colors.
      Parameters:
      converter - conversion function to use
  • Method Details

    • convert

      public int convert(int color)
      Returns:
      the provided color after conversion. This operation is thread-safe.