mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
clear canvas before rendering to allow jpeg export
* normally when exporting jpeg any pixel that was transparent becomes black, make them white * check for window.console.log before use (avoid crash) * html2canvas.Parse: fix missing call to html2canvas.Util.Extend for the given options
This commit is contained in:
parent
2a3d6a0a35
commit
044b612d6e
@ -11,7 +11,7 @@ var html2canvas = {};
|
|||||||
html2canvas.logging = true;
|
html2canvas.logging = true;
|
||||||
|
|
||||||
html2canvas.log = function (a) {
|
html2canvas.log = function (a) {
|
||||||
if (html2canvas.logging) {
|
if (html2canvas.logging && window.console && window.console.log) {
|
||||||
window.console.log(a);
|
window.console.log(a);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -47,6 +47,7 @@ html2canvas.Parse = function (element, images, opts) {
|
|||||||
children,
|
children,
|
||||||
childrenLen;
|
childrenLen;
|
||||||
|
|
||||||
|
options = html2canvas.Util.Extend(opts, options);
|
||||||
|
|
||||||
images = images || [];
|
images = images || [];
|
||||||
|
|
||||||
@ -1254,4 +1255,4 @@ html2canvas.zContext = function(zindex) {
|
|||||||
zindex: zindex,
|
zindex: zindex,
|
||||||
children: []
|
children: []
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -78,12 +78,17 @@ html2canvas.Renderer = function(parseQueue, opts){
|
|||||||
queueLen,
|
queueLen,
|
||||||
a,
|
a,
|
||||||
storageLen,
|
storageLen,
|
||||||
renderItem;
|
renderItem,
|
||||||
|
fstyle;
|
||||||
|
|
||||||
canvas.width = options.width || zStack.ctx.width;
|
canvas.width = options.width || zStack.ctx.width;
|
||||||
canvas.height = options.height || zStack.ctx.height;
|
canvas.height = options.height || zStack.ctx.height;
|
||||||
|
|
||||||
|
fstyle = ctx.fillStyle;
|
||||||
|
ctx.fillStyle = "#fff";
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
ctx.fillStyle = fstyle;
|
||||||
|
|
||||||
for (i = 0, queueLen = queue.length; i < queueLen; i+=1){
|
for (i = 0, queueLen = queue.length; i < queueLen; i+=1){
|
||||||
|
|
||||||
storageContext = queue.splice(0, 1)[0];
|
storageContext = queue.splice(0, 1)[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user