Class use_Blurhash

java.lang.Object
com.jackmeng.core.util.use_Blurhash

public final class use_Blurhash extends Object
A blurring to hash implementation in Java
Author:
Jack Meng
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static double[]
    Represents the colors;
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    _as_linear(double val)
    Converts the given number to be within the sRGB range
    static int[]
    dec(String blurHash, int width, int height, double punch)
    Decodes the given BlurHash into an array of pixels
    static String
    enc(int[] pixels, int width, int height, int componentX, int componentY)
    Encodes the given values into a BlurHash
    static double
    max(double[][] val)
    Finds a max value in an array (2D)
    static double
    to_linear(int val)
    Converts the given number to be within the linear range

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • __ll

      static double[] __ll
      Represents the colors;
  • Constructor Details

    • use_Blurhash

      private use_Blurhash()
  • Method Details

    • max

      public static double max(double[][] val)
      Finds a max value in an array (2D)
      Parameters:
      val - The array
      Returns:
      A max value
    • to_linear

      public static double to_linear(int val)
      Converts the given number to be within the linear range
      Parameters:
      val - The number to convert
      Returns:
      The converted number
    • _as_linear

      public static int _as_linear(double val)
      Converts the given number to be within the sRGB range
      Parameters:
      val - The number to convert
      Returns:
      The converted number
    • enc

      public static String enc(int[] pixels, int width, int height, int componentX, int componentY)
      Encodes the given values into a BlurHash
      Parameters:
      pixels - The pixels to encode
      width - The width of the image
      height - The height of the image
      componentX - The x-component of the center of the image
      componentY - The y-component of the center of the image
      Returns:
      The encoded BlurHash as a String
    • dec

      public static int[] dec(String blurHash, int width, int height, double punch)
      Decodes the given BlurHash into an array of pixels
      Parameters:
      blurHash - The BlurHash to decode (String)
      width - The width of the image
      height - The height of the image
      punch - The punch value of the image; often regarded as the "sharpness" of the image
      Returns:
      The decoded pixels