diff --git a/app/app.global.css b/app/app.global.css index ffecc43..53da2a8 100644 --- a/app/app.global.css +++ b/app/app.global.css @@ -45,3 +45,7 @@ html { canvas { cursor: pointer; } + +.filters { + color: darkviolet; +} diff --git a/app/containers/Editor.js b/app/containers/Editor.js index 868e570..2a84089 100644 --- a/app/containers/Editor.js +++ b/app/containers/Editor.js @@ -2,6 +2,8 @@ import React, { Component } from 'react'; import Button from '@material-ui/core/Button'; import Grid from '@material-ui/core/Grid'; import CircularProgress from '@material-ui/core/CircularProgress'; +import Slider from '@material-ui/lab/Slider'; +import Tooltip from '@material-ui/core/Tooltip'; import thumbnail from '../images/thumbnail.svg'; class Editor extends Component { @@ -9,7 +11,15 @@ class Editor extends Component { selectedFile: null, fileName: '', imageUploaded: false, - processing: false + processing: false, + hue: 0, + contrast: 0, + vibrance: 0, + sepia: 0, + saturation: 0, + brightness: 0, + noise: 0, + stackBlur: 0 }; componentDidMount() { @@ -67,7 +77,6 @@ class Editor extends Component { label: 'Jarques', name: 'jarques' }, - { label: 'Sin City', name: 'sinCity' @@ -117,6 +126,18 @@ class Editor extends Component { } }; + applyFilter = value => { + const { imageUploaded, selectedFile } = this.state; + if (!imageUploaded) { + return; + } + this.setState(value); + window.Caman('canvas', selectedFile, result => { + const [key] = Object.keys(value); + result[key](value[key]).render(); + }); + }; + applyEffect = effectName => { const { imageUploaded, selectedFile } = this.state; if (!imageUploaded) { @@ -165,6 +186,16 @@ class Editor extends Component { if (!imageUploaded) { return; } + this.setState({ + hue: 0, + noise: 0, + contrast: 0, + vibrance: 0, + sepia: 0, + saturation: 0, + brightness: 0, + stackBlur: 0 + }); window.Caman('canvas', selectedFile, result => { result.revert(); }); @@ -197,6 +228,16 @@ class Editor extends Component { render() { const { processing } = this.state; + const { + hue, + contrast, + vibrance, + sepia, + saturation, + brightness, + stackBlur, + noise + } = this.state; return ( @@ -265,6 +306,136 @@ class Editor extends Component { alignItems="center" direction="column" > + + +
+ Hue + { + this.applyFilter({ + hue: value + }); + }} + /> +
+
+ +
+ Contrast + { + this.applyFilter({ + contrast: value + }); + }} + /> +
+
+ +
+ StackBlur + { + this.applyFilter({ + stackBlur: value + }); + }} + /> +
+
+ +
+ Noise + { + this.applyFilter({ + noise: value + }); + }} + /> +
+
+ +
+ Vibrance + { + this.applyFilter({ + vibrance: value + }); + }} + /> +
+
+ +
+ Sepia + { + this.applyFilter({ + sepia: value + }); + }} + /> +
+
+ +
+ Brightness + { + this.applyFilter({ + brightness: value + }); + }} + /> +
+
+ +
+ Saturation + { + this.applyFilter({ + saturation: value + }); + }} + /> +
+
+