Created
October 13, 2020 19:46
-
-
Save ljmotta/d69e1ecaa703e60a21340983d7909cf3 to your computer and use it in GitHub Desktop.
Base64Png Editor Update Filter
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
/** | |
* Preferable use the state control current edit values. | |
*/ | |
useEffect(() => { | |
const ctx = canvasRef.current?.getContext("2d")!; | |
ctx.filter = stateControl.getCurrentBase64PngEdit()?.filter ?? `invert(${invert}%)`; | |
ctx.drawImage(imageRef.current!, 0, 0); | |
setEditorContent(canvasRef.current!.toDataURL().split(",")[1]); | |
}, [invert, stateControl]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment