% -*- texinfo -*- % @deftypefn {Function File} {[@var{Y}, @var{newmap}] = } cmpermute (@var{X},@var{map}) % @deftypefnx {Function File} {[@var{Y}, @var{newmap}] = } cmpermute (@var{X},@var{map},@var{index}) % Reorders colors in a colormap. % % @code{[Y,newmap]=cmpermute(X,map)} rearranges colormap @var{map} % randomly returning colormap @var{newmap} and generates indexed image % @var{Y} so that it mantains correspondence between indices and the % colormap from original indexed image @var{X} (both image and colormap % pairs produce the same result). % % @code{[Y,newmap]=cmpermute(X,map,index)} behaves as described above % but instead of sorting colors randomly, it uses @var{index} to define % the order of the colors in the new colormap. % % @strong{Note:} @code{index} shouldn't have repeated elements, this % function won't explicitly check this, but it will fail if it has. % % @end deftypefn