Package com.jackmeng.core.util
Class use_Blurhash
java.lang.Object
com.jackmeng.core.util.use_Blurhash
A blurring to hash implementation in Java
- Author:
- Jack Meng
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
_as_linear
(double val) Converts the given number to be within the sRGB rangestatic int[]
Decodes the given BlurHash into an array of pixelsstatic String
enc
(int[] pixels, int width, int height, int componentX, int componentY) Encodes the given values into a BlurHashstatic 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
-
Field Details
-
__ll
static double[] __llRepresents 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
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
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
-