diff --git a/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/domain/model/Filter.kt b/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/domain/model/Filter.kt index 6f99baee9..8765b9cd2 100644 --- a/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/domain/model/Filter.kt +++ b/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/domain/model/Filter.kt @@ -282,6 +282,8 @@ interface Filter : VisibilityOwner { interface Pinch : Filter interface Pointillize : Filter interface PolarCoordinates : Filter + interface ReduceNoise : SimpleFilter + interface SimpleSolarize : SimpleFilter } interface SimpleFilter : Filter diff --git a/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/presentation/model/UiFilter.kt b/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/presentation/model/UiFilter.kt index bf35f7bd2..48061921a 100644 --- a/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/presentation/model/UiFilter.kt +++ b/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/presentation/model/UiFilter.kt @@ -125,7 +125,9 @@ sealed class UiFilter( UiSobelSimpleFilter(), UiLaplacianSimpleFilter(), UiDespeckleFilter(), - UiEqualizeFilter() + UiEqualizeFilter(), + UiReduceNoiseFilter(), + UiSimpleSolarizeFilter(), ), listOf( UiHueFilter(), diff --git a/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/presentation/model/UiReduceNoiseFilter.kt b/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/presentation/model/UiReduceNoiseFilter.kt new file mode 100644 index 000000000..55cb9e69a --- /dev/null +++ b/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/presentation/model/UiReduceNoiseFilter.kt @@ -0,0 +1,28 @@ +/* + * ImageToolbox is an image editor for android + * Copyright (c) 2025 T8RIN (Malik Mukhametzyanov) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * You should have received a copy of the Apache License + * along with this program. If not, see . + */ + +package com.t8rin.imagetoolbox.core.filters.presentation.model + +import com.t8rin.imagetoolbox.core.filters.domain.model.Filter +import com.t8rin.imagetoolbox.core.resources.R + +class UiReduceNoiseFilter( + override val value: Unit = Unit +) : UiFilter( + title = R.string.reduce_noise, + value = value +), Filter.ReduceNoise \ No newline at end of file diff --git a/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/presentation/model/UiSimpleSolarizeFilter.kt b/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/presentation/model/UiSimpleSolarizeFilter.kt new file mode 100644 index 000000000..2025b5dcb --- /dev/null +++ b/core/filters/src/main/java/com/t8rin/imagetoolbox/core/filters/presentation/model/UiSimpleSolarizeFilter.kt @@ -0,0 +1,28 @@ +/* + * ImageToolbox is an image editor for android + * Copyright (c) 2025 T8RIN (Malik Mukhametzyanov) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * You should have received a copy of the Apache License + * along with this program. If not, see . + */ + +package com.t8rin.imagetoolbox.core.filters.presentation.model + +import com.t8rin.imagetoolbox.core.filters.domain.model.Filter +import com.t8rin.imagetoolbox.core.resources.R + +class UiSimpleSolarizeFilter( + override val value: Unit = Unit +) : UiFilter( + title = R.string.simple_solarize, + value = value +), Filter.SimpleSolarize \ No newline at end of file diff --git a/core/resources/src/main/res/values/strings.xml b/core/resources/src/main/res/values/strings.xml index 998114788..855c0052e 100644 --- a/core/resources/src/main/res/values/strings.xml +++ b/core/resources/src/main/res/values/strings.xml @@ -1692,4 +1692,6 @@ Rect to polar Polar to rect Invert in circle + Reduce Noise + Simple Solarize diff --git a/feature/filters/src/main/java/com/t8rin/imagetoolbox/feature/filters/data/AndroidFilterProvider.kt b/feature/filters/src/main/java/com/t8rin/imagetoolbox/feature/filters/data/AndroidFilterProvider.kt index ac1e23406..0b1e7d4f6 100644 --- a/feature/filters/src/main/java/com/t8rin/imagetoolbox/feature/filters/data/AndroidFilterProvider.kt +++ b/feature/filters/src/main/java/com/t8rin/imagetoolbox/feature/filters/data/AndroidFilterProvider.kt @@ -224,6 +224,7 @@ import com.t8rin.imagetoolbox.feature.filters.data.model.RadialTiltShiftFilter import com.t8rin.imagetoolbox.feature.filters.data.model.RainbowWorldFilter import com.t8rin.imagetoolbox.feature.filters.data.model.RandomDitheringFilter import com.t8rin.imagetoolbox.feature.filters.data.model.RedSwirlFilter +import com.t8rin.imagetoolbox.feature.filters.data.model.ReduceNoiseFilter import com.t8rin.imagetoolbox.feature.filters.data.model.RemoveColorFilter import com.t8rin.imagetoolbox.feature.filters.data.model.ReplaceColorFilter import com.t8rin.imagetoolbox.feature.filters.data.model.RetroYellowFilter @@ -238,6 +239,7 @@ import com.t8rin.imagetoolbox.feature.filters.data.model.SierraDitheringFilter import com.t8rin.imagetoolbox.feature.filters.data.model.SierraLiteDitheringFilter import com.t8rin.imagetoolbox.feature.filters.data.model.SimpleOldTvFilter import com.t8rin.imagetoolbox.feature.filters.data.model.SimpleSketchFilter +import com.t8rin.imagetoolbox.feature.filters.data.model.SimpleSolarizeFilter import com.t8rin.imagetoolbox.feature.filters.data.model.SimpleThresholdDitheringFilter import com.t8rin.imagetoolbox.feature.filters.data.model.SketchFilter import com.t8rin.imagetoolbox.feature.filters.data.model.SmoothToonFilter @@ -549,6 +551,8 @@ internal class AndroidFilterProvider @Inject constructor( is Filter.Pinch -> PinchFilter(value) is Filter.Pointillize -> PointillizeFilter(value) is Filter.PolarCoordinates -> PolarCoordinatesFilter(value) + is Filter.ReduceNoise -> ReduceNoiseFilter(value) + is Filter.SimpleSolarize -> SimpleSolarizeFilter(value) else -> throw IllegalArgumentException("No filter implementation for interface ${filter::class.simpleName}") } diff --git a/feature/filters/src/main/java/com/t8rin/imagetoolbox/feature/filters/data/model/ReduceNoiseFilter.kt b/feature/filters/src/main/java/com/t8rin/imagetoolbox/feature/filters/data/model/ReduceNoiseFilter.kt new file mode 100644 index 000000000..718043ed7 --- /dev/null +++ b/feature/filters/src/main/java/com/t8rin/imagetoolbox/feature/filters/data/model/ReduceNoiseFilter.kt @@ -0,0 +1,33 @@ +/* + * ImageToolbox is an image editor for android + * Copyright (c) 2025 T8RIN (Malik Mukhametzyanov) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * You should have received a copy of the Apache License + * along with this program. If not, see . + */ + +package com.t8rin.imagetoolbox.feature.filters.data.model + +import com.jhlabs.JhFilter +import com.jhlabs.ReduceNoiseFilter +import com.t8rin.imagetoolbox.core.filters.domain.model.Filter + +internal class ReduceNoiseFilter( + override val value: Unit = Unit +) : JhFilterTransformation(), Filter.ReduceNoise { + + override val cacheKey: String + get() = value.hashCode().toString() + + override fun createFilter(): JhFilter = ReduceNoiseFilter() + +} \ No newline at end of file diff --git a/feature/filters/src/main/java/com/t8rin/imagetoolbox/feature/filters/data/model/SimpleSolarizeFilter.kt b/feature/filters/src/main/java/com/t8rin/imagetoolbox/feature/filters/data/model/SimpleSolarizeFilter.kt new file mode 100644 index 000000000..054d3ca44 --- /dev/null +++ b/feature/filters/src/main/java/com/t8rin/imagetoolbox/feature/filters/data/model/SimpleSolarizeFilter.kt @@ -0,0 +1,33 @@ +/* + * ImageToolbox is an image editor for android + * Copyright (c) 2025 T8RIN (Malik Mukhametzyanov) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * You should have received a copy of the Apache License + * along with this program. If not, see . + */ + +package com.t8rin.imagetoolbox.feature.filters.data.model + +import com.jhlabs.JhFilter +import com.jhlabs.SolarizeFilter +import com.t8rin.imagetoolbox.core.filters.domain.model.Filter + +internal class SimpleSolarizeFilter( + override val value: Unit = Unit +) : JhFilterTransformation(), Filter.SimpleSolarize { + + override val cacheKey: String + get() = value.hashCode().toString() + + override fun createFilter(): JhFilter = SolarizeFilter() + +} \ No newline at end of file