mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-27 05:14:53 -05:00
test
This commit is contained in:
@@ -2,12 +2,13 @@ var mask = document.createElement("canvas")
|
|||||||
var maskContext = mask.getContext("2d")
|
var maskContext = mask.getContext("2d")
|
||||||
|
|
||||||
function drawMask(img, x, y, width, height, targetContext, imgMask, secondMask, arg) {
|
function drawMask(img, x, y, width, height, targetContext, imgMask, secondMask, arg) {
|
||||||
|
if (imgMask.width > 0) {
|
||||||
var context = targetContext
|
var context = targetContext
|
||||||
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) {
|
if (secondMask.src != undefined && secondMask.width > 0) {
|
||||||
maskContext.drawImage(secondMask, 0, 0, width, height)
|
maskContext.drawImage(secondMask, 0, 0, width, height)
|
||||||
if (arg == "reverseSecond") {
|
if (arg == "reverseSecond") {
|
||||||
maskContext.globalCompositeOperation = "source-out"
|
maskContext.globalCompositeOperation = "source-out"
|
||||||
@@ -15,14 +16,15 @@ function drawMask(img, x, y, width, height, targetContext, imgMask, secondMask,
|
|||||||
maskContext.globalCompositeOperation = "source-in"
|
maskContext.globalCompositeOperation = "source-in"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(width + ", " + height + " --- " + imgMask.width + ", " + imgMask.height + " --- " + img.width + ", " + img.height)
|
//console.log(width + ", " + height + " --- " + imgMask.width + ", " + imgMask.height + " --- " + img.width + ", " + img.height)
|
||||||
maskContext.drawImage(imgMask, 0, 0, width, height)
|
maskContext.drawImage(imgMask, 0, 0, width, height)
|
||||||
maskContext.globalCompositeOperation = "source-in"
|
maskContext.globalCompositeOperation = "source-in"
|
||||||
if (img.src == undefined) {
|
if (img.src == undefined) {
|
||||||
maskContext.fillStyle = img
|
maskContext.fillStyle = img
|
||||||
maskContext.fillRect(0, 0, width, height)
|
maskContext.fillRect(0, 0, width, height)
|
||||||
} else {
|
} else if (img.width > 0) {
|
||||||
maskContext.drawImage(img, 0, 0, width, height)
|
maskContext.drawImage(img, 0, 0, width, height)
|
||||||
}
|
}
|
||||||
targetContext.drawImage(mask, x, y, width, height)
|
targetContext.drawImage(mask, x, y, width, height)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@@ -528,6 +528,9 @@ a:active {
|
|||||||
|
|
||||||
|
|
||||||
<script crossorigin="anonymous">
|
<script crossorigin="anonymous">
|
||||||
|
//Need to do these things first!
|
||||||
|
cardWidth = 749
|
||||||
|
cardHeight = 1044
|
||||||
//Create the canvas for creating the border image
|
//Create the canvas for creating the border image
|
||||||
var borderCanvas = document.createElement("canvas")
|
var borderCanvas = document.createElement("canvas")
|
||||||
var border = borderCanvas.getContext("2d")
|
var border = borderCanvas.getContext("2d")
|
||||||
|
Reference in New Issue
Block a user