Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/xerox/VTM/svg/SVGStyle.java


1   /*   FILE: SVGStyle.java
2    *   DATE OF CREATION:   Jan 09 2002
3    *   AUTHOR :            Emmanuel Pietriga (emmanuel.pietriga@xrce.xerox.com)
4    *   MODIF:              Tue Jan 14 16:51:40 2003 by Emmanuel Pietriga
5    *   Copyright (c) Xerox Corporation, XRCE/Contextual Computing, 2002. All Rights Reserved
6    *
7    * This library is free software; you can redistribute it and/or
8    * modify it under the terms of the GNU Lesser General Public
9    * License as published by the Free Software Foundation; either
10   * version 2.1 of the License, or (at your option) any later version.
11   * 
12   * This library is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   * Lesser General Public License for more details.
16   *
17   * For full terms see the file COPYING.
18   */
19  
20  
21  package com.xerox.VTM.svg;
22  
23  import java.awt.Color;
24  
25  /**
26   * A class to store style information relevant to the VTM
27   */
28  
29  public class SVGStyle {
30  
31      Color fillColor;   //fill color in VTM
32      
33      Color strokeColor; //corresponds to the border color in VTM
34  
35      Float alphaValue;  //transparency
36  
37      SVGStyle(){
38  
39      }
40  
41      /**fill color, border color*/
42      SVGStyle(Color c1,Color c2){
43    fillColor=c1;
44    strokeColor=c2;
45      }
46  
47      /**fill color, border color, transparency*/
48      SVGStyle(Color c1,Color c2,Float a){
49    fillColor=c1;
50    strokeColor=c2;
51    alphaValue=a;
52      }
53  
54      /**returns true if there is transparency information (the value does not matter)*/
55      public boolean hasTransparencyInformation(){
56    if (alphaValue==null){return false;}
57    else {return true;}
58      }
59  
60      /**set the fill (interior) color*/
61      public void setFillColor(Color c){
62    fillColor=c;
63      }
64  
65      /**returns the fill (interior) color*/
66      public Color getFillColor(){
67    return fillColor;
68      }
69  
70      /**set the stroke (border) color*/
71      public void setBorderColor(Color c){
72    strokeColor=c;
73      }
74  
75      /**returns the stroke (border) color*/
76      public Color getBorderColor(){
77    return strokeColor;
78      }
79  
80      /**set the transparency value (between 0 (fully transparent) and 1.0 (opaque))*/
81      public void setAlphaTransparencyValue(Float f){
82    alphaValue=f;
83      }
84  
85      /**returns the alpha transparency value (1.0 if opaque, 0 is fully transparent)*/
86      public float getAlphaTransparencyValue(){
87    if (alphaValue!=null){return alphaValue.floatValue();}
88    else return 1.0f;
89      }
90  
91  }