Improve mosaic quality
Change the mosaic bitmap config to ARGB_8888, which greatly improves quality.
This commit is contained in:
@@ -52,8 +52,8 @@ class MosaicFetcher(private val context: Context) : Fetcher<Parent> {
|
|||||||
val streams = mutableListOf<InputStream>()
|
val streams = mutableListOf<InputStream>()
|
||||||
|
|
||||||
// Load MediaStore streams
|
// Load MediaStore streams
|
||||||
uris.forEach {
|
uris.forEach { uri ->
|
||||||
val stream: InputStream? = context.contentResolver.openInputStream(it)
|
val stream: InputStream? = context.contentResolver.openInputStream(uri)
|
||||||
|
|
||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
streams.add(stream)
|
streams.add(stream)
|
||||||
@@ -88,7 +88,7 @@ class MosaicFetcher(private val context: Context) : Fetcher<Parent> {
|
|||||||
*/
|
*/
|
||||||
private fun drawMosaic(streams: List<InputStream>): Bitmap {
|
private fun drawMosaic(streams: List<InputStream>): Bitmap {
|
||||||
val mosaicBitmap = Bitmap.createBitmap(
|
val mosaicBitmap = Bitmap.createBitmap(
|
||||||
MOSAIC_BITMAP_SIZE, MOSAIC_BITMAP_SIZE, Bitmap.Config.RGB_565
|
MOSAIC_BITMAP_SIZE, MOSAIC_BITMAP_SIZE, Bitmap.Config.ARGB_8888
|
||||||
)
|
)
|
||||||
|
|
||||||
val canvas = Canvas(mosaicBitmap)
|
val canvas = Canvas(mosaicBitmap)
|
||||||
|
|||||||
Reference in New Issue
Block a user