Mercurial > MadButterfly
comparison nodejs/svg.js @ 891:96bc29e948cc abs_n_rel_center
Do not fill and stroke when the color is none or unseted
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sun, 26 Sep 2010 14:25:55 +0800 |
parents | 143ac14c3ce9 |
children | ec94dd788332 |
comparison
equal
deleted
inserted
replaced
890:58a4e9bb8bb7 | 891:96bc29e948cc |
---|---|
656 var stroke_alpha = 1; | 656 var stroke_alpha = 1; |
657 var alpha = 1; | 657 var alpha = 1; |
658 var fill_color; | 658 var fill_color; |
659 var stroke_color; | 659 var stroke_color; |
660 var stroke_width = 1; | 660 var stroke_width = 1; |
661 var black_paint; | |
662 var i; | 661 var i; |
663 | 662 |
664 if(style) { | 663 if(style) { |
665 if('opacity' in style) | 664 if('opacity' in style) |
666 alpha = parseFloat(style['opacity']); | 665 alpha = parseFloat(style['opacity']); |
676 stroke_alpha = parseFloat(style['stroke-opacity']); | 675 stroke_alpha = parseFloat(style['stroke-opacity']); |
677 if('display' in style && style['display'] == 'none') | 676 if('display' in style && style['display'] == 'none') |
678 return; | 677 return; |
679 } | 678 } |
680 | 679 |
681 if(!fill_color || !stroke_color) | |
682 black_paint = this.mb_rt.paint_color_new(0, 0, 0, 1); | |
683 | |
684 if(fill_color) { | 680 if(fill_color) { |
685 if(fill_color != "none") { | 681 if(fill_color != "none") { |
686 paint = this._prepare_paint_color(fill_color, fill_alpha); | 682 paint = this._prepare_paint_color(fill_color, fill_alpha); |
687 paint.fill(tgt); | 683 paint.fill(tgt); |
688 } | 684 } |
689 } else { | |
690 black_paint.fill(tgt); | |
691 } | 685 } |
692 if(stroke_color) { | 686 if(stroke_color) { |
693 if(stroke_color != "none") { | 687 if(stroke_color != "none") { |
694 paint = this._prepare_paint_color(stroke_color, stroke_alpha); | 688 paint = this._prepare_paint_color(stroke_color, stroke_alpha); |
695 paint.stroke(tgt); | 689 paint.stroke(tgt); |
696 } | 690 } |
697 } else { | |
698 black_paint.stroke(tgt); | |
699 } | 691 } |
700 | 692 |
701 tgt.stroke_width = stroke_width; | 693 tgt.stroke_width = stroke_width; |
702 | 694 |
703 if(alpha < 1) | 695 if(alpha < 1) |