Esempio n. 1
0
 def to_string(self, format='ascii'):
     ret = ['COLOR_SCALARS %s %s' % (self.name, len(self.scalars[0]))]
     seq = self.scalars
     if format == 'binary':
         if not common.is_int255(seq):
             seq = self.float01_to_int255(seq)
         ret.append(self.seq_to_string(seq, format, 'unsigned char'))
     else:
         if not common.is_float01(seq):
             seq = self.int255_to_float01(seq)
         ret.append(self.seq_to_string(seq, format, 'float'))
     return '\n'.join(ret)
Esempio n. 2
0
 def to_string(self, format='ascii'):
     ret = ['LOOKUP_TABLE %s %s' % (self.name, len(self.table))]
     seq = self.table
     if format == 'binary':
         if not common.is_int255(seq):
             seq = self.float01_to_int255(seq)
         ret.append(self.seq_to_string(seq, format, 'unsigned char'))
     else:
         if not common.is_float01(seq):
             seq = self.int255_to_float01(seq)
         ret.append(self.seq_to_string(seq, format, 'float'))
     return string.join(ret, '\n')
Esempio n. 3
0
 def to_string(self,format='ascii'):
     ret = ['COLOR_SCALARS %s %s'%(self.name,len(self.scalars[0]))]
     seq = self.scalars
     if format=='binary':
         if not common.is_int255(seq):
             seq = self.float01_to_int255(seq)
         ret.append(self.seq_to_string(seq,format,'unsigned char'))
     else:
         if not common.is_float01(seq):
             seq = self.int255_to_float01(seq)
         ret.append(self.seq_to_string(seq,format,'float'))
     return string.join(ret,'\n')
Esempio n. 4
0
 def to_string(self,format='ascii'):
     ret = ['LOOKUP_TABLE %s %s'%(self.name,len(self.table))]
     seq = self.table
     if format=='binary':
         if not common.is_int255(seq):
             seq = self.float01_to_int255(seq)
         ret.append(self.seq_to_string(seq,format,'unsigned char'))
     else:
         if not common.is_float01(seq):
             seq = self.int255_to_float01(seq)
         ret.append(self.seq_to_string(seq,format,'float'))
     return string.join(ret,'\n')