Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Base64Png Editor Update Filter
/**
* 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