Added Reduce Noise, Simple Solarize filters

This commit is contained in:
T8RIN
2025-07-21 02:40:52 +03:00
parent 7676c0dd89
commit b55a8ff95e
8 changed files with 133 additions and 1 deletions

View File

@ -282,6 +282,8 @@ interface Filter<Value> : VisibilityOwner {
interface Pinch : Filter<PinchParams> interface Pinch : Filter<PinchParams>
interface Pointillize : Filter<VoronoiCrystallizeParams> interface Pointillize : Filter<VoronoiCrystallizeParams>
interface PolarCoordinates : Filter<PolarCoordinatesType> interface PolarCoordinates : Filter<PolarCoordinatesType>
interface ReduceNoise : SimpleFilter
interface SimpleSolarize : SimpleFilter
} }
interface SimpleFilter : Filter<Unit> interface SimpleFilter : Filter<Unit>

View File

@ -125,7 +125,9 @@ sealed class UiFilter<T>(
UiSobelSimpleFilter(), UiSobelSimpleFilter(),
UiLaplacianSimpleFilter(), UiLaplacianSimpleFilter(),
UiDespeckleFilter(), UiDespeckleFilter(),
UiEqualizeFilter() UiEqualizeFilter(),
UiReduceNoiseFilter(),
UiSimpleSolarizeFilter(),
), ),
listOf( listOf(
UiHueFilter(), UiHueFilter(),

View File

@ -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 <http://www.apache.org/licenses/LICENSE-2.0>.
*/
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<Unit>(
title = R.string.reduce_noise,
value = value
), Filter.ReduceNoise

View File

@ -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 <http://www.apache.org/licenses/LICENSE-2.0>.
*/
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<Unit>(
title = R.string.simple_solarize,
value = value
), Filter.SimpleSolarize

View File

@ -1692,4 +1692,6 @@
<string name="rect_to_polar">Rect to polar</string> <string name="rect_to_polar">Rect to polar</string>
<string name="polar_to_rect">Polar to rect</string> <string name="polar_to_rect">Polar to rect</string>
<string name="invert_in_circle">Invert in circle</string> <string name="invert_in_circle">Invert in circle</string>
<string name="reduce_noise">Reduce Noise</string>
<string name="simple_solarize">Simple Solarize</string>
</resources> </resources>

View File

@ -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.RainbowWorldFilter
import com.t8rin.imagetoolbox.feature.filters.data.model.RandomDitheringFilter 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.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.RemoveColorFilter
import com.t8rin.imagetoolbox.feature.filters.data.model.ReplaceColorFilter import com.t8rin.imagetoolbox.feature.filters.data.model.ReplaceColorFilter
import com.t8rin.imagetoolbox.feature.filters.data.model.RetroYellowFilter 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.SierraLiteDitheringFilter
import com.t8rin.imagetoolbox.feature.filters.data.model.SimpleOldTvFilter 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.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.SimpleThresholdDitheringFilter
import com.t8rin.imagetoolbox.feature.filters.data.model.SketchFilter import com.t8rin.imagetoolbox.feature.filters.data.model.SketchFilter
import com.t8rin.imagetoolbox.feature.filters.data.model.SmoothToonFilter 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.Pinch -> PinchFilter(value)
is Filter.Pointillize -> PointillizeFilter(value) is Filter.Pointillize -> PointillizeFilter(value)
is Filter.PolarCoordinates -> PolarCoordinatesFilter(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}") else -> throw IllegalArgumentException("No filter implementation for interface ${filter::class.simpleName}")
} }

View File

@ -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 <http://www.apache.org/licenses/LICENSE-2.0>.
*/
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()
}

View File

@ -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 <http://www.apache.org/licenses/LICENSE-2.0>.
*/
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()
}