mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-27 05:14:53 -05:00
Add files via upload
This commit is contained in:
@@ -1,13 +1,26 @@
|
|||||||
var mask = document.createElement("canvas")
|
var mask = document.createElement("canvas")
|
||||||
var maskContext = mask.getContext("2d")
|
var maskContext = mask.getContext("2d")
|
||||||
|
|
||||||
function drawMask(img, x, y, width, height, imgMask){
|
function drawMask(img, x, y, width, height, imgMask, secondMask, arg) {
|
||||||
mask.width = width
|
mask.width = width
|
||||||
mask.height = height
|
mask.height = height
|
||||||
maskContext.clearRect(0, 0, width, height)
|
maskContext.clearRect(0, 0, width, height)
|
||||||
maskContext.globalCompositeOperation = "source-over"
|
maskContext.globalCompositeOperation = "source-over"
|
||||||
|
if (secondMask.src != undefined) {
|
||||||
|
maskContext.drawImage(secondMask, 0, 0, width, height)
|
||||||
|
if (arg == "reverseSecond") {
|
||||||
|
maskContext.globalCompositeOperation = "source-out"
|
||||||
|
} else {
|
||||||
|
maskContext.globalCompositeOperation = "source-in"
|
||||||
|
}
|
||||||
|
}
|
||||||
maskContext.drawImage(imgMask, 0, 0, width, height)
|
maskContext.drawImage(imgMask, 0, 0, width, height)
|
||||||
maskContext.globalCompositeOperation = "source-atop"
|
maskContext.globalCompositeOperation = "source-in"
|
||||||
|
if (img.src == undefined) {
|
||||||
|
maskContext.fillStyle = img
|
||||||
|
maskContext.fillRect(0, 0, width, height)
|
||||||
|
} else {
|
||||||
maskContext.drawImage(img, 0, 0, width, height)
|
maskContext.drawImage(img, 0, 0, width, height)
|
||||||
|
}
|
||||||
card.drawImage(mask, x, y, width, height)
|
card.drawImage(mask, x, y, width, height)
|
||||||
}
|
}
|
Reference in New Issue
Block a user