Package com.jackmeng.stl
Class stl_BlurHash
java.lang.Object
com.jackmeng.stl.stl_BlurHash
public final class stl_BlurHash
extends java.lang.Object
A blurring to hash implementation in Java
- Author:
- Jack Meng
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classstl_BlurHash.blurhash_base83 -
Field Summary
Fields Modifier and Type Field Description (package private) static double[]__llRepresents the colors; -
Constructor Summary
Constructors Modifier Constructor Description privatestl_BlurHash() -
Method Summary
Modifier and Type Method Description static int_as_linear(double val)Converts the given number to be within the sRGB rangestatic int[]dec(java.lang.String blurHash, int width, int height, double punch)Decodes the given BlurHash into an array of pixelsstatic java.lang.Stringenc(int[] pixels, int width, int height, int componentX, int componentY)Encodes the given values into a BlurHashstatic doublemax(double[][] val)Finds a max value in an array (2D)static doubleto_linear(int val)Converts the given number to be within the linear rangeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
__ll
static final double[] __llRepresents the colors;
-
-
Constructor Details
-
stl_BlurHash
private stl_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 java.lang.String enc(int[] pixels, int width, int height, int componentX, int componentY)Encodes the given values into a BlurHash- Parameters:
pixels- The pixels to encodewidth- The width of the imageheight- The height of the imagecomponentX- The x-component of the center of the imagecomponentY- The y-component of the center of the image- Returns:
- The encoded BlurHash as a String
-
dec
public static int[] dec(java.lang.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 imageheight- The height of the imagepunch- The punch value of the image; often regarded as the "sharpness" of the image- Returns:
- The decoded pixels
-