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

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