diff options
Diffstat (limited to 'app/src/main/java/app/fedilab/android/mastodon/helper/BlurHashDecoder.kt')
-rw-r--r-- | app/src/main/java/app/fedilab/android/mastodon/helper/BlurHashDecoder.kt | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/app/src/main/java/app/fedilab/android/mastodon/helper/BlurHashDecoder.kt b/app/src/main/java/app/fedilab/android/mastodon/helper/BlurHashDecoder.kt index 9cc738186..e192239fa 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/helper/BlurHashDecoder.kt +++ b/app/src/main/java/app/fedilab/android/mastodon/helper/BlurHashDecoder.kt @@ -69,20 +69,20 @@ class BlurHashDecoder { val g = (value / 19) % 19 val b = value % 19 return floatArrayOf( - signedPow2((r - 9) / 9.0f) * maxAc, - signedPow2((g - 9) / 9.0f) * maxAc, - signedPow2((b - 9) / 9.0f) * maxAc + signedPow2((r - 9) / 9.0f) * maxAc, + signedPow2((g - 9) / 9.0f) * maxAc, + signedPow2((b - 9) / 9.0f) * maxAc ) } private fun signedPow2(value: Float) = value.pow(2f).withSign(value) private fun composeBitmap( - width: Int, - height: Int, - numCompX: Int, - numCompY: Int, - colors: Array<FloatArray> + width: Int, + height: Int, + numCompX: Int, + numCompY: Int, + colors: Array<FloatArray> ): Bitmap { val imageArray = IntArray(width * height) for (y in 0 until height) { @@ -100,7 +100,7 @@ class BlurHashDecoder { } } imageArray[x + width * y] = - Color.rgb(linearToSrgb(r), linearToSrgb(g), linearToSrgb(b)) + Color.rgb(linearToSrgb(r), linearToSrgb(g), linearToSrgb(b)) } } return Bitmap.createBitmap(imageArray, width, height, Bitmap.Config.ARGB_8888) @@ -116,12 +116,12 @@ class BlurHashDecoder { } private val charMap = listOf( - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', - 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', - 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', - 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '#', '$', '%', '*', '+', ',', - '-', '.', ':', ';', '=', '?', '@', '[', ']', '^', '_', '{', '|', '}', '~' + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '#', '$', '%', '*', '+', ',', + '-', '.', ':', ';', '=', '?', '@', '[', ']', '^', '_', '{', '|', '}', '~' ) - .mapIndexed { i, c -> c to i } - .toMap() + .mapIndexed { i, c -> c to i } + .toMap() }
\ No newline at end of file |