11using System ;
22using System . Collections . Generic ;
33using System . Drawing ;
4+ using System . Linq ;
45using System . Text ;
56
67namespace Spectrogram
78{
89 public class Colormap
910 {
11+ public static Colormap Afmhot => new Colormap ( new Colormaps . Afmhot ( ) ) ;
12+ public static Colormap AfmhotReversed => new Colormap ( new Colormaps . AfmhotReversed ( ) ) ;
1013 public static Colormap Argo => new Colormap ( new Colormaps . Argo ( ) ) ;
14+ public static Colormap Autumn => new Colormap ( new Colormaps . Autumn ( ) ) ;
15+ public static Colormap AutumnReversed => new Colormap ( new Colormaps . AutumnReversed ( ) ) ;
16+ public static Colormap Binary => new Colormap ( new Colormaps . Binary ( ) ) ;
17+ public static Colormap BinaryReversed => new Colormap ( new Colormaps . BinaryReversed ( ) ) ;
1118 public static Colormap Blues => new Colormap ( new Colormaps . Blues ( ) ) ;
19+ public static Colormap BluesReversed => new Colormap ( new Colormaps . BluesReversed ( ) ) ;
20+ public static Colormap Bone => new Colormap ( new Colormaps . Bone ( ) ) ;
21+ public static Colormap BoneReversed => new Colormap ( new Colormaps . BoneReversed ( ) ) ;
22+ public static Colormap Brbg => new Colormap ( new Colormaps . Brbg ( ) ) ;
23+ public static Colormap BrbgReversed => new Colormap ( new Colormaps . BrbgReversed ( ) ) ;
24+ public static Colormap Brg => new Colormap ( new Colormaps . Brg ( ) ) ;
25+ public static Colormap BrgReversed => new Colormap ( new Colormaps . BrgReversed ( ) ) ;
26+ public static Colormap Bugn => new Colormap ( new Colormaps . Bugn ( ) ) ;
27+ public static Colormap BugnReversed => new Colormap ( new Colormaps . BugnReversed ( ) ) ;
28+ public static Colormap Bupu => new Colormap ( new Colormaps . Bupu ( ) ) ;
29+ public static Colormap BupuReversed => new Colormap ( new Colormaps . BupuReversed ( ) ) ;
30+ public static Colormap Bwr => new Colormap ( new Colormaps . Bwr ( ) ) ;
31+ public static Colormap BwrReversed => new Colormap ( new Colormaps . BwrReversed ( ) ) ;
1232 public static Colormap Cividis => new Colormap ( new Colormaps . Cividis ( ) ) ;
13- public static Colormap Grayscale => new Colormap ( new Colormaps . Grayscale ( ) ) ;
14- public static Colormap GrayscaleReversed => new Colormap ( new Colormaps . GrayscaleReversed ( ) ) ;
33+ public static Colormap CividisReversed => new Colormap ( new Colormaps . CividisReversed ( ) ) ;
34+ public static Colormap Cmrmap => new Colormap ( new Colormaps . Cmrmap ( ) ) ;
35+ public static Colormap CmrmapReversed => new Colormap ( new Colormaps . CmrmapReversed ( ) ) ;
36+ public static Colormap Cool => new Colormap ( new Colormaps . Cool ( ) ) ;
37+ public static Colormap CoolReversed => new Colormap ( new Colormaps . CoolReversed ( ) ) ;
38+ public static Colormap Coolwarm => new Colormap ( new Colormaps . Coolwarm ( ) ) ;
39+ public static Colormap CoolwarmReversed => new Colormap ( new Colormaps . CoolwarmReversed ( ) ) ;
40+ public static Colormap Copper => new Colormap ( new Colormaps . Copper ( ) ) ;
41+ public static Colormap CopperReversed => new Colormap ( new Colormaps . CopperReversed ( ) ) ;
42+ public static Colormap Cubehelix => new Colormap ( new Colormaps . Cubehelix ( ) ) ;
43+ public static Colormap CubehelixReversed => new Colormap ( new Colormaps . CubehelixReversed ( ) ) ;
44+ public static Colormap Flag => new Colormap ( new Colormaps . Flag ( ) ) ;
45+ public static Colormap FlagReversed => new Colormap ( new Colormaps . FlagReversed ( ) ) ;
46+ public static Colormap GistReversedainbow => new Colormap ( new Colormaps . GistReversedainbow ( ) ) ;
47+ public static Colormap GistReversedainbowReversed => new Colormap ( new Colormaps . GistReversedainbowReversed ( ) ) ;
48+ public static Colormap Gnbu => new Colormap ( new Colormaps . Gnbu ( ) ) ;
49+ public static Colormap GnbuReversed => new Colormap ( new Colormaps . GnbuReversed ( ) ) ;
50+ public static Colormap Gnuplot => new Colormap ( new Colormaps . Gnuplot ( ) ) ;
51+ public static Colormap Gnuplot2 => new Colormap ( new Colormaps . Gnuplot2 ( ) ) ;
52+ public static Colormap Gnuplot2Reversed => new Colormap ( new Colormaps . Gnuplot2Reversed ( ) ) ;
53+ public static Colormap GnuplotReversed => new Colormap ( new Colormaps . GnuplotReversed ( ) ) ;
54+ public static Colormap Gray => new Colormap ( new Colormaps . Gray ( ) ) ;
55+ public static Colormap GrayReversed => new Colormap ( new Colormaps . GrayReversed ( ) ) ;
1556 public static Colormap Greens => new Colormap ( new Colormaps . Greens ( ) ) ;
16- public static Colormap Jet => new Colormap ( new Colormaps . Jet ( ) ) ;
57+ public static Colormap GreensReversed => new Colormap ( new Colormaps . GreensReversed ( ) ) ;
58+ public static Colormap Greys => new Colormap ( new Colormaps . Greys ( ) ) ;
59+ public static Colormap GreysReversed => new Colormap ( new Colormaps . GreysReversed ( ) ) ;
60+ public static Colormap Hot => new Colormap ( new Colormaps . Hot ( ) ) ;
61+ public static Colormap HotReversed => new Colormap ( new Colormaps . HotReversed ( ) ) ;
62+ public static Colormap Hsv => new Colormap ( new Colormaps . Hsv ( ) ) ;
63+ public static Colormap HsvReversed => new Colormap ( new Colormaps . HsvReversed ( ) ) ;
1764 public static Colormap Inferno => new Colormap ( new Colormaps . Inferno ( ) ) ;
65+ public static Colormap InfernoReversed => new Colormap ( new Colormaps . InfernoReversed ( ) ) ;
66+ public static Colormap Jet => new Colormap ( new Colormaps . Jet ( ) ) ;
67+ public static Colormap JetReversed => new Colormap ( new Colormaps . JetReversed ( ) ) ;
1868 public static Colormap Magma => new Colormap ( new Colormaps . Magma ( ) ) ;
69+ public static Colormap MagmaReversed => new Colormap ( new Colormaps . MagmaReversed ( ) ) ;
70+ public static Colormap Ocean => new Colormap ( new Colormaps . Ocean ( ) ) ;
71+ public static Colormap OceanReversed => new Colormap ( new Colormaps . OceanReversed ( ) ) ;
72+ public static Colormap Oranges => new Colormap ( new Colormaps . Oranges ( ) ) ;
73+ public static Colormap OrangesReversed => new Colormap ( new Colormaps . OrangesReversed ( ) ) ;
74+ public static Colormap Orrd => new Colormap ( new Colormaps . Orrd ( ) ) ;
75+ public static Colormap OrrdReversed => new Colormap ( new Colormaps . OrrdReversed ( ) ) ;
76+ public static Colormap Pink => new Colormap ( new Colormaps . Pink ( ) ) ;
77+ public static Colormap PinkReversed => new Colormap ( new Colormaps . PinkReversed ( ) ) ;
78+ public static Colormap Piyg => new Colormap ( new Colormaps . Piyg ( ) ) ;
79+ public static Colormap PiygReversed => new Colormap ( new Colormaps . PiygReversed ( ) ) ;
1980 public static Colormap Plasma => new Colormap ( new Colormaps . Plasma ( ) ) ;
81+ public static Colormap PlasmaReversed => new Colormap ( new Colormaps . PlasmaReversed ( ) ) ;
82+ public static Colormap Prgn => new Colormap ( new Colormaps . Prgn ( ) ) ;
83+ public static Colormap PrgnReversed => new Colormap ( new Colormaps . PrgnReversed ( ) ) ;
84+ public static Colormap PrismReversed => new Colormap ( new Colormaps . PrismReversed ( ) ) ;
85+ public static Colormap Pubu => new Colormap ( new Colormaps . Pubu ( ) ) ;
86+ public static Colormap PubuReversed => new Colormap ( new Colormaps . PubuReversed ( ) ) ;
87+ public static Colormap Pubugn => new Colormap ( new Colormaps . Pubugn ( ) ) ;
88+ public static Colormap PubugnReversed => new Colormap ( new Colormaps . PubugnReversed ( ) ) ;
89+ public static Colormap Puor => new Colormap ( new Colormaps . Puor ( ) ) ;
90+ public static Colormap PuorReversed => new Colormap ( new Colormaps . PuorReversed ( ) ) ;
91+ public static Colormap Purd => new Colormap ( new Colormaps . Purd ( ) ) ;
92+ public static Colormap PurdReversed => new Colormap ( new Colormaps . PurdReversed ( ) ) ;
93+ public static Colormap Purples => new Colormap ( new Colormaps . Purples ( ) ) ;
94+ public static Colormap PurplesReversed => new Colormap ( new Colormaps . PurplesReversed ( ) ) ;
95+ public static Colormap Rainbow => new Colormap ( new Colormaps . Rainbow ( ) ) ;
96+ public static Colormap RainbowReversed => new Colormap ( new Colormaps . RainbowReversed ( ) ) ;
97+ public static Colormap Rdbu => new Colormap ( new Colormaps . Rdbu ( ) ) ;
98+ public static Colormap RdbuReversed => new Colormap ( new Colormaps . RdbuReversed ( ) ) ;
99+ public static Colormap Rdgy => new Colormap ( new Colormaps . Rdgy ( ) ) ;
100+ public static Colormap RdgyReversed => new Colormap ( new Colormaps . RdgyReversed ( ) ) ;
101+ public static Colormap Rdpu => new Colormap ( new Colormaps . Rdpu ( ) ) ;
102+ public static Colormap RdpuReversed => new Colormap ( new Colormaps . RdpuReversed ( ) ) ;
103+ public static Colormap Rdylbu => new Colormap ( new Colormaps . Rdylbu ( ) ) ;
104+ public static Colormap RdylbuReversed => new Colormap ( new Colormaps . RdylbuReversed ( ) ) ;
105+ public static Colormap Rdylgn => new Colormap ( new Colormaps . Rdylgn ( ) ) ;
106+ public static Colormap RdylgnReversed => new Colormap ( new Colormaps . RdylgnReversed ( ) ) ;
107+ public static Colormap Reds => new Colormap ( new Colormaps . Reds ( ) ) ;
108+ public static Colormap RedsReversed => new Colormap ( new Colormaps . RedsReversed ( ) ) ;
109+ public static Colormap Seismic => new Colormap ( new Colormaps . Seismic ( ) ) ;
110+ public static Colormap SeismicReversed => new Colormap ( new Colormaps . SeismicReversed ( ) ) ;
111+ public static Colormap Spectral => new Colormap ( new Colormaps . Spectral ( ) ) ;
112+ public static Colormap SpectralReversed => new Colormap ( new Colormaps . SpectralReversed ( ) ) ;
113+ public static Colormap Spring => new Colormap ( new Colormaps . Spring ( ) ) ;
114+ public static Colormap SpringReversed => new Colormap ( new Colormaps . SpringReversed ( ) ) ;
115+ public static Colormap Summer => new Colormap ( new Colormaps . Summer ( ) ) ;
116+ public static Colormap SummerReversed => new Colormap ( new Colormaps . SummerReversed ( ) ) ;
117+ public static Colormap Terrain => new Colormap ( new Colormaps . Terrain ( ) ) ;
118+ public static Colormap TerrainReversed => new Colormap ( new Colormaps . TerrainReversed ( ) ) ;
119+ public static Colormap Twilight => new Colormap ( new Colormaps . Twilight ( ) ) ;
120+ public static Colormap TwilightReversed => new Colormap ( new Colormaps . TwilightReversed ( ) ) ;
20121 public static Colormap Viridis => new Colormap ( new Colormaps . Viridis ( ) ) ;
122+ public static Colormap ViridisReversed => new Colormap ( new Colormaps . ViridisReversed ( ) ) ;
123+ public static Colormap Winter => new Colormap ( new Colormaps . Winter ( ) ) ;
124+ public static Colormap WinterReversed => new Colormap ( new Colormaps . WinterReversed ( ) ) ;
125+ public static Colormap Wistia => new Colormap ( new Colormaps . Wistia ( ) ) ;
126+ public static Colormap WistiaReversed => new Colormap ( new Colormaps . WistiaReversed ( ) ) ;
127+ public static Colormap Ylgn => new Colormap ( new Colormaps . Ylgn ( ) ) ;
128+ public static Colormap YlgnReversed => new Colormap ( new Colormaps . YlgnReversed ( ) ) ;
129+ public static Colormap Ylgnbu => new Colormap ( new Colormaps . Ylgnbu ( ) ) ;
130+ public static Colormap YlgnbuReversed => new Colormap ( new Colormaps . YlgnbuReversed ( ) ) ;
131+ public static Colormap Ylorbr => new Colormap ( new Colormaps . Ylorbr ( ) ) ;
132+ public static Colormap YlorbrReversed => new Colormap ( new Colormaps . YlorbrReversed ( ) ) ;
133+ public static Colormap Ylorrd => new Colormap ( new Colormaps . Ylorrd ( ) ) ;
134+ public static Colormap YlorrdReversed => new Colormap ( new Colormaps . YlorrdReversed ( ) ) ;
21135
22136 private readonly IColormap cmap ;
23137 public readonly string Name ;
24138 public Colormap ( IColormap colormap )
25139 {
26- cmap = colormap ?? new Colormaps . Grayscale ( ) ;
140+ cmap = colormap ?? new Colormaps . Gray ( ) ;
27141 Name = cmap . GetType ( ) . Name ;
28142 }
29143
@@ -32,6 +146,19 @@ public override string ToString()
32146 return $ "Colormap { Name } ";
33147 }
34148
149+ public static Colormap [ ] GetColormaps ( )
150+ {
151+ IColormap [ ] ics = AppDomain . CurrentDomain . GetAssemblies ( )
152+ . SelectMany ( s => s . GetTypes ( ) )
153+ . Where ( p => p . IsInterface == false )
154+ . Where ( p => p . ToString ( ) . StartsWith ( "Spectrogram.Colormaps." ) )
155+ . Select ( x => x . ToString ( ) )
156+ . Select ( path => ( IColormap ) Activator . CreateInstance ( Type . GetType ( path ) ) )
157+ . ToArray ( ) ;
158+
159+ return ics . Select ( x => new Colormap ( x ) ) . ToArray ( ) ;
160+ }
161+
35162 public ( byte r , byte g , byte b ) GetRGB ( byte value )
36163 {
37164 return cmap . GetRGB ( value ) ;
0 commit comments