bitmap fills FTW
[potlatch2.git] / net / systemeD / halcyon / styleparser / ShapeStyle.as
1 package net.systemeD.halcyon.styleparser {
2
3         import flash.display.Graphics;
4         
5         public class ShapeStyle extends Style {
6
7                 public var width:Number;
8                 public var color:Number;
9                 public var opacity:Number;
10                 public var dashes:Array;
11                 public var linecap:String;
12                 public var linejoin:String;
13                 
14                 public var fill_color:Number;
15                 public var fill_opacity:Number;
16                 public var fill_image:String;
17                 
18                 public var casing_width:Number;
19                 public var casing_color:Number;
20                 public var casing_opacity:Number;
21                 public var casing_dashes:Array;
22                 
23                 override public function get properties():Array {
24                         return [
25                                 'width','color','opacity','dashes','linecap','linejoin',
26                                 'fill_color','fill_opacity','fill_image',
27                                 'casing_width','casing_color','casing_opacity','casing_dashes'
28                         ];
29                 }
30                 
31                 public function applyStrokeStyle(g:Graphics):void {
32                         g.lineStyle(width,
33                                                 color ? color : 0,
34                                                 opacity ? opacity : 1,
35                                                 false, "normal",
36                                                 linecap  ? linecap : "none",
37                                                 linejoin ? linejoin : "round");
38                 }
39                 
40                 public function applyCasingStyle(g:Graphics):void {
41                         g.lineStyle(casing_width,
42                                                 casing_color   ? casing_color : 0,
43                                                 casing_opacity ? casing_opacity : 1,
44                                                 false, "normal",
45                                                 linecap  ? linecap : "none",
46                                                 linejoin ? linejoin : "round");
47                 }
48                 
49                 public function applyFill(g:Graphics):void {
50                         g.beginFill(fill_color,
51                                                 fill_opacity ? fill_opacity : 1);
52                 }
53         }
54
55 }