OpendTect-6_4  6.4
randcolor.h
Go to the documentation of this file.
1 #ifndef randcolor_h
2 #define randcolor_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Nanne Hemstra
9  Date: November 2006
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "color.h"
16 #include "statrand.h"
17 
18 inline Color getRandomColor( bool withtransp=false )
19 {
20  return Color( (unsigned char) Stats::randGen().getIndex(255),
21  (unsigned char) Stats::randGen().getIndex(255),
22  (unsigned char) Stats::randGen().getIndex(255),
23  (unsigned char)
24  (withtransp ? Stats::randGen().getIndex(255) : 0) );
25 }
26 
27 
29 {
30  mDefineStaticLocalObject( int, curidx, = -1 );
31  if ( curidx == -1 )
33  else
34  {
35  curidx++;
36  if ( curidx == Color::nrStdDrawColors() )
37  curidx = 0;
38  }
39 
40  return Color::stdDrawColor( curidx );
41 }
42 
43 #endif
static Color stdDrawColor(int)
#define mDefineStaticLocalObject(type, var, init)
Definition: commondefs.h:196
int getIndex(int sz) const
random index in the range [0,sz>
RandGen randGen()
static int nrStdDrawColors()
FixedString Color()
Definition: keystrs.h:46
Color getRandStdDrawColor()
Definition: randcolor.h:28
Color getRandomColor(bool withtransp=false)
Definition: randcolor.h:18
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019