Skip to content

Instantly share code, notes, and snippets.

@Jorger
Created September 11, 2018 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jorger/1b60d19f92cae9dc38cf9d267ab946fd to your computer and use it in GitHub Desktop.
Save Jorger/1b60d19f92cae9dc38cf9d267ab946fd to your computer and use it in GitHub Desktop.
//Se carga la imagen en el canvas copia...
ctxCopy.clearRect(0, 0, 100, 100);
ctxCopy.drawImage(figures[dataPipe[2] - 1].i, 0, 0, width, width);
//Se aplica el color si es necesario...
if (dataPipe[4] !== "") {
ctxCopy.globalCompositeOperation = "source-atop";
//Color a aplicar...
ctxCopy.fillStyle = dataPipe[4];
ctxCopy.fillRect(0, 0, width, width);
}
//Se carga la imagen después de la transformación
ctx.drawImage(canvasCopy, 0, 0);
//Se reestablece la propiedad por defecto...
ctxCopy.globalCompositeOperation = "source-over";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment