File: setColors.sci

package info (click to toggle)
scilab-plotlib 0.41-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,196 kB
  • sloc: xml: 3,308; makefile: 15
file content (60 lines) | stat: -rw-r--r-- 1,429 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function setColors(_entity,h)

global _SHADED_ENTITIES
  
_type=h.typeOfPlot;
ax=h.parent;
_win=ax.parent;

if or(_type==['mesh';'trimesh'])
  if h.FaceColor=='default'
   _entity.color_mode=findColorIndex(_win,ax.user_data.Color);
  elseif h.FaceColor~='none'
    _entity.color_mode=findColorIndex(_win,h.FaceColor);
  else
     _entity.color_mode=0;
  end  
  c=h.EdgeColor;
  if c=='default'
    c=1-ax.user_data.Color;     
    _entity.foreground=findColorIndex(_win,c);
  elseif c=='none' & h.FaceColor=='none'
    _entity.surface_mode='off';
  elseif type(c)==1
     _entity.foreground=findColorIndex(_win,c);
  end
  _entity.hiddencolor=-1;
  _entity.color_flag=0;

elseif or(_type==_SHADED_ENTITIES)

  if h.EdgeColor=='none'
     _entity.color_mode=-1;
  else
    c=h.EdgeColor;
    if c=='default'
      if ax.user_data.Color=='none'
        c=[0 0 0];
      else
        c=1-ax.user_data.Color; 
      end
    end
    _entity.color_mode=1;       
    _entity.foreground=findColorIndex(_win,c);
  end
  _entity.hiddencolor=-1;
  if or(h.FaceColor==['default';'flat']) 
    _entity.color_flag=4;  // Matlab flat shading
  elseif h.FaceColor=='mean' 
    _entity.color_flag=2;  // Scilab flat shading
  elseif h.FaceColor=='interp'   
    _entity.color_flag=3;          
  elseif type(h.FaceColor)==1
    _entity.color_flag=0;            
    _entity.color_mode=findColorIndex(_win,h.FaceColor);
  end

end

endfunction