OpendTect  6.6
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  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "color.h"
15 #include "statrand.h"
16 
17 inline Color getRandomColor( bool withtransp=false )
18 {
19  return Color( (unsigned char) Stats::randGen().getIndex(255),
20  (unsigned char) Stats::randGen().getIndex(255),
21  (unsigned char) Stats::randGen().getIndex(255),
22  (unsigned char)
23  (withtransp ? Stats::randGen().getIndex(255) : 0) );
24 }
25 
26 
28 {
29  mDefineStaticLocalObject( int, curidx, = -1 );
30  if ( curidx == -1 )
32  else
33  {
34  curidx++;
35  if ( curidx == Color::nrStdDrawColors() )
36  curidx = 0;
37  }
38 
39  return Color::stdDrawColor( curidx );
40 }
41 
42 
44 {
45  return Color( (unsigned char) (155 + Stats::randGen().getIndex(100)),
46  (unsigned char) (155 + Stats::randGen().getIndex(100)),
47  (unsigned char) (155 + Stats::randGen().getIndex(100)) );
48 }
sKey::Color
FixedString Color()
Definition: keystrs.h:45
Stats::RandGen::getIndex
int getIndex(int sz) const
random index in the range [0,sz>
Color::nrStdDrawColors
static int nrStdDrawColors()
getRandomColor
Color getRandomColor(bool withtransp=false)
Definition: randcolor.h:17
getRandomFillColor
Color getRandomFillColor()
Definition: randcolor.h:43
statrand.h
getRandStdDrawColor
Color getRandStdDrawColor()
Definition: randcolor.h:27
color.h
Stats::randGen
RandGen randGen()
mDefineStaticLocalObject
#define mDefineStaticLocalObject(type, var, init)
Definition: commondefs.h:203
Color::stdDrawColor
static Color stdDrawColor(int)
Color
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer,...
Definition: color.h:26

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