promo extended + preserve alpha

This commit is contained in:
Kyle
2021-05-07 17:12:14 -07:00
parent f1c4a85e78
commit e27713a981
27 changed files with 76 additions and 0 deletions

View File

@@ -43,6 +43,13 @@ include('../globalHTML/header-1.php');
<span class='checkmark'></span>
</label>
</div>
<div>
<h5 class='input-description'>Overlay Mode</h5>
<label class='checkbox-container input'>Preserve Alpha
<input id='frame-editor-alpha' type='checkbox' placeholder='Preserve Alpha'>
<span class='checkmark'></span>
</label>
</div>
</div>
<div id='textbox-editor' class='textbox-editor'>
<h2 class='textbox-editor-title'>Textbox Editor</h2>

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 968 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@@ -283,7 +283,19 @@ function drawFrames() {
item.masks.forEach(mask => frameMaskingContext.drawImage(mask.image, scaleX((bounds.x || 0) - (ogBounds.x || 0) - ((ogBounds.x || 0) * ((bounds.width || 1) / (ogBounds.width || 1) - 1))), scaleY((bounds.y || 0) - (ogBounds.y || 0) - ((ogBounds.y || 0) * ((bounds.height || 1) / (ogBounds.height || 1) - 1))), scaleWidth((bounds.width || 1) / (ogBounds.width || 1)), scaleHeight((bounds.height || 1) / (ogBounds.height || 1))));
frameMaskingContext.drawImage(item.image, frameX, frameY, frameWidth, frameHeight);
if (item.erase) {frameContext.globalCompositeOperation = 'destination-out';}
var oldAlphaData;
if (item.preserveAlpha) {
oldAlphaData = frameContext.getImageData(0, 0, frameCanvas.width, frameCanvas.height).data;
}
frameContext.drawImage(frameMaskingCanvas, 0, 0, frameCanvas.width, frameCanvas.height);
if (item.preserveAlpha) {
var newRGBData = frameContext.getImageData(0, 0, frameCanvas.width, frameCanvas.height);
var pixels = newRGBData.data;
for (var i = 3; i < oldAlphaData.length; i += 4) {
pixels[i] = oldAlphaData[i];
}
frameContext.putImageData(newRGBData, 0, 0);
}
}
});
drawCard();
@@ -491,6 +503,8 @@ function frameElementClicked(event) {
document.querySelector('#frame-editor-opacity').onchange = (event) => {selectedFrame.opacity = event.target.value; drawFrames();}
document.querySelector('#frame-editor-erase').checked = selectedFrame.erase || false;
document.querySelector('#frame-editor-erase').onchange = (event) => {selectedFrame.erase = event.target.checked; drawFrames();}
document.querySelector('#frame-editor-alpha').checked = selectedFrame.preserveAlpha || false;
document.querySelector('#frame-editor-alpha').onchange = (event) => {selectedFrame.preserveAlpha = event.target.checked; drawFrames();}
}
}
function uploadFrameOption(imageSource) {

View File

@@ -1,5 +1,6 @@
loadFramePacks([
{name:'Regular Frames', value:'PromoRegular-1'},
{name:'Extended Art Frames', value:'PromoExtended'},
{name:'Nickname Frames', value:'PromoNickname'},
{name:'Generic Showcase', value:'PromoGenericShowcase'},
{name:'Addons', value:'disabled'},

View File

@@ -8,6 +8,7 @@ availableFrames = [
{name:'Borderless Extension', src:'/img/frames/margins/borderlessBorderExtension.png', bounds:bounds},
{name:'Box Topper Extension', src:'/img/frames/margins/boxTopperBorderExtension.png', bounds:bounds},
{name:'Box Topper Extension (Planeswalker)', src:'/img/frames/planeswalker/boxTopper/margin.png', bounds:bounds},
{name:'Box Topper Extension (Promo / Tall Art)', src:'/img/frames/promo/extended/margin.png', bounds:bounds},
{name:'Black Extension (Cornered)', src:'/img/frames/margins/blackCorners.png', bounds:bounds},
{name:'White Border Extension', src:'/img/frames/white.png', ogBounds:ogBounds, bounds:bounds, masks:masks, noDefaultMask:true},
{name:'Silver Border Extension', src:'/img/frames/silver.png', ogBounds:ogBounds, bounds:bounds, masks:masks, noDefaultMask:true},

View File

@@ -0,0 +1,53 @@
//Create objects for common properties across available frames
var masks = [{src:'/img/frames/promo/m15PromoMaskPinline.png', name:'Pinline'}, {src:'/img/frames/m15/regular/m15MaskTitle.png', name:'Title'}, {src:'/img/frames/promo/m15PromoMaskType.png', name:'Type'}, {src:'/img/frames/promo/m15PromoMaskRules.png', name:'Rules'}, {src:'/img/frames/m15/regular/m15MaskBorder.png', name:'Border'}];
var bounds = {x:0.7573, y:0.8848, width:0.188, height:0.0733};
//defines available frames
availableFrames = [
{name:'White Frame', src:'/img/frames/promo/extended/w.png', masks:masks},
{name:'Blue Frame', src:'/img/frames/promo/extended/u.png', masks:masks},
{name:'Black Frame', src:'/img/frames/promo/extended/b.png', masks:masks},
{name:'Red Frame', src:'/img/frames/promo/extended/r.png', masks:masks},
{name:'Green Frame', src:'/img/frames/promo/extended/g.png', masks:masks},
{name:'Multicolored Frame', src:'/img/frames/promo/extended/m.png', masks:masks},
{name:'Artifact Frame', src:'/img/frames/promo/extended/a.png', masks:masks},
{name:'Land Frame', src:'/img/frames/promo/extended/l.png', masks:masks},
{name:'Colorless Frame', src:'/img/frames/promo/extended/l.png', masks:masks},
{name:'Vehicle Frame', src:'/img/frames/promo/extended/v.png', masks:masks},
{name:'White Power/Toughness', src:'/img/frames/m15/regular/m15PTW.png', bounds:bounds},
{name:'Blue Power/Toughness', src:'/img/frames/m15/regular/m15PTU.png', bounds:bounds},
{name:'Black Power/Toughness', src:'/img/frames/m15/regular/m15PTB.png', bounds:bounds},
{name:'Red Power/Toughness', src:'/img/frames/m15/regular/m15PTR.png', bounds:bounds},
{name:'Green Power/Toughness', src:'/img/frames/m15/regular/m15PTG.png', bounds:bounds},
{name:'Multicolored Power/Toughness', src:'/img/frames/m15/regular/m15PTM.png', bounds:bounds},
{name:'Artifact Power/Toughness', src:'/img/frames/m15/regular/m15PTA.png', bounds:bounds},
{name:'Colorless Power/Toughness', src:'/img/frames/m15/regular/m15PTC.png', bounds:bounds},
{name:'Vehicle Power/Toughness', src:'/img/frames/m15/regular/m15PTV.png', bounds:bounds}
];
//disables/enables the "Load Frame Version" button
document.querySelector('#loadFrameVersion').disabled = false;
//defines process for loading this version, if applicable
document.querySelector('#loadFrameVersion').onclick = async function() {
//resets things so that every frame doesn't have to
await resetCardIrregularities();
//sets card version
card.version = 'promoExtended';
//art bounds
card.artBounds = {x:0, y:0.081, width:1, height:0.6153};
autoFitArt();
//set symbol bounds
card.setSymbolBounds = {x:0.9213, y:0.6743, width:0.12, height:0.0410, vertical:'center', horizontal: 'right'};
resetSetSymbol();
//watermark bounds
card.watermarkBounds = {x:0.5, y:0.8177, width:0.75, height:0.1472};
resetWatermark();
//text
loadTextOptions({
mana: {name:'Mana Cost', text:'', y:0.0613, width:0.9292, height:71/2100, oneLine:true, size:71/1638, align:'right', shadowX:-0.001, shadowY:0.0029, manaCost:true, manaSpacing:0},
title: {name:'Title', text:'', x:0.0854, y:0.0522, width:0.8292, height:0.0543, oneLine:true, font:'belerenb', size:0.0381},
type: {name:'Type', text:'', x:0.0854, y:0.65, width:0.8292, height:0.0543, oneLine:true, font:'belerenb', size:0.0324, color:'white', shadowX:0.0014, shadowY:0.001},
rules: {name:'Rules Text', text:'', x:0.086, y:0.7143, width:0.828, height:0.2048, size:0.0362},
pt: {name:'Power/Toughness', text:'', x:0.7928, y:0.902, width:0.1367, height:0.0372, size:0.0372, font:'belerenbsc', oneLine:true, align:'center'}
});
}
//loads available frames
loadFramePack();