This commit is contained in:
Kyle
2018-10-28 19:10:23 -07:00
parent f9b854c728
commit c3941d5aa7
48 changed files with 210 additions and 122 deletions

View File

@@ -47,4 +47,4 @@ loadColors("white-White,whiteLand-White Land,blue-Blue,blueLand-Blue Land,black-
document.getElementById("secondColorSelection").innerHTML = document.getElementById("colorSelection").innerHTML document.getElementById("secondColorSelection").innerHTML = document.getElementById("colorSelection").innerHTML
document.getElementById("thirdColorSelection").innerHTML = document.getElementById("colorSelection").innerHTML document.getElementById("thirdColorSelection").innerHTML = document.getElementById("colorSelection").innerHTML
updateBorder() finishTemplate()

View File

@@ -7,8 +7,19 @@ var nyxBorder = false
var miracleBorder = false var miracleBorder = false
var stampBorder = false var stampBorder = false
var flipBorder = false var flipBorder = false
var creatureBorder = true
var thirdBorder = true
var secondBorder = true
//Shifted text
titleRightShift = 0 titleRightShift = 0
typeRightShift = 0 typeRightShift = 0
//Aligned text
var titleAlign = "left"
var typeAlign = "left"
//Image alignment
var centerSetSymbol = 1 //1=not centered, 2=centered
var artX = 58
var artY = 118
//Loads the correct border data //Loads the correct border data
borderPath = "data/borders/" + document.getElementById("borderSelection").value borderPath = "data/borders/" + document.getElementById("borderSelection").value
loadScript(borderPath + "border.js") loadScript(borderPath + "border.js")

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -56,5 +56,5 @@ nyxBorder = true
miracleBorder = true miracleBorder = true
flipBorder = true flipBorder = true
//With all the new values in place, the program will update it's border images //With all the new values in place, the program will update it's border images
updateBorder() finishTemplate()
//Any special functions go at the bottom //Any special functions go at the bottom

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -0,0 +1,59 @@
//Map Border
//Anything to do with...
//Card Title
var titleFont = "40px belerenbsc"
var titleFontSpacing = "0.1px"
var titleX = 374.5
var titleY = 52
var titleAlign = "center"
//Mana Cost
var manaCostRadius = 17.5
var manaCostX = 657
var manaCostY = 59
//Card Type
var typeFont = "33.5px belerenb"
var typeFontSpacing = "0.05px"
var typeX = 374.5
var typeY = 598
var typeAlign = "center"
//Rules/Flavor Text
var textFont = "px mplantin"
var textFontSpacing = 1.1
var textX = 89
var textY = 662
var textWidth = 660
//Power Toughness
var ptFont = "39px belerenb"
var ptFontSpacing = "0.3px"
var ptTextX = 645
var ptTextY = 936
var ptX = 571
var ptY = 929
var ptWidth = 137
var ptHeight = 75
//Bottom Info
var eighthInfo = false
var eighthInfoY = 992
var m15Info = true
var m15InfoY = 993
//Set Symbol
var setSymbolY = 123
var setSymbolRight = 374.5
var setSymbolWidth = 66
var setSymbolHeight = 44
var centerSetSymbol = 2
//Watermark
var watermarkWidth = 520
var watermarkHeight = 250
var watermarkY = 805
//Color Options
loadColors("white-White,whiteLand-White Land,blue-Blue,blueLand-Blue Land,black-Black,blackLand-Black Land,red-Red,redLand-Red Land,green-Green,greenLand-Green Land,gold-Gold,goldLand-Gold Land,colorless-Colorless,colorlessLand-Colorless Land,artifact-Artifact")
document.getElementById("secondColorSelection").innerHTML = document.getElementById("colorSelection").innerHTML
document.getElementById("thirdColorSelection").innerHTML = document.getElementById("colorSelection").innerHTML
//Other
var thirdBorder = false
var artX = 30
var artY = 116
//With all the new values in place, the program will update it's border images
finishTemplate()
//Any special functions go at the bottom

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 KiB

BIN
data/borders/map/red/pt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -1,7 +1,8 @@
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, secondMask, arg) { function drawMask(img, x, y, width, height, targetContext, imgMask, secondMask, arg) {
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)
@@ -22,5 +23,5 @@ function drawMask(img, x, y, width, height, imgMask, secondMask, arg) {
} else { } else {
maskContext.drawImage(img, 0, 0, width, height) maskContext.drawImage(img, 0, 0, width, height)
} }
card.drawImage(mask, x, y, width, height) targetContext.drawImage(mask, x, y, width, height)
} }

View File

@@ -19,36 +19,38 @@
<div class="toggler" onclick="toggleSection(this)">Card Border</div> <div class="toggler" onclick="toggleSection(this)">Card Border</div>
<div class="togglee shown"> <div class="togglee shown">
Border Border
<select id="borderSelection" onchange="changeBorder()"> <select id="borderSelection" onchange="changeTemplate()">
<option value="map/">Map (Ixalan)</option>
<option value="m15/">M15</option> <option value="m15/">M15</option>
<option value="8th/">8th</option> <option value="8th/">8th</option>
</select> </select>
<br/> <br/>
Color Color
<select id="colorSelection" onchange="updateColor()"> <select id="colorSelection" onchange="updateBorder()">
<option value="white">White</option> <option value="white">White</option>
</select> </select>
<br/> <br/>
<input type="checkbox" id="checkboxSecondColor" onchange="updateColor()">Second Color <select id="secondColorSelection" onchange="updateColor()"></select></input> <input type="checkbox" id="checkboxSecondColor" onchange="updateBorder()">Second Color <select id="secondColorSelection" onchange="updateBorder()"></select></input>
<br/> <br/>
<input type="checkbox" id="checkboxThirdColor" onchange="updateColor()">Third Color <select id="thirdColorSelection" onchange="updateColor()"></select></input> <input type="checkbox" id="checkboxThirdColor" onchange="updateBorder()">Third Color <select id="thirdColorSelection" onchange="updateBorder()"></select></input>
<br/> <br/>
<input type="checkbox" id="checkboxCreature" onchange="updateColor()">Power/Toughness <input type="checkbox" id="checkboxCreature" onchange="updateBorder()">Power/Toughness
<input id="inputPowerToughness" value="" type="text"></input> <input id="inputPowerToughness" value="" type="text"></input>
</div> </div>
</div> </div>
<div class="section"> <div class="section">
<div class="toggler" onclick="toggleSection(this)">Border (Advanced)</div> <div class="toggler" onclick="toggleSection(this)">Border (Advanced)</div>
<div class="togglee"> <div class="togglee">
<input type="checkbox" id="checkboxLegendary" onchange="updateColor()">Legendary</input> <input type="checkbox" id="checkboxLegendary" onchange="updateBorder()">Legendary</input>
<br/> <br/>
<input type="checkbox" id="checkboxNyx" onchange="updateColor()">Nyx</input> <input type="checkbox" id="checkboxNyx" onchange="updateBorder()">Nyx</input>
<br/> <br/>
<input type="checkbox" id="checkboxMiracle" onchange="updateColor()">Miracle</input> <input type="checkbox" id="checkboxMiracle" onchange="updateBorder()">Miracle</input>
<br/> <br/>
<input type="checkbox" id="checkboxRareStamp" onchange="updateColor()">Rare Stamp</input> <input type="checkbox" id="checkboxRareStamp" onchange="updateBorder()">Rare Stamp</input>
<br/> <br/>
<input type="checkbox" id="checkboxFlipIcon" onchange="updateColor()">Flip Icon <select id="inputFlipIcon" onchange="updateColor()"> <input type="checkbox" id="checkboxFlipIcon" onchange="updateBorder()">Flip Icon <select id="inputFlipIcon" onchange="updateBorder()">
<option value="blank.png">Blank</option> <option value="blank.png">Blank</option>
<option value="day.png">Day</option> <option value="day.png">Day</option>
<option value="night.png">Night</option> <option value="night.png">Night</option>
@@ -58,19 +60,19 @@
<option value="planeswalker.png">Planeswalker</option> <option value="planeswalker.png">Planeswalker</option>
</select></input> </select></input>
<br/> <br/>
<input type="checkbox" id="checkboxFlipTip" onchange="updateColor()">Flip Tip <input type="checkbox" id="checkboxFlipTip" onchange="updateBorder()">Flip Tip
<input id="inputFlipTip" value="" type="text"></input> <input id="inputFlipTip" value="" type="text"></input>
<br/> <br/>
<input type="checkbox" id="checkboxFlippedDark" onchange="updateColor()">Flipped (Darker)</input> <input type="checkbox" id="checkboxFlippedDark" onchange="updateBorder()">Flipped (Darker)</input>
<br/> <br/>
<input type="checkbox" id="checkboxSilverBorder">Silver Border</input> <input type="checkbox" id="checkboxSilverBorder" onchange="updateBorder()">Silver Border</input>
<br/> <br/>
<input type="color" id="inputColor"> Border Color</input> <input type="color" id="inputColor" onchange="updateBorder()"> Border Color</input>
<br/> <br/>
<input type="checkbox" id="checkboxFoil">Foil</input> <input type="checkbox" id="checkboxFoil">Foil</input>
<br/> <br/>
<input type="checkbox" id="checkboxIdentity">Color Identity <input type="checkbox" id="checkboxIdentity" onchange="updateBorder()">Color Identity
<input id="inputIdentity"type="text"></input> <input id="inputIdentity" type="text" onchange="updateBorder()"></input>
</div> </div>
</div> </div>
<div class="section"> <div class="section">
@@ -427,8 +429,12 @@ a:active {
<script crossorigin="anonymous"> <script crossorigin="anonymous">
//Create the canvas for creating the border image
var borderCanvas = document.createElement("canvas")
borderCanvas.width = 749; borderCanvas.height = 1044
var border = borderCanvas.getContext("2d")
//Load the initial border (m15) //Load the initial border (m15)
changeBorder() changeTemplate()
//set up initial variables //set up initial variables
var borderPath var borderPath
var secondColor var secondColor
@@ -439,13 +445,13 @@ var typeRightShift = 0
var canvas = document.getElementById("canvas") var canvas = document.getElementById("canvas")
var card = canvas.getContext("2d") var card = canvas.getContext("2d")
//Load dynamic images //Load dynamic images
var dynamicImageList = ["borderColor", "secondBorderColor", "thirdBorderColor", "borderCreature", "borderLegendary", "secondBorderLegendary", "borderRareStamp", "secondBorderRareStamp", "art", "setSymbol", "watermark", "multiMask", "rareStampMask", "frameMask", "legendFrameMask", "borderMask", "borderNyx", "secondBorderNyx", "borderMiracle", "secondBorderMiracle", "borderFlipIcon", "borderFlipCircle", "borderFlipTip", "borderFlippedDark", "secondBorderFlippedDark"] var dynamicImageList = ["art", "setSymbol", "watermark", "multiMask", "rareStampMask", "frameMask", "legendFrameMask", "borderMask", "border", "borderColor", "secondBorderColor", "thirdBorderColor", "borderCreature", "borderLegendary", "secondBorderLegendary", "borderRareStamp", "secondBorderRareStamp", "borderNyx", "secondBorderNyx", "borderMiracle", "secondBorderMiracle", "borderFlipIcon", "borderFlipCircle", "borderFlipTip", "borderFlippedDark", "secondBorderFlippedDark", "artMask"]
for (i = 0; i < dynamicImageList.length; i ++) { for (i = 0; i < dynamicImageList.length; i ++) {
var imgName = "img" + dynamicImageList[i].charAt(0).toUpperCase() + dynamicImageList[i].slice(1) var imgName = "img" + dynamicImageList[i].charAt(0).toUpperCase() + dynamicImageList[i].slice(1)
window[imgName] = new Image() window[imgName] = new Image()
} }
//Load static images //Load static images
var staticImageList = ["artistBrush", "foil", "stampGradient", "multiGradient", "rareStamp", "cardMask", "artMask", "bar", "identity"] var staticImageList = ["artistBrush", "foil", "stampGradient", "multiGradient", "rareStamp", "cardMask", "bar", "identity"]
for (i = 0; i < staticImageList.length; i ++) { for (i = 0; i < staticImageList.length; i ++) {
var imgName = "img" + staticImageList[i].charAt(0).toUpperCase() + staticImageList[i].slice(1) var imgName = "img" + staticImageList[i].charAt(0).toUpperCase() + staticImageList[i].slice(1)
window[imgName] = new Image() window[imgName] = new Image()
@@ -470,19 +476,17 @@ document.getElementById("secondWatermarkColorSelection").innerHTML = document.ge
function cardClock() { function cardClock() {
//Insures that the corners of the final image are transparent //Insures that the corners of the final image are transparent
card.globalCompositeOperation = "source-over" card.globalCompositeOperation = "source-over"
drawMask(document.getElementById("inputColor").value, 0, 0, canvas.width, canvas.height, imgCardMask, false, false) drawMask(document.getElementById("inputColor").value, 0, 0, canvas.width, canvas.height, card, imgCardMask, false, false)
card.globalCompositeOperation = "source-atop" card.globalCompositeOperation = "source-atop"
//Draws the card image, then... //Draws the card image, then...
drawPicture() drawPicture()
//redraws the colored border in case the image is too big. //draws the card frame on top
drawMask(document.getElementById("inputColor").value, 0, 0, canvas.width, canvas.height, imgCardMask, imgArtMask, false) drawMask(imgBorder, 0, 0, canvas.width, canvas.height, card, imgArtMask, false, false)
//draws the card frames
drawBorder()
//draws the set symbol, mana cost, and watermark //draws the set symbol, mana cost, and watermark
drawSetSymbol() drawSetSymbol()
drawManaCost() drawManaCost()
drawWatermark() drawWatermark()
//writes all the text. name, type, rules... //writes all the text: name, type, rules...
writeText() writeText()
//m15 and 8th edition have different info at the bottom of the cards and require completely different functions //m15 and 8th edition have different info at the bottom of the cards and require completely different functions
if (m15Info == true) { if (m15Info == true) {
@@ -507,15 +511,17 @@ function cardClock() {
// card.lineTo(749, setSymbolY) // card.lineTo(749, setSymbolY)
// card.stroke() // card.stroke()
} }
//Sets up the initial clock
var cardClockInterval = setInterval(cardClock, 1000 / document.getElementById("inputFPS").value) var cardClockInterval = setInterval(cardClock, 1000 / document.getElementById("inputFPS").value)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//The two following functions load different types of borders /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function changeBorder() { //The two following functions load border images
function changeTemplate() {
//the loadScript function is located in data/scripts/loadScript.js. It sets values to variables such as set symbol coordinates or title font //the loadScript function is located in data/scripts/loadScript.js. It sets values to variables such as set symbol coordinates or title font
loadScript("data/borders/defaultBorder.js") loadScript("data/borders/defaultBorder.js")
} }
function updateBorder() { function finishTemplate() {
//This is a seperate function to insure that the border.js file finishes running before running a few last commands //This is a seperate function to insure that the border.js file finishes running before running a few last commands
document.getElementById("colorSelection").value = "white" document.getElementById("colorSelection").value = "white"
imgMultiMask.src = borderPath + "multiMask.png" imgMultiMask.src = borderPath + "multiMask.png"
@@ -527,10 +533,10 @@ function updateBorder() {
} else if (eighthInfo == true) { } else if (eighthInfo == true) {
imgBorderMask.src = borderPath + "frameMask.png" imgBorderMask.src = borderPath + "frameMask.png"
} }
updateColor() updateBorder()
} }
//Loads the images for the card frame, power toughness box, and rare stamp //Loads the images for the card frame, power toughness box, and rare stamp
function updateColor() { function updateBorder() {
borderPath = "data/borders/" + document.getElementById("borderSelection").value borderPath = "data/borders/" + document.getElementById("borderSelection").value
secondColor = document.getElementById("checkboxSecondColor").checked secondColor = document.getElementById("checkboxSecondColor").checked
thirdColor = document.getElementById("checkboxThirdColor").checked thirdColor = document.getElementById("checkboxThirdColor").checked
@@ -538,14 +544,15 @@ function updateColor() {
var secondColorPath = borderPath + document.getElementById("secondColorSelection").value var secondColorPath = borderPath + document.getElementById("secondColorSelection").value
var thirdColorPath = borderPath + document.getElementById("thirdColorSelection").value var thirdColorPath = borderPath + document.getElementById("thirdColorSelection").value
var altframe = "" var altframe = ""
imgArtMask.src = borderPath + "artMask.png"
imgBorderColor.src = firstColorPath + "/frame.png"
imgSecondBorderColor.src = secondColorPath + "/frame.png"
imgThirdBorderColor.src = thirdColorPath + "/frame.png"
if (document.getElementById("checkboxFlippedDark").checked == true && flipBorder == true) { if (document.getElementById("checkboxFlippedDark").checked == true && flipBorder == true) {
altframe = "dark" altframe = "dark"
} else { } else {
altframe = "" altframe = ""
} }
imgBorderColor.src = firstColorPath + "/frame.png"
imgSecondBorderColor.src = secondColorPath + "/frame.png"
imgThirdBorderColor.src = thirdColorPath + "/frame.png"
if (thirdColor == true) { if (thirdColor == true) {
imgBorderCreature.src = thirdColorPath + "/" + altframe + "pt.png" imgBorderCreature.src = thirdColorPath + "/" + altframe + "pt.png"
} else if (secondColor == true) { } else if (secondColor == true) {
@@ -592,90 +599,85 @@ function updateColor() {
imgBorderFlipCircle.src = firstColorPath + "/flipCircle.png" imgBorderFlipCircle.src = firstColorPath + "/flipCircle.png"
imgBorderFlipIcon.src = "data/borders/icons/" + document.getElementById("inputFlipIcon").value imgBorderFlipIcon.src = "data/borders/icons/" + document.getElementById("inputFlipIcon").value
} }
//This creates a short pause in order to allow all images to finish loading
imgBorderColor.onload = function() {
setTimeout(createBorder, 50)
} }
//Draw Picture
function drawPicture() {
//scales the card art and draws it
var imageScale = document.getElementById("imageSize").value * 0.01
var imageLeftShift = parseInt(document.getElementById("imageLeft").value)
var imageUpShift = parseInt(document.getElementById("imageUp").value)
if (imgArt.width > 0) {
//drawMask(imgArt, 58 - imageLeftShift, 118 - imageUpShift, imgArt.width * imageScale, imgArt.height * imageScale, imgArtMask, false, false)
} }
card.drawImage(imgArt, 58 - imageLeftShift, 118 - imageUpShift, imgArt.width * imageScale, imgArt.height * imageScale) //Once the border images have finished loading, they are all drawn into a temporary canvas then saved to a single image
} function createBorder() {
//Draw Border //These if else statements check to see whether or not to draw different parts of the card, like the legendary border or rare stamp, and draws them in the appropriate order so that when multiple border colors are used the gradients overlap correctly
function drawBorder() { //BACKGROUND COLOR
//These if else statements check to see whether or not to draw different parts of the card, like the legendary border or rare stamp, and draws them in the appropriate order such that when multiple border colors are used the gradients overlap correctly drawMask(document.getElementById("inputColor").value, 0, 0, canvas.width, canvas.height, border, imgCardMask, false, false)
//MAIN CARD FRAME //MAIN CARD FRAME
drawMask(imgBorderColor, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false) drawMask(imgBorderColor, 0, 0, canvas.width, canvas.height, border, imgFrameMask, false, false)
if (secondColor == true) { if (secondColor == true && secondBorder == true) {
drawMask(imgSecondBorderColor, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiGradient, "reverseSecond") drawMask(imgSecondBorderColor, 0, 0, canvas.width, canvas.height, border, imgFrameMask, imgMultiGradient, "reverseSecond")
} }
if (thirdColor == true) { if (thirdColor == true && thirdBorder == true) {
drawMask(imgThirdBorderColor, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiMask, false) drawMask(imgThirdBorderColor, 0, 0, canvas.width, canvas.height, border, imgFrameMask, imgMultiMask, false)
} }
//Draws the silver border usually on un-cards //Draws the silver border usually on un-cards
if (document.getElementById("checkboxSilverBorder").checked == true) { if (document.getElementById("checkboxSilverBorder").checked == true) {
drawMask("#a3aeb7", 0, 0, canvas.width, canvas.height, imgBorderMask, imgFrameMask, "reverseSecond") drawMask("#a3aeb7", 0, 0, canvas.width, canvas.height, border, imgBorderMask, imgFrameMask, "reverseSecond")
} }
//NYX //NYX
if (document.getElementById("checkboxNyx").checked == true && nyxBorder == true) { if (document.getElementById("checkboxNyx").checked == true && nyxBorder == true) {
if (thirdColor == true) { if (thirdColor == true) {
drawMask(imgBorderNyx, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiMask, false) drawMask(imgBorderNyx, 0, 0, canvas.width, canvas.height, border, imgFrameMask, imgMultiMask, false)
} else { } else {
drawMask(imgBorderNyx, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false) drawMask(imgBorderNyx, 0, 0, canvas.width, canvas.height, border, imgFrameMask, false, false)
if (secondColor == true) { if (secondColor == true) {
drawMask(imgSecondBorderNyx, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiGradient, "reverseSecond") drawMask(imgSecondBorderNyx, 0, 0, canvas.width, canvas.height, border, imgFrameMask, imgMultiGradient, "reverseSecond")
} }
} }
} }
//MIRACLE //MIRACLE
if (document.getElementById("checkboxMiracle").checked == true && miracleBorder == true) { if (document.getElementById("checkboxMiracle").checked == true && miracleBorder == true) {
if (thirdColor == true) { if (thirdColor == true) {
drawMask(imgBorderMiracle, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false) drawMask(imgBorderMiracle, 0, 0, canvas.width, canvas.height, border, imgFrameMask, false, false)
} else { } else {
drawMask(imgBorderMiracle, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false) drawMask(imgBorderMiracle, 0, 0, canvas.width, canvas.height, border, imgFrameMask, false, false)
if (secondColor == true) { if (secondColor == true) {
drawMask(imgSecondBorderMiracle, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiGradient, "reverseSecond") drawMask(imgSecondBorderMiracle, 0, 0, canvas.width, canvas.height, border, imgFrameMask, imgMultiGradient, "reverseSecond")
} }
} }
} }
//LEGENDARY //LEGENDARY
if (document.getElementById("checkboxLegendary").checked == true && legendaryBorder == true) { if (document.getElementById("checkboxLegendary").checked == true && legendaryBorder == true) {
drawMask(imgBorderLegendary, 0, 0, canvas.width, canvas.height, imgLegendFrameMask, false, false) drawMask(imgBorderLegendary, 0, 0, canvas.width, canvas.height, border, imgLegendFrameMask, false, false)
if (secondColor == true) { if (secondColor == true) {
drawMask(imgSecondBorderLegendary, 0, 0, canvas.width, canvas.height, imgLegendFrameMask, imgMultiGradient, "reverseSecond") drawMask(imgSecondBorderLegendary, 0, 0, canvas.width, canvas.height, border, imgLegendFrameMask, imgMultiGradient, "reverseSecond")
} }
//redraws the custom-color border to match the legendary frame //redraws the custom-color border to match the legendary frame
drawMask(document.getElementById("inputColor").value, 0, 0, canvas.width, canvas.height, imgBorderMask, imgLegendFrameMask, "reverseSecond") drawMask(document.getElementById("inputColor").value, 0, 0, canvas.width, canvas.height, border, imgBorderMask, imgLegendFrameMask, "reverseSecond")
//redraws the silver border usually on un-cards to match the legendary frame //redraws the silver border usually on un-cards to match the legendary frame
if (document.getElementById("checkboxSilverBorder").checked == true) { if (document.getElementById("checkboxSilverBorder").checked == true) {
drawMask("#a3aeb7", 0, 0, canvas.width, canvas.height, imgBorderMask, imgLegendFrameMask, "reverseSecond") drawMask("#a3aeb7", 0, 0, canvas.width, canvas.height, border, imgBorderMask, imgLegendFrameMask, "reverseSecond")
} }
} }
//FLIP CARDS //FLIP CARDS
if (flipBorder == true) { if (flipBorder == true) {
if (document.getElementById("checkboxFlippedDark").checked == true && flipBorder == true) { if (document.getElementById("checkboxFlippedDark").checked == true && flipBorder == true) {
if (thirdColor == true) { if (thirdColor == true) {
drawMask(imgBorderFlippedDark, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false) drawMask(imgBorderFlippedDark, 0, 0, canvas.width, canvas.height, border, imgFrameMask, false, false)
} else { } else {
drawMask(imgBorderFlippedDark, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false) drawMask(imgBorderFlippedDark, 0, 0, canvas.width, canvas.height, border, imgFrameMask, false, false)
if (secondColor == true) { if (secondColor == true) {
drawMask(imgSecondBorderFlippedDark, 0, 0, canvas.width, canvas.height, imgSecondBorderFlippedDark, imgMultiGradient, "reverseSecond") drawMask(imgSecondBorderFlippedDark, 0, 0, canvas.width, canvas.height, border, imgSecondBorderFlippedDark, imgMultiGradient, "reverseSecond")
} }
} }
} }
if (document.getElementById("checkboxFlipIcon").checked == true) { if (document.getElementById("checkboxFlipIcon").checked == true) {
card.drawImage(imgBorderFlipCircle, 0, 0, canvas.width, canvas.height) border.drawImage(imgBorderFlipCircle, 0, 0, canvas.width, canvas.height)
card.drawImage(imgBorderFlipIcon, 39, 51, 60, 60) border.drawImage(imgBorderFlipIcon, 39, 51, 60, 60)
} }
if (document.getElementById("checkboxFlipTip").checked == true) { if (document.getElementById("checkboxFlipTip").checked == true) {
card.drawImage(imgBorderFlipTip, 0, 0, canvas.width, canvas.height) border.drawImage(imgBorderFlipTip, 0, 0, canvas.width, canvas.height)
card.fillStyle="#666" border.fillStyle="#666"
canvas.style.letterSpacing = "0px" canvas.style.letterSpacing = "0px"
card.font = "28px belerenb" border.font = "28px belerenb"
card.fillText(document.getElementById("inputFlipTip").value, 688 - card.measureText(document.getElementById("inputFlipTip").value).width, 880) border.fillText(document.getElementById("inputFlipTip").value, 688 - border.measureText(document.getElementById("inputFlipTip").value).width, 880)
} }
if (document.getElementById("checkboxFlipIcon").checked == true || document.getElementById("checkboxFlippedDark").checked == true) { if (document.getElementById("checkboxFlipIcon").checked == true || document.getElementById("checkboxFlippedDark").checked == true) {
titleRightShift = 50 titleRightShift = 50
@@ -712,50 +714,62 @@ function drawBorder() {
for (i = 0; i < identityList.length; i ++) { for (i = 0; i < identityList.length; i ++) {
switch (identityList[i]) { switch (identityList[i]) {
case "w": case "w":
card.fillStyle = "#f3f2ef" border.fillStyle = "#f3f2ef"
break; break;
case "u": case "u":
card.fillStyle = "#1d7097" border.fillStyle = "#1d7097"
break; break;
case "b": case "b":
card.fillStyle = "#31302e" border.fillStyle = "#31302e"
break; break;
case "r": case "r":
card.fillStyle = "#bf544c" border.fillStyle = "#bf544c"
break; break;
case "g": case "g":
card.fillStyle = "#1c6449" border.fillStyle = "#1c6449"
break; break;
case "m": case "m":
card.fillStyle = "#e3d591" border.fillStyle = "#e3d591"
break; break;
default: default:
card.fillStyle = "#e0e0e0" border.fillStyle = "#e0e0e0"
} }
var startAngle = originAngle + i * angleSize var startAngle = originAngle + i * angleSize
card.beginPath() border.beginPath()
card.moveTo(identityX, identityY) border.moveTo(identityX, identityY)
card.arc(identityX, identityY, identityRadius, startAngle, startAngle + angleSize) border.arc(identityX, identityY, identityRadius, startAngle, startAngle + angleSize)
card.lineTo(identityX, identityY) border.lineTo(identityX, identityY)
card.fill() border.fill()
} }
card.drawImage(imgIdentity, identityX - identityRadius, identityY - identityRadius, 2 * identityRadius, 2 * identityRadius) border.drawImage(imgIdentity, identityX - identityRadius, identityY - identityRadius, 2 * identityRadius, 2 * identityRadius)
typeRightShift = 33 typeRightShift = 33
} else { } else {
typeRightShift = 0 typeRightShift = 0
} }
//RARE STAMP //RARE STAMP
if (document.getElementById("checkboxRareStamp").checked == true && stampBorder == true) { if (document.getElementById("checkboxRareStamp").checked == true && stampBorder == true) {
card.drawImage(imgBorderRareStamp, 329, rareStampY - 15, 90, 50) border.drawImage(imgBorderRareStamp, 329, rareStampY - 15, 90, 50)
if (document.getElementById("checkboxSecondColor").checked == true) { if (document.getElementById("checkboxSecondColor").checked == true) {
drawMask(imgSecondBorderRareStamp, 329, rareStampY - 15, 90, 50, imgSecondBorderRareStamp, imgStampGradient, "reverseSecond") drawMask(imgSecondBorderRareStamp, 329, rareStampY - 15, 90, 50, border, imgSecondBorderRareStamp, imgStampGradient, "reverseSecond")
} }
//Draws over the rare stamp (part that's usually back) to match custom border color //Draws over the rare stamp (part that's usually black) to match custom border color
drawMask(document.getElementById("inputColor").value, 329, rareStampY - 15, 90, 50, imgRareStampMask, false, false) drawMask(document.getElementById("inputColor").value, 329, rareStampY - 15, 90, 50, border, imgRareStampMask, false, false)
//This is when the holo stamp is drawn //This is when the holo stamp is drawn
card.drawImage(imgRareStamp, 340, rareStampY, 70, 37) border.drawImage(imgRareStamp, 340, rareStampY, 70, 37)
} }
imgBorder.src = borderCanvas.toDataURL()
}
//Draw Picture
function drawPicture() {
//scales the card art and draws it
var imageScale = document.getElementById("imageSize").value * 0.01
var imageLeftShift = parseInt(document.getElementById("imageLeft").value)
var imageUpShift = parseInt(document.getElementById("imageUp").value)
if (imgArt.width > 0) {
//drawMask(imgArt, artX - imageLeftShift, artY - imageUpShift, imgArt.width * imageScale, imgArt.height * imageScale, card, imgArtMask, false, false)
}
card.drawImage(imgArt, artX - imageLeftShift, artY - imageUpShift, imgArt.width * imageScale, imgArt.height * imageScale)
} }
//Draw Set Symbol //Draw Set Symbol
function drawSetSymbol() { function drawSetSymbol() {
@@ -770,7 +784,7 @@ function drawSetSymbol() {
height *= document.getElementById("setSymbolSize").value / 100 height *= document.getElementById("setSymbolSize").value / 100
width *= document.getElementById("setSymbolSize").value / 100 width *= document.getElementById("setSymbolSize").value / 100
var y = setSymbolY - height / 2 var y = setSymbolY - height / 2
var x = setSymbolRight - width var x = setSymbolRight - width / centerSetSymbol
card.drawImage(imgSetSymbol, x, y, width, height) card.drawImage(imgSetSymbol, x, y, width, height)
} }
} }
@@ -790,10 +804,10 @@ function drawWatermark() {
card.globalAlpha = 0.4 card.globalAlpha = 0.4
//if the following if statement is true, the watermark will be drawn in two halves of the chosen colors. Otherwise, a single watermark of the first chosen color is drawn. //if the following if statement is true, the watermark will be drawn in two halves of the chosen colors. Otherwise, a single watermark of the first chosen color is drawn.
if (document.getElementById("checkboxSecondWatermarkColor").checked == true) { if (document.getElementById("checkboxSecondWatermarkColor").checked == true) {
drawMask(document.getElementById("watermarkColorSelection").value, x, y, width, height, imgWatermark, imgMultiGradient, false) drawMask(document.getElementById("watermarkColorSelection").value, x, y, width, height, card, imgWatermark, imgMultiGradient, false)
drawMask(document.getElementById("secondWatermarkColorSelection").value, x, y, width, height, imgWatermark, imgMultiGradient, "reverseSecond") drawMask(document.getElementById("secondWatermarkColorSelection").value, x, y, width, height, card, imgWatermark, imgMultiGradient, "reverseSecond")
} else { } else {
drawMask(document.getElementById("watermarkColorSelection").value, x, y, width, height, imgWatermark, false, false) drawMask(document.getElementById("watermarkColorSelection").value, x, y, width, height, card, imgWatermark, false, false)
} }
card.globalAlpha = 1 card.globalAlpha = 1
} }
@@ -825,14 +839,17 @@ function writeText() {
card.fillStyle = "Black" card.fillStyle = "Black"
} }
//Title //Title
card.textAlign = titleAlign
canvas.style.letterSpacing = titleFontSpacing canvas.style.letterSpacing = titleFontSpacing
card.font = titleFont card.font = titleFont
card.fillText(document.getElementById("inputName").value, titleX + titleRightShift, titleY) card.fillText(document.getElementById("inputName").value, titleX + titleRightShift, titleY)
//Type //Type
card.textAlign = typeAlign
canvas.style.letterSpacing = typeFontSpacing canvas.style.letterSpacing = typeFontSpacing
card.font = typeFont card.font = typeFont
card.fillText(document.getElementById("inputType").value, typeX + typeRightShift, typeY) card.fillText(document.getElementById("inputType").value, typeX + typeRightShift, typeY)
//Power/Toughness //Power/Toughness
card.textAlign = "left"
if (document.getElementById("checkboxCreature").checked == true) { if (document.getElementById("checkboxCreature").checked == true) {
card.drawImage(imgBorderCreature, ptX, ptY, ptWidth, ptHeight) card.drawImage(imgBorderCreature, ptX, ptY, ptWidth, ptHeight)
canvas.style.letterSpacing = ptFontSpacing canvas.style.letterSpacing = ptFontSpacing
@@ -860,7 +877,7 @@ function bottomInfoM15() {
var bottomLine = document.getElementById("inputSet").value + " \u00b7 " + document.getElementById("inputLanguage").value var bottomLine = document.getElementById("inputSet").value + " \u00b7 " + document.getElementById("inputLanguage").value
card.fillText(bottomLine, 48, m15InfoY) card.fillText(bottomLine, 48, m15InfoY)
var artistBrushShift = card.measureText(bottomLine).width + 58 var artistBrushShift = card.measureText(bottomLine).width + 58
drawMask(card.fillStyle, artistBrushShift, m15InfoY + 5, 21, 13, imgArtistBrush, false, false) drawMask(card.fillStyle, artistBrushShift, m15InfoY + 5, 21, 13, card, imgArtistBrush, false, false)
canvas.style.letterSpacing = "1.3px" canvas.style.letterSpacing = "1.3px"
card.font = "19.5px relaymedium" card.font = "19.5px relaymedium"
card.fillText(document.getElementById("inputNumber").value, 49, m15InfoY - 20) card.fillText(document.getElementById("inputNumber").value, 49, m15InfoY - 20)
@@ -974,7 +991,7 @@ function drawText(text, xCoord, yCoord) {
textXShift = 0 textXShift = 0
y += 2 * lineSpace + textSize + 3 y += 2 * lineSpace + textSize + 3
} else { } else {
card.drawImage(manaSymbolImages[manaSymbolCode.indexOf(megaSplit[0])], x + textXShift + textSize * 0.054, y + textSize * 0.19, textSize * 0.77, textSize * 0.77) card.drawImage(manaSymbolImages[manaSymbolCode.indexOf(megaSplit[0])], x + textXShift + textSize * 0.054, y + textSize * 0.17, textSize * 0.77, textSize * 0.77)
textXShift += textSize * 0.84 textXShift += textSize * 0.84
} }
if (megaSplit[1] != "") { if (megaSplit[1] != "") {