Companion

object Companion

Companion object containing the constants and methods for manipulating the puzzle image.

Properties

DARK_GRAY_FILTER
Link copied to clipboard
private const val DARK_GRAY_FILTER: Int = 0x121f1f
Dark color filter for distinguishing the blank tile from the rest of the tiles.

Functions

cropToSquareBitmap
Link copied to clipboard
private fun cropToSquareBitmap(image: Bitmap): Bitmap
Crops the given bitmap such that its dimensions are equal.
darkenBitmap
Link copied to clipboard
private fun darkenBitmap(image: Bitmap): Bitmap
Applies a dark color filter on the given bitmap to designate it as the blank tile and distinguish it from the rest of the puzzle tiles.
drawableToBitmap
Link copied to clipboard
fun drawableToBitmap(context: Context, drawableId: Int): Bitmap
Converts the given drawable to a bitmap.
resizeToSquareBitmap
Link copied to clipboard
fun resizeToSquareBitmap(image: Bitmap, dstWidth: Int, dstHeight: Int): Bitmap
Resizes (crops) the given bitmap such that its dimensions are equal.
splitBitmap
Link copied to clipboard
fun splitBitmap(image: Bitmap, chunkDimen: Int, numTiles: Int, numColumns: Int): Pair<ArrayList<Bitmap>, ArrayList<Bitmap>>
Splits the given bitmap into multiple square chunks.