|
|
@ -15,6 +15,7 @@ import androidx.compose.ui.Modifier |
|
|
|
import androidx.compose.ui.draw.clip |
|
|
|
import androidx.compose.ui.draw.clip |
|
|
|
import androidx.compose.ui.graphics.ImageBitmap |
|
|
|
import androidx.compose.ui.graphics.ImageBitmap |
|
|
|
import androidx.compose.ui.graphics.painter.BitmapPainter |
|
|
|
import androidx.compose.ui.graphics.painter.BitmapPainter |
|
|
|
|
|
|
|
import androidx.compose.ui.graphics.painter.Painter |
|
|
|
import androidx.compose.ui.input.key.* |
|
|
|
import androidx.compose.ui.input.key.* |
|
|
|
import androidx.compose.ui.layout.onGloballyPositioned |
|
|
|
import androidx.compose.ui.layout.onGloballyPositioned |
|
|
|
import androidx.compose.ui.unit.IntRect |
|
|
|
import androidx.compose.ui.unit.IntRect |
|
|
@ -26,9 +27,7 @@ import example.imageviewer.core.FilterType |
|
|
|
import example.imageviewer.model.* |
|
|
|
import example.imageviewer.model.* |
|
|
|
import example.imageviewer.style.* |
|
|
|
import example.imageviewer.style.* |
|
|
|
import org.jetbrains.compose.resources.ExperimentalResourceApi |
|
|
|
import org.jetbrains.compose.resources.ExperimentalResourceApi |
|
|
|
import org.jetbrains.compose.resources.orEmpty |
|
|
|
import org.jetbrains.compose.resources.painterResource |
|
|
|
import org.jetbrains.compose.resources.rememberImageBitmap |
|
|
|
|
|
|
|
import org.jetbrains.compose.resources.resource |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Composable |
|
|
|
@Composable |
|
|
|
internal fun FullscreenImage( |
|
|
|
internal fun FullscreenImage( |
|
|
@ -157,7 +156,7 @@ private fun FullscreenImageBar( |
|
|
|
navigationIcon = { |
|
|
|
navigationIcon = { |
|
|
|
Tooltip(localization.back) { |
|
|
|
Tooltip(localization.back) { |
|
|
|
Image( |
|
|
|
Image( |
|
|
|
resource("back.png").rememberImageBitmap().orEmpty(), |
|
|
|
painterResource("back.png"), |
|
|
|
contentDescription = null, |
|
|
|
contentDescription = null, |
|
|
|
modifier = Modifier.size(38.dp) |
|
|
|
modifier = Modifier.size(38.dp) |
|
|
|
.clip(CircleShape) |
|
|
|
.clip(CircleShape) |
|
|
@ -205,24 +204,24 @@ private fun FilterButton( |
|
|
|
|
|
|
|
|
|
|
|
@OptIn(ExperimentalResourceApi::class) |
|
|
|
@OptIn(ExperimentalResourceApi::class) |
|
|
|
@Composable |
|
|
|
@Composable |
|
|
|
private fun getFilterImage(active: Boolean, type: FilterType): ImageBitmap { |
|
|
|
private fun getFilterImage(active: Boolean, type: FilterType): Painter { |
|
|
|
return when (type) { |
|
|
|
return when (type) { |
|
|
|
FilterType.GrayScale -> if (active) { |
|
|
|
FilterType.GrayScale -> if (active) { |
|
|
|
resource("grayscale_on.png").rememberImageBitmap().orEmpty() |
|
|
|
painterResource("grayscale_on.png") |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
resource("grayscale_off.png").rememberImageBitmap().orEmpty() |
|
|
|
painterResource("grayscale_off.png") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FilterType.Pixel -> if (active) { |
|
|
|
FilterType.Pixel -> if (active) { |
|
|
|
resource("pixel_on.png").rememberImageBitmap().orEmpty() |
|
|
|
painterResource("pixel_on.png") |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
resource("pixel_off.png").rememberImageBitmap().orEmpty() |
|
|
|
painterResource("pixel_off.png") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FilterType.Blur -> if (active) { |
|
|
|
FilterType.Blur -> if (active) { |
|
|
|
resource("blur_on.png").rememberImageBitmap().orEmpty() |
|
|
|
painterResource("blur_on.png") |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
resource("blur_off.png").rememberImageBitmap().orEmpty() |
|
|
|
painterResource("blur_off.png") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|