|
|
|
|
@ -103,7 +103,7 @@ fun FilterScreen(modifier: Modifier = Modifier) {
|
|
|
|
|
|
|
|
|
|
val sourceBitmap = remember { decodeSourceBitmap(context) }
|
|
|
|
|
|
|
|
|
|
val sourceImage = remember(sourceBitmap) { sourceBitmap.asImageBitmap() }
|
|
|
|
|
val previewBitmap = createFilteredBitmap(sourceBitmap, selectedFilter)
|
|
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
modifier = modifier
|
|
|
|
|
@ -122,22 +122,22 @@ fun FilterScreen(modifier: Modifier = Modifier) {
|
|
|
|
|
Spacer(modifier = Modifier.height(12.dp))
|
|
|
|
|
|
|
|
|
|
Image(
|
|
|
|
|
bitmap = sourceImage,
|
|
|
|
|
bitmap = previewBitmap.asImageBitmap(),
|
|
|
|
|
contentDescription = "Filtered Preview (${selectedFilter.name})",
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.size(300.dp)
|
|
|
|
|
.clip(RoundedCornerShape(12.dp))
|
|
|
|
|
.background(Color.LightGray),
|
|
|
|
|
contentScale = ContentScale.Crop,
|
|
|
|
|
colorFilter = selectedFilter.colorFilter
|
|
|
|
|
contentScale = ContentScale.Crop
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
Spacer(modifier = Modifier.height(12.dp))
|
|
|
|
|
|
|
|
|
|
LazyRow(horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
|
|
|
|
items(FILTERS, key = { it.name }) { filter ->
|
|
|
|
|
val thumbnail = createFilteredBitmap(sourceBitmap, filter)
|
|
|
|
|
FilterThumbnail(
|
|
|
|
|
image = sourceImage,
|
|
|
|
|
image = thumbnail.asImageBitmap(),
|
|
|
|
|
filter = filter,
|
|
|
|
|
selected = filter == selectedFilter,
|
|
|
|
|
onClick = { selectedFilter = filter}
|
|
|
|
|
@ -189,7 +189,6 @@ fun FilterThumbnail(
|
|
|
|
|
contentDescription = filter.name,
|
|
|
|
|
modifier = Modifier.fillMaxSize(),
|
|
|
|
|
contentScale = ContentScale.Crop,
|
|
|
|
|
colorFilter = filter.colorFilter
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
Spacer(modifier = Modifier.height(4.dp))
|
|
|
|
|
|