diff --git a/docs/app.png b/docs/app.png index a34b12d..f14cb05 100644 Binary files a/docs/app.png and b/docs/app.png differ diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 1074ba9..2aff156 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -13,8 +13,8 @@ const resultLoading = ref(false) const availableEffects = ref([]) const effectToAdd = ref(null) -const makeSetting = (label, value, min, max, step) => { - return {label, value, min, max, step} +const makeSetting = (type, label, value, options) => { + return {type, label, value, options} } const openImageFile = () => { @@ -29,80 +29,127 @@ const openImageFile = () => { availableEffects.value = [ { - label: "Crop", - name: "crop", - enabled: false, + label: "Blur", + name: "blur", + enabled: true, settings: { - x0: makeSetting("Top left X", 0, 0, info.width-1, 1), - y0: makeSetting("Top left Y", 0, 0, info.height-1, 1), - x1: makeSetting("Bottom right X", 0, 0, info.width, 1), - y1: makeSetting("Bottom right left Y", 0, 0, info.height, 1), - } - }, - { - label: "Crop center", - name: "crop-center", - enabled: false, - settings: { - width: makeSetting("Width", info.width, 0, info.width, 1), - height: makeSetting("Height", info.height, 0, info.height, 1) - } - }, - { - label: "Scale width", - name: "scale-width", - enabled: false, - settings: { - value: makeSetting("Value", info.width, 1, info.width, 1), - } - }, - { - label: "Scale height", - name: "scale-height", - enabled: false, - settings: { - value: makeSetting("Value", info.height, 1, info.height, 1), - } - }, - { - label: "Resize", - name: "resize", - enabled: false, - settings: { - width: makeSetting("Width",info.width, 1, info.width, 1), - height: makeSetting("Height", info.height, 1, info.height, 1) + value: makeSetting("number", "Value", 0, {min: 0, max: 50, step: 0.1}), } }, { label: "Brightness", name: "brightness", - enabled: false, + enabled: true, settings: { - value: makeSetting("Value", 0, -100, 100, 1), + value: makeSetting("number", "Value", 0, {min: -100, max: 100, step: 1}), + } + }, + { + label: "Crop", + name: "crop", + enabled: true, + settings: { + x0: makeSetting("number", "Top left X", 0, {min: 0, max: info.width-1, step: 1}), + y0: makeSetting("number", "Top left Y", 0, {min: 0, max: info.height-1, step: 1}), + x1: makeSetting("number", "Bottom right X", 0, {min: 1, max: info.width, step: 1}), + y1: makeSetting("number", "Bottom right left Y", 0, {min: 1, max: info.height, step: 1}), + } + }, + { + label: "Crop center", + name: "crop-center", + enabled: true, + settings: { + width: makeSetting("number", "Width", info.width, {min: 0, max: info.width, step: 1}), + height: makeSetting("number", "Height", info.height, {min: 0, max: info.height, step: 1}), } }, { label: "Contrast", name: "contrast", - enabled: false, + enabled: true, settings: { - value: makeSetting("Value", 0, -100, 100, 1), + value: makeSetting("number", "Value", 0, {min: -100, max: 100, step: 1}), } }, + { + label: "Flip horizontally", + name: "flip-h", + enabled: true, + settings: {} + }, + { + label: "Flip vertically", + name: "flip-v", + enabled: true, + settings: {} + }, + { + label: "Resize", + name: "resize", + enabled: true, + settings: { + width: makeSetting("number", "Width", info.width, {min: 1, max: info.width, step: 1}), + height: makeSetting("number", "Height", info.height, {min: 1, max: info.height, step: 1}), + } + }, + { + label: "Rotate", + name: "rotate", + enabled: true, + settings: { + value: makeSetting("number", "Value", 0, {min: 0, max: 360, step: 1}), + backgroundColor: makeSetting("color", "Background", "#ffffff", {}), + } + }, + { + label: "Rotate 90", + name: "rotate-90", + enabled: true, + settings: {} + }, + { + label: "Rotate 180", + name: "rotate-180", + enabled: true, + settings: {} + }, + { + label: "Rotate 270", + name: "rotate-270", + enabled: true, + settings: {} + }, { label: "Saturation", name: "saturation", - enabled: false, + enabled: true, settings: { value: makeSetting("Value", 0, -100, 100, 1), } }, { - label: "Blur", - name: "blur", - enabled: false, + label: "Scale height", + name: "scale-height", + enabled: true, settings: { - value: makeSetting("Value", 0, 0, 50, 0.1), + value: makeSetting("Value", info.height, 1, info.height, 1), + } + }, + { + label: "Scale width", + name: "scale-width", + enabled: true, + settings: { + value: makeSetting("Value", info.width, 1, info.width, 1), + } + }, + { + label: "Quality", + name: "quality", + enabled: true, + settings: { + value: makeSetting("Value", 100, 0, 100, 1), } }, ] @@ -133,7 +180,7 @@ const appliedEffects = () => { } for (let setting in effect.settings) { - item.settings[setting] = parseFloat(effect.settings[setting].value) + item.settings[setting] = effect.settings[setting].value } result.push(item) @@ -193,6 +240,12 @@ const deleteEffect = (index) => { effects.value.splice(index, 1) } +const getAvailableEffects = () => { + return availableEffects.value.sort((a, b) => { + return a.label > b.label ? 1 : -1 + }) +} + onMounted(openImageFile) @@ -224,20 +277,32 @@ onMounted(openImageFile)
- - - {{ setting.label }} +
+ {{ setting.label }} +
+ +
+ + +
+
+ +
@@ -247,7 +312,7 @@ onMounted(openImageFile)