support for opacity

This commit is contained in:
MoyuScript
2011-07-18 00:59:36 +03:00
parent fb2ec9c9fb
commit 235cc4445d
5 changed files with 63 additions and 77 deletions

View File

@ -100,11 +100,15 @@ html2canvas.prototype.start = function(){
this.bodyOverflow = document.getElementsByTagName('body')[0].style.overflow;
document.getElementsByTagName('body')[0].style.overflow = "hidden";
var ctx = this.newElement(this.element, this.ctx) || this.ctx;
var stack = this.newElement(this.element,{
ctx:this.ctx,
opacity:this.getCSS(this.element,"opacity")
}) || this.ctx;
}
this.parseElement(this.element,ctx);
}
this.parseElement(this.element,stack);
}

View File

@ -19,29 +19,19 @@ html2canvas.prototype.newElement = function(el,parentStack){
//console.log(el.nodeName+":"+zindex+":"+this.getCSS(el,"position")+":"+this.numDraws+":"+this.getCSS(el,"z-index"))
var opacity = this.getCSS(el,"opacity");
//if (this.getCSS(el,"position")!="static"){
/*
this.contextStacks.push(ctx);
var stack = {
ctx: new this.storageContext(),
zIndex: zindex,
opacity: opacity*parentStack.opacity
};
var stackLength = this.contextStacks.push(stack);
ctx = new this.storageContext();
*/
var stack = {
ctx: new this.storageContext(),
zIndex: zindex,
opacity: opacity
};
var stackLength = this.contextStacks.push(stack);
var ctx = this.contextStacks[stackLength-1].ctx;
//}
var ctx = this.contextStacks[stackLength-1].ctx;
this.setContextVariable(ctx,"globalAlpha",stack.opacity);
/*
* TODO add support for different border-style's than solid
@ -138,7 +128,7 @@ html2canvas.prototype.newElement = function(el,parentStack){
return this.contextStacks[stackLength-1];
return this.contextStacks[stackLength-1];

View File

@ -1,11 +1,9 @@
html2canvas.prototype.parseElement = function(element,ctx){
html2canvas.prototype.parseElement = function(element,stack){
var _ = this;
this.each(element.children,function(index,el){
_.parsing(el,{
ctx:ctx
});
_.parsing(el,stack);
});
this.canvasRenderer(this.contextStacks);