1  /*
     2   Copyright aswing.org, see the LICENCE.txt.
     3  */
     4   
     5  import org.aswing.ASColor;
     6  import org.aswing.graphices.*;
     7  
     8  /**
     9   * 
    10   * @author iiley
    11   */
    12  class org.aswing.graphices.SolidBrush implements Brush{
    13  	private var color:Number;
    14  	private var alpha:Number;
    15  	
    16  	/**
    17  	 * <p>
    18  	 * SolidBrush(color:ASColor)<br>
    19  	 * SolidBrush(color:Number, alpha:Number)<br>
    20  	 */
    21  	function SolidBrush(color:Object, alpha:Number){
    22  		if(color instanceof ASColor){			
    23  			setASColor(ASColor(color));
    24  		}
    25  		else{
    26  			this.color=(color==undefined) ? ASColor.BLACK.getRGB():Number(color);
    27  			this.alpha=(alpha==undefined) ? 100:Number(alpha);
    28  		}
    29  	}
    30  	
    31  	public function getColor():Number{
    32  		return color;
    33  	}
    34  	
    35  	public function setColor(color:Number):Void{		
    36  		if(color!=null){
    37  			this.color=color;
    38  		}		
    39  	}
    40  	
    41  	public function setAlpha(alpha:Number):Void{
    42  			if(alpha!=null){
    43  				this.alpha=alpha;
    44  			}
    45  	}
    46  	
    47  	public function getAlpha():Number{
    48  		return alpha;
    49  	}
    50  	
    51  	public function beginFill(target:MovieClip):Void{
    52  		target.beginFill(color,alpha);
    53  	}
    54  	
    55  	public function endFill(target:MovieClip):Void{
    56  		target.endFill();
    57  	}
    58  	
    59  	public function setASColor(color:ASColor):Void{
    60  		if(color!=null){
    61  			this.color=color.getRGB();
    62  			this.alpha=color.getAlpha();
    63  		}
    64  	}
    65  }
    66