-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supports: - Cropping - Adjustments (Brightness, Contrast..) - Filters - Markup (Drawing) Also adds tablet/landscape optimised layout Fixes Image editing #1 Fixes [Enhancement] Editor: Drawing #351 Fixes [BUG] Can't crop when I'm not holding makred corners #406 Fixes [Improvement] Cropping #441 Fixes [Enhancement] Please add draw support to edits #494 Signed-off-by: IacobIonut01 <[email protected]>
- Loading branch information
1 parent
7021c43
commit 700af0f
Showing
130 changed files
with
4,726 additions
and
6,268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
app/src/main/kotlin/com/dot/gallery/feature_node/domain/model/ImageFilter.kt
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
app/src/main/kotlin/com/dot/gallery/feature_node/domain/model/ImageModification.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app/src/main/kotlin/com/dot/gallery/feature_node/domain/model/editor/Adjustment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.dot.gallery.feature_node.domain.model.editor | ||
|
||
import android.graphics.Bitmap | ||
import androidx.annotation.Keep | ||
import com.dot.gallery.feature_node.presentation.util.sentenceCase | ||
|
||
@Keep | ||
interface Adjustment { | ||
fun apply(bitmap: Bitmap): Bitmap | ||
|
||
val name: String get() = this::class.simpleName.toString().sentenceCase() | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/kotlin/com/dot/gallery/feature_node/domain/model/editor/CropState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.dot.gallery.feature_node.domain.model.editor | ||
|
||
import android.os.Parcelable | ||
import androidx.compose.runtime.Immutable | ||
import kotlinx.parcelize.Parcelize | ||
import kotlinx.serialization.Serializable | ||
|
||
@Immutable | ||
@Serializable | ||
@Parcelize | ||
data class CropState( | ||
val isCropping: Boolean = false, | ||
val showCropper: Boolean = false | ||
) : Parcelable |
31 changes: 31 additions & 0 deletions
31
app/src/main/kotlin/com/dot/gallery/feature_node/domain/model/editor/CropperAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.dot.gallery.feature_node.domain.model.editor; | ||
|
||
import androidx.annotation.Keep; | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.automirrored.outlined.RotateRight | ||
import androidx.compose.material.icons.outlined.Crop | ||
import androidx.compose.material.icons.outlined.Flip | ||
import androidx.compose.ui.graphics.vector.ImageVector; | ||
import com.dot.gallery.feature_node.presentation.edit.adjustments.Flip | ||
import com.dot.gallery.feature_node.presentation.edit.adjustments.Rotate90CW | ||
|
||
@Keep | ||
enum class CropperAction { | ||
ROTATE_90, CROP, FLIP; | ||
|
||
val icon: ImageVector | ||
get() = when (this) { | ||
CROP -> Icons.Outlined.Crop | ||
ROTATE_90 -> Icons.AutoMirrored.Outlined.RotateRight | ||
FLIP -> Icons.Outlined.Flip | ||
} | ||
|
||
|
||
fun asAdjustment(): Adjustment? { | ||
return when (this) { | ||
ROTATE_90 -> Rotate90CW(90f) | ||
FLIP -> Flip(horizontal = true) | ||
else -> null | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
app/src/main/kotlin/com/dot/gallery/feature_node/domain/model/editor/DrawMode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.dot.gallery.feature_node.domain.model.editor | ||
|
||
enum class DrawMode { | ||
Draw, Touch, Erase | ||
} |
45 changes: 45 additions & 0 deletions
45
app/src/main/kotlin/com/dot/gallery/feature_node/domain/model/editor/EditorDestination.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.dot.gallery.feature_node.domain.model.editor | ||
|
||
import com.dot.gallery.feature_node.presentation.edit.adjustments.varfilter.VariableFilterTypes | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
sealed class EditorDestination { | ||
|
||
@Serializable | ||
data object Editor : EditorDestination() | ||
|
||
@Serializable | ||
data object Crop : EditorDestination() | ||
|
||
@Serializable | ||
data object Adjust : EditorDestination() | ||
|
||
@Serializable | ||
data class AdjustDetail(val adjustment: VariableFilterTypes) : EditorDestination() | ||
|
||
@Serializable | ||
data object Filters : EditorDestination() | ||
|
||
@Serializable | ||
data object Markup : EditorDestination() | ||
|
||
@Serializable | ||
data object MarkupDraw : EditorDestination() | ||
|
||
@Serializable | ||
data object MarkupDrawSize : EditorDestination() | ||
|
||
@Serializable | ||
data object MarkupDrawColor : EditorDestination() | ||
|
||
@Serializable | ||
data object MarkupErase : EditorDestination() | ||
|
||
@Serializable | ||
data object MarkupEraseSize : EditorDestination() | ||
|
||
@Serializable | ||
data object ExternalEditor : EditorDestination() | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
app/src/main/kotlin/com/dot/gallery/feature_node/domain/model/editor/EditorItems.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.dot.gallery.feature_node.domain.model.editor; | ||
|
||
import android.os.Parcelable | ||
import androidx.annotation.Keep | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.outlined.Adjust | ||
import androidx.compose.material.icons.outlined.Crop | ||
import androidx.compose.material.icons.outlined.Draw | ||
import androidx.compose.material.icons.outlined.Filter | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import kotlinx.parcelize.IgnoredOnParcel | ||
import kotlinx.parcelize.Parcelize | ||
import kotlinx.serialization.Serializable | ||
|
||
@Keep | ||
@Serializable | ||
@Parcelize | ||
enum class EditorItems : Parcelable { | ||
Crop, | ||
Adjust, | ||
Filters, | ||
Markup; | ||
|
||
@IgnoredOnParcel | ||
val icon: ImageVector | ||
get() = when (this) { | ||
Crop -> Icons.Outlined.Crop | ||
Adjust -> Icons.Outlined.Adjust | ||
Filters -> Icons.Outlined.Filter | ||
Markup -> Icons.Outlined.Draw | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
app/src/main/kotlin/com/dot/gallery/feature_node/domain/model/editor/ImageFilter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.dot.gallery.feature_node.domain.model.editor | ||
|
||
import androidx.annotation.Keep | ||
import androidx.compose.ui.graphics.ColorMatrix | ||
|
||
@Keep | ||
interface ImageFilter : Adjustment { | ||
|
||
fun colorMatrix(): ColorMatrix? | ||
} |
68 changes: 68 additions & 0 deletions
68
app/src/main/kotlin/com/dot/gallery/feature_node/domain/model/editor/MarkupItems.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.dot.gallery.feature_node.domain.model.editor | ||
|
||
import android.os.Parcelable | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.automirrored.outlined.Redo | ||
import androidx.compose.material.icons.automirrored.outlined.Undo | ||
import androidx.compose.material.icons.outlined.Brush | ||
import androidx.compose.material.icons.outlined.ColorLens | ||
import androidx.compose.material.icons.outlined.Draw | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import com.dot.gallery.ui.core.icons.Ink_Eraser | ||
import kotlinx.parcelize.IgnoredOnParcel | ||
import kotlinx.parcelize.Parcelize | ||
import kotlinx.serialization.Serializable | ||
import com.dot.gallery.ui.core.Icons as DotIcons | ||
|
||
@Serializable | ||
@Parcelize | ||
enum class MarkupEraseItems : Parcelable { | ||
Undo, | ||
Size, | ||
Redo; | ||
|
||
@IgnoredOnParcel | ||
val icon: ImageVector | ||
get() = when (this) { | ||
Size -> Icons.Outlined.Brush | ||
Undo -> Icons.AutoMirrored.Outlined.Undo | ||
Redo -> Icons.AutoMirrored.Outlined.Redo | ||
} | ||
} | ||
|
||
|
||
@Serializable | ||
@Parcelize | ||
enum class MarkupDrawItems : Parcelable { | ||
Undo, | ||
Size, | ||
Color, | ||
Redo; | ||
|
||
@IgnoredOnParcel | ||
val icon: ImageVector | ||
get() = when (this) { | ||
Size -> Icons.Outlined.Brush | ||
Color -> Icons.Outlined.ColorLens | ||
Undo -> Icons.AutoMirrored.Outlined.Undo | ||
Redo -> Icons.AutoMirrored.Outlined.Redo | ||
} | ||
} | ||
|
||
@Serializable | ||
@Parcelize | ||
enum class MarkupItems : Parcelable { | ||
Undo, | ||
Draw, | ||
Erase, | ||
Redo; | ||
|
||
@IgnoredOnParcel | ||
val icon: ImageVector | ||
get() = when (this) { | ||
Draw -> Icons.Outlined.Draw | ||
Erase -> DotIcons.Ink_Eraser | ||
Undo -> Icons.AutoMirrored.Outlined.Undo | ||
Redo -> Icons.AutoMirrored.Outlined.Redo | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
app/src/main/kotlin/com/dot/gallery/feature_node/domain/model/editor/PainterMotionEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.dot.gallery.feature_node.domain.model.editor | ||
|
||
enum class PainterMotionEvent { | ||
Idle, Down, Move, Up | ||
} |
34 changes: 34 additions & 0 deletions
34
app/src/main/kotlin/com/dot/gallery/feature_node/domain/model/editor/PathProperties.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.dot.gallery.feature_node.domain.model.editor | ||
|
||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.StrokeCap | ||
import androidx.compose.ui.graphics.StrokeJoin | ||
|
||
class PathProperties( | ||
var strokeWidth: Float = 20f, | ||
var color: Color = Color.Red, | ||
var alpha: Float = 1f, | ||
var strokeCap: StrokeCap = StrokeCap.Round, | ||
var strokeJoin: StrokeJoin = StrokeJoin.Round, | ||
var eraseMode: Boolean = false | ||
) { | ||
|
||
fun copy( | ||
strokeWidth: Float = this.strokeWidth, | ||
color: Color = this.color, | ||
alpha: Float = this.alpha, | ||
strokeCap: StrokeCap = this.strokeCap, | ||
strokeJoin: StrokeJoin = this.strokeJoin, | ||
eraseMode: Boolean = this.eraseMode | ||
) = PathProperties( | ||
strokeWidth, color, alpha, strokeCap, strokeJoin, eraseMode | ||
) | ||
|
||
fun copyFrom(properties: PathProperties) { | ||
this.strokeWidth = properties.strokeWidth | ||
this.color = properties.color | ||
this.strokeCap = properties.strokeCap | ||
this.strokeJoin = properties.strokeJoin | ||
this.eraseMode = properties.eraseMode | ||
} | ||
} |
Oops, something went wrong.