comparison nodejs/svg.js @ 888:143ac14c3ce9 abs_n_rel_center

Set opacity for a path. You can not set opacity on a shape of MadButterfly, but you can set opacity for a coord. We add an additional coord to contain a path, and set opacity on the containing coord.
author Thinker K.F. Li <thinker@codemud.net>
date Sun, 26 Sep 2010 14:09:16 +0800
parents 47a8086e7729
children 96bc29e948cc
comparison
equal deleted inserted replaced
887:8a2d676d9fa3 888:143ac14c3ce9
697 } else { 697 } else {
698 black_paint.stroke(tgt); 698 black_paint.stroke(tgt);
699 } 699 }
700 700
701 tgt.stroke_width = stroke_width; 701 tgt.stroke_width = stroke_width;
702
703 if(alpha < 1)
704 tgt.parent.opacity = alpha;
702 }; 705 };
703 706
704 loadSVG.prototype._set_paint = function(node, tgt) { 707 loadSVG.prototype._set_paint = function(node, tgt) {
705 var style; 708 var style;
706 709
750 loadSVG.prototype.parsePath=function(accu, coord,id, n) 753 loadSVG.prototype.parsePath=function(accu, coord,id, n)
751 { 754 {
752 var d = formalize_path_data(n.attr('d').value()); 755 var d = formalize_path_data(n.attr('d').value());
753 var style = n.attr('style'); 756 var style = n.attr('style');
754 var path = this.mb_rt.path_new(d); 757 var path = this.mb_rt.path_new(d);
755 758 var pcoord = this.mb_rt.coord_new(coord);
756 guessPathBoundingBox(coord,d); 759
757 coord.add_shape(path); 760 guessPathBoundingBox(pcoord,d);
761 pcoord.add_shape(path);
758 this._set_paint(n, path); 762 this._set_paint(n, path);
759 this._set_bbox(n, path); 763 this._set_bbox(n, path);
760 764
761 make_mbnames(this.mb_rt, n, path); 765 make_mbnames(this.mb_rt, n, pcoord);
762 }; 766 };
763 767
764 loadSVG.prototype.parseText=function(accu,coord,id, n) 768 loadSVG.prototype.parseText=function(accu,coord,id, n)
765 { 769 {
766 var x = getInteger(n,'x'); 770 var x = getInteger(n,'x');