Merged Texture work over to the main index. Using a hidden <canvas>, we can now draw their selected color in with a transparent texture PNG, get the base64 encoded string, and apply it to the mini layout - total ownage. :D

This commit is contained in:
Veno Server 2009-09-04 02:24:03 -05:00
parent c03bdafd3c
commit f865073ea8
2 changed files with 18 additions and 4 deletions

View file

@ -15,7 +15,7 @@ var texture = {
* @Param: baseImage - base image to use (generally a semi-transparent PNG)
* @Param: colorArray - array of colors to use in the texture (Right now, this only accepts two colors, primary and secondary)
*/
draw: function(drawingCanvas, baseImage, colorArray) {
draw: function(drawingCanvas, baseImage, colorArray, callbackfn) {
texture.canvas = document.getElementById(drawingCanvas);
texture.ctx = texture.canvas.getContext('2d');
@ -25,7 +25,10 @@ var texture = {
texture.ctx.fillStyle = colorArray[0];
texture.ctx.fillRect(0, 0, 50, 50);
texture.ctx.drawImage(img, 0, 0, 50, 50);
}
callbackfn();
}
img.src = baseImage;
}
},
getBase64: function() { return document.getElementById("lol_texture").toDataURL("image/png"); }
}