~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to macros/scicos/set_cmap.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function ok=set_cmap(cmap)
 
2
//appends new colors to the colormap
 
3
// Copyright INRIA
 
4
if cmap==[] then ok=%t,return,end
 
5
if xget('use color')==1 then
 
6
  d=xget('colormap');  
 
7
  for k=1:size(cmap,1)
 
8
    [mc,kk]=mini(abs(d-ones(size(d,1),1)*cmap(k,:))*[1;1;1])
 
9
    if mc>.0001 then
 
10
      d=[d;cmap(k,:)]
 
11
    end
 
12
  end
 
13
  errcatch(9999,'continue')
 
14
  xset('colormap',d);
 
15
  errcatch(-1)
 
16
  if iserror(9999) then
 
17
    errclear(9999)
 
18
    ok=%f
 
19
  else
 
20
    ok=%t
 
21
  end
 
22
end
 
23