API Documentation
Loading...
Searching...
No Matches
RandomColorGenerator.h
Go to the documentation of this file.
1#pragma once
2#include <NDEVR/RGBColor.h>
3#include <NDEVR/Buffer.h>
4#include <NDEVR/Bounds.h>
5#include <NDEVR/Dictionary.h>
6#include <cmath>
7namespace NDEVR
8{
34 {
35 private:
36 enum ColorRangeType
37 {
38 e_hue_range,
39 e_low_bounds,
40 e_saturation_range,
41 e_brightness_range
42 };
44 public:
45
46
47 static ColorMap LoadColorBounds();
48 //--------------------------------------------------------------------------
50 : options()
51 {}
53 : options(opt)
54 {}
55 Buffer<RGBColor> randomColors(uint04 count) const;
56 RGBColor randomColorRGB() const;
57
58 private:
59
60 mutable RandomColorOptions options;
61 static ColorMap s_color_dictionary;
62 //--------------------------------------------------------------------------
63 private:
64 //--------------------------------------------------------------------------
65 Bounds<1, sint04> getSaturationRange(const Angle<sint02>& hue) const {
66 return getColorInfo(hue.toTypeAngle<sint04>())[ColorRangeType::e_saturation_range][0];
67 }
68 //--------------------------------------------------------------------------
69 static Bounds<1, sint04> getHueRange(int colorInput);
70 //--------------------------------------------------------------------------
71 static Bounds<1, sint04> getHueRange_s(HUENAMES colorInput);
72 //--------------------------------------------------------------------------
73 sint04 randomWithin(const Bounds<1, sint04>& range) const;
74 //--------------------------------------------------------------------------
75 Angle<sint02> pickHue() const;
76 //--------------------------------------------------------------------------
77 Dictionary<ColorRangeType, Buffer<Bounds<1, sint04>>> getColorInfo(Angle<sint04> hue) const;
78 //--------------------------------------------------------------------------
79 uint01 pickSaturation(const Angle<sint02>& hue) const;
80 //--------------------------------------------------------------------------
81 uint01 getMinimumBrightness(const Angle<sint02>& H, uint01 S) const;
82 //--------------------------------------------------------------------------
83 uint01 pickBrightness(const Angle<sint02>& H, uint01 S) const;
84
85 };
86};
#define NDEVR_BASE_API
Definition DLLInfo.h:78
Stores an angle in an optimized format.
Definition StringStream.h:352
constexpr Angle< t_new_type > toTypeAngle() const
Definition Angle.h:326
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:57
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition Dictionary.h:48
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:53
Definition RandomColorGenerator.h:34
RandomColorGenerator(const RandomColorOptions &opt)
Definition RandomColorGenerator.h:52
RandomColorGenerator()
Definition RandomColorGenerator.h:49
#define H(x, y, z)
Definition md5.cpp:17
Definition ACIColor.h:37
int32_t sint04
-Defines an alias representing a 4 byte, signed integer. -Can represent exact integer values -2147483...
Definition BaseValues.hpp:76
HUENAMES
Definition RandomColorGenerator.h:15
@ PINK
Definition RandomColorGenerator.h:24
@ PURPLE
Definition RandomColorGenerator.h:23
@ BLUE
Definition RandomColorGenerator.h:22
@ GREEN
Definition RandomColorGenerator.h:21
@ MONOCHROME
Definition RandomColorGenerator.h:17
@ ORANGE
Definition RandomColorGenerator.h:19
@ YELLOW
Definition RandomColorGenerator.h:20
@ UNSET
Definition RandomColorGenerator.h:16
@ RED
Definition RandomColorGenerator.h:18
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
LUMINOSITY
Definition RandomColorGenerator.h:9
@ DARK
Definition RandomColorGenerator.h:13
@ BRIGHT
Definition RandomColorGenerator.h:11
@ RANDOM
Definition RandomColorGenerator.h:10
@ LIGHT
Definition RandomColorGenerator.h:12
Definition RandomColorGenerator.h:26
size_t seed
Definition RandomColorGenerator.h:30
int hue
Definition RandomColorGenerator.h:28
HUENAMES hue_name
Definition RandomColorGenerator.h:29
LUMINOSITY luminosity
Definition RandomColorGenerator.h:31