/[escript]/trunk/pyvisi/py_src/colormap.py
ViewVC logotype

Diff of /trunk/pyvisi/py_src/colormap.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 851 by jongui, Fri Sep 15 07:11:55 2006 UTC revision 852 by jongui, Wed Sep 20 03:23:16 2006 UTC
# Line 3  Line 3 
3  @author: Lutz Gross  @author: Lutz Gross
4  """  """
5    
 class ColorMap:  
     """  
     Class that defines the mapping of colors.  
     """  
   
     def __init__(self, color_name):  
         """  
         @type color_name: String  
         @param color_name: Name of the color  
         """  
   
         self.color_name = color_name  
         self.color_map = {}  
         self.buildColorMap()  
   
     def buildColorMap(self):  
         """  
         Build a hash that defines mapping of colors.  
         """  
   
         self.color_map["Red"] = [1, 0, 0]  
         self.color_map["Green"]= [0, 1, 0]  
         self.color_map["Blue"] = [0, 0, 1]  
         self.color_map["Black"] = [0, 0, 0]  
         self.color_map["White"] = [1, 1, 1]  
         self.color_map["Yellow"] = [1,1,0]  
         self.color_map["Pink"] = [1, 0.0784, 0.4588]  
         self.color_map["Orange"] = [1, 0.2706, 0]  
         self.color_map["Purple"] = [0.5412, 0.1680, 0.8828]  
         self.color_map["Grey"] = [0.6602, 0.6602, 0.6602]  
         self.color_map["Brown"] = [0.5430, 0.2700, 0.0742]  
   
     def getR(self):  
         """  
         Return the red(R) value from the RGB.  
   
         @rtype: Number  
         @return: Red(R) value from the RGB  
         """  
   
         return self.color_map[self.color_name][0]  
   
     def getG(self):  
         """  
         Return the green(G) value from the RGB.  
   
         @rtype: Number  
         @return: Green(G) value from the RGB  
         """  
   
         return self.color_map[self.color_name][1]  
   
     def getB(self):  
         """  
         Return the blue(B) value from the RGB.  
   
         @rtype: Number  
         @return: Blue(B) value from the RGB  
         """  
   
         return self.color_map[self.color_name][2]  
   
     def getColor(self):  
         """  
         Return the name of the color.  
       
         @rtype: String  
         @return: Name of the color  
         """  
   
         return self.color_name  
       
6  import vtk    import vtk  
7    
8  class Lut:  class Lut:

Legend:
Removed from v.851  
changed lines
  Added in v.852

  ViewVC Help
Powered by ViewVC 1.1.26