├── .gitignore
├── README.md
├── example-live-update
├── Makefile
├── Project.xcconfig
├── addons.make
├── bin
│ └── data
│ │ └── .gitkeep
├── config.make
├── example.xcodeproj
│ ├── project.pbxproj
│ └── xcshareddata
│ │ └── xcschemes
│ │ ├── example Debug.xcscheme
│ │ └── example Release.xcscheme
├── openFrameworks-Info.plist
└── src
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── example
├── Makefile
├── Project.xcconfig
├── addons.make
├── bin
│ └── data
│ │ └── .gitkeep
├── config.make
├── example.xcodeproj
│ ├── project.pbxproj
│ └── xcshareddata
│ │ └── xcschemes
│ │ ├── example Debug.xcscheme
│ │ └── example Release.xcscheme
├── openFrameworks-Info.plist
└── src
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── libs
└── heatmap
│ ├── colorschemes
│ ├── Blues.c
│ ├── Blues.h
│ ├── BrBG.c
│ ├── BrBG.h
│ ├── BuGn.c
│ ├── BuGn.h
│ ├── BuPu.c
│ ├── BuPu.h
│ ├── GnBu.c
│ ├── GnBu.h
│ ├── Greens.c
│ ├── Greens.h
│ ├── Greys.c
│ ├── Greys.h
│ ├── OrRd.c
│ ├── OrRd.h
│ ├── Oranges.c
│ ├── Oranges.h
│ ├── PRGn.c
│ ├── PRGn.h
│ ├── PiYG.c
│ ├── PiYG.h
│ ├── PuBu.c
│ ├── PuBu.h
│ ├── PuBuGn.c
│ ├── PuBuGn.h
│ ├── PuOr.c
│ ├── PuOr.h
│ ├── PuRd.c
│ ├── PuRd.h
│ ├── Purples.c
│ ├── Purples.h
│ ├── RdBu.c
│ ├── RdBu.h
│ ├── RdGy.c
│ ├── RdGy.h
│ ├── RdPu.c
│ ├── RdPu.h
│ ├── RdYlBu.c
│ ├── RdYlBu.h
│ ├── RdYlGn.c
│ ├── RdYlGn.h
│ ├── Reds.c
│ ├── Reds.h
│ ├── Spectral.c
│ ├── Spectral.h
│ ├── YlGn.c
│ ├── YlGn.h
│ ├── YlGnBu.c
│ ├── YlGnBu.h
│ ├── YlOrBr.c
│ ├── YlOrBr.h
│ ├── YlOrRd.c
│ ├── YlOrRd.h
│ ├── colorbrewer.go
│ ├── colorscheme.go
│ ├── gradientgen.go
│ ├── gray.c
│ └── gray.h
│ ├── heatmap.c
│ └── heatmap.h
├── ofxaddons_thumbnail.png
└── src
└── ofxHeatMap.h
/.gitignore:
--------------------------------------------------------------------------------
1 | #########################
2 | # openFrameworks patterns
3 | #########################
4 |
5 | # build files
6 | openFrameworks.a
7 | openFrameworksDebug.a
8 | openFrameworksUniversal.a
9 | libs/openFrameworksCompiled/lib/*/*
10 | !libs/openFrameworksCompiled/lib/*/.gitkeep
11 |
12 | # apothecary
13 | scripts/apothecary/build
14 |
15 | # rule to avoid non-official addons going into git
16 | # see addons/.gitignore
17 | addons/*
18 |
19 | # rule to avoid non-official apps going into git
20 | # see apps/.gitignore
21 | apps/*
22 |
23 | # also, see examples/.gitignore
24 |
25 | #########################
26 | # general
27 | #########################
28 |
29 | [Bb]uild/
30 | [Oo]bj/
31 | *.o
32 | [Dd]ebug*/
33 | [Rr]elease*/
34 | *.mode*
35 | *.app/
36 | *.pyc
37 | .svn/
38 | *.log
39 | *.cpp.eep
40 | *.cpp.elf
41 | *.cpp.hex
42 |
43 | #########################
44 | # IDE
45 | #########################
46 |
47 | # XCode
48 | *.pbxuser
49 | *.perspective
50 | *.perspectivev3
51 | *.mode1v3
52 | *.mode2v3
53 | # XCode 4
54 | xcuserdata
55 | *.xcworkspace
56 |
57 | # Code::Blocks
58 | *.depend
59 | *.layout
60 |
61 | # Visual Studio
62 | *.sdf
63 | *.opensdf
64 | *.suo
65 | *.pdb
66 | *.ilk
67 | *.aps
68 | ipch/
69 |
70 | # Eclipse
71 | .metadata
72 | local.properties
73 | .externalToolBuilders
74 |
75 | #########################
76 | # operating system
77 | #########################
78 |
79 | # Linux
80 | *~
81 | # KDE
82 | .directory
83 | .AppleDouble
84 |
85 | # OSX
86 | .DS_Store
87 | *.swp
88 | *~.nib
89 | # Thumbnails
90 | ._*
91 |
92 | # Windows
93 | # Windows image file caches
94 | Thumbs.db
95 | # Folder config file
96 | Desktop.ini
97 |
98 | # Android
99 | .csettings
100 | /libs/openFrameworksCompiled/project/android/paths.make
101 |
102 | # Android Studio
103 | *.iml
104 |
105 | #########################
106 | # miscellaneous
107 | #########################
108 |
109 | .mailmap
110 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ofxHeatMap
2 | An openFrameworks addon for generating heat maps using [lucasb-eyer/heatmap](https://github.com/lucasb-eyer/heatmap).
3 |
4 | ## License
5 |
6 | The MIT License (MIT)
7 |
8 | Copyright (c) 2015 Hideyuki SAITO
9 |
10 | Permission is hereby granted, free of charge, to any person obtaining a copy
11 | of this software and associated documentation files (the "Software"), to deal
12 | in the Software without restriction, including without limitation the rights
13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 | copies of the Software, and to permit persons to whom the Software is
15 | furnished to do so, subject to the following conditions:
16 |
17 | The above copyright notice and this permission notice shall be included in
18 | all copies or substantial portions of the Software.
19 |
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 | THE SOFTWARE.
--------------------------------------------------------------------------------
/example-live-update/Makefile:
--------------------------------------------------------------------------------
1 | # Attempt to load a config.make file.
2 | # If none is found, project defaults in config.project.make will be used.
3 | ifneq ($(wildcard config.make),)
4 | include config.make
5 | endif
6 |
7 | # make sure the the OF_ROOT location is defined
8 | ifndef OF_ROOT
9 | OF_ROOT=../../..
10 | endif
11 |
12 | # call the project makefile!
13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk
14 |
--------------------------------------------------------------------------------
/example-live-update/Project.xcconfig:
--------------------------------------------------------------------------------
1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT.
2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED
3 | OF_PATH = ../../..
4 |
5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE
6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig"
7 |
8 | //ICONS - NEW IN 0072
9 | ICON_NAME_DEBUG = icon-debug.icns
10 | ICON_NAME_RELEASE = icon.icns
11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/
12 |
13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to:
14 | //ICON_FILE_PATH = bin/data/
15 |
16 | OTHER_LDFLAGS = $(OF_CORE_LIBS)
17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS)
18 |
--------------------------------------------------------------------------------
/example-live-update/addons.make:
--------------------------------------------------------------------------------
1 | ofxHeatMap
2 |
--------------------------------------------------------------------------------
/example-live-update/bin/data/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hideyukisaito/ofxHeatMap/50170a744a1b3a81a4f13acbe1c24ef5fe89c5db/example-live-update/bin/data/.gitkeep
--------------------------------------------------------------------------------
/example-live-update/config.make:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # CONFIGURE PROJECT MAKEFILE (optional)
3 | # This file is where we make project specific configurations.
4 | ################################################################################
5 |
6 | ################################################################################
7 | # OF ROOT
8 | # The location of your root openFrameworks installation
9 | # (default) OF_ROOT = ../../..
10 | ################################################################################
11 | # OF_ROOT = ../../..
12 |
13 | ################################################################################
14 | # PROJECT ROOT
15 | # The location of the project - a starting place for searching for files
16 | # (default) PROJECT_ROOT = . (this directory)
17 | #
18 | ################################################################################
19 | # PROJECT_ROOT = .
20 |
21 | ################################################################################
22 | # PROJECT SPECIFIC CHECKS
23 | # This is a project defined section to create internal makefile flags to
24 | # conditionally enable or disable the addition of various features within
25 | # this makefile. For instance, if you want to make changes based on whether
26 | # GTK is installed, one might test that here and create a variable to check.
27 | ################################################################################
28 | # None
29 |
30 | ################################################################################
31 | # PROJECT EXTERNAL SOURCE PATHS
32 | # These are fully qualified paths that are not within the PROJECT_ROOT folder.
33 | # Like source folders in the PROJECT_ROOT, these paths are subject to
34 | # exlclusion via the PROJECT_EXLCUSIONS list.
35 | #
36 | # (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank)
37 | #
38 | # Note: Leave a leading space when adding list items with the += operator
39 | ################################################################################
40 | # PROJECT_EXTERNAL_SOURCE_PATHS =
41 |
42 | ################################################################################
43 | # PROJECT EXCLUSIONS
44 | # These makefiles assume that all folders in your current project directory
45 | # and any listed in the PROJECT_EXTERNAL_SOURCH_PATHS are are valid locations
46 | # to look for source code. The any folders or files that match any of the
47 | # items in the PROJECT_EXCLUSIONS list below will be ignored.
48 | #
49 | # Each item in the PROJECT_EXCLUSIONS list will be treated as a complete
50 | # string unless teh user adds a wildcard (%) operator to match subdirectories.
51 | # GNU make only allows one wildcard for matching. The second wildcard (%) is
52 | # treated literally.
53 | #
54 | # (default) PROJECT_EXCLUSIONS = (blank)
55 | #
56 | # Will automatically exclude the following:
57 | #
58 | # $(PROJECT_ROOT)/bin%
59 | # $(PROJECT_ROOT)/obj%
60 | # $(PROJECT_ROOT)/%.xcodeproj
61 | #
62 | # Note: Leave a leading space when adding list items with the += operator
63 | ################################################################################
64 | # PROJECT_EXCLUSIONS =
65 |
66 | ################################################################################
67 | # PROJECT LINKER FLAGS
68 | # These flags will be sent to the linker when compiling the executable.
69 | #
70 | # (default) PROJECT_LDFLAGS = -Wl,-rpath=./libs
71 | #
72 | # Note: Leave a leading space when adding list items with the += operator
73 | ################################################################################
74 |
75 | # Currently, shared libraries that are needed are copied to the
76 | # $(PROJECT_ROOT)/bin/libs directory. The following LDFLAGS tell the linker to
77 | # add a runtime path to search for those shared libraries, since they aren't
78 | # incorporated directly into the final executable application binary.
79 | # TODO: should this be a default setting?
80 | # PROJECT_LDFLAGS=-Wl,-rpath=./libs
81 |
82 | ################################################################################
83 | # PROJECT DEFINES
84 | # Create a space-delimited list of DEFINES. The list will be converted into
85 | # CFLAGS with the "-D" flag later in the makefile.
86 | #
87 | # (default) PROJECT_DEFINES = (blank)
88 | #
89 | # Note: Leave a leading space when adding list items with the += operator
90 | ################################################################################
91 | # PROJECT_DEFINES =
92 |
93 | ################################################################################
94 | # PROJECT CFLAGS
95 | # This is a list of fully qualified CFLAGS required when compiling for this
96 | # project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS
97 | # defined in your platform specific core configuration files. These flags are
98 | # presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below.
99 | #
100 | # (default) PROJECT_CFLAGS = (blank)
101 | #
102 | # Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in
103 | # your platform specific configuration file will be applied by default and
104 | # further flags here may not be needed.
105 | #
106 | # Note: Leave a leading space when adding list items with the += operator
107 | ################################################################################
108 | # PROJECT_CFLAGS =
109 |
110 | ################################################################################
111 | # PROJECT OPTIMIZATION CFLAGS
112 | # These are lists of CFLAGS that are target-specific. While any flags could
113 | # be conditionally added, they are usually limited to optimization flags.
114 | # These flags are added BEFORE the PROJECT_CFLAGS.
115 | #
116 | # PROJECT_OPTIMIZATION_CFLAGS_RELEASE flags are only applied to RELEASE targets.
117 | #
118 | # (default) PROJECT_OPTIMIZATION_CFLAGS_RELEASE = (blank)
119 | #
120 | # PROJECT_OPTIMIZATION_CFLAGS_DEBUG flags are only applied to DEBUG targets.
121 | #
122 | # (default) PROJECT_OPTIMIZATION_CFLAGS_DEBUG = (blank)
123 | #
124 | # Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the
125 | # PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration
126 | # file will be applied by default and further optimization flags here may not
127 | # be needed.
128 | #
129 | # Note: Leave a leading space when adding list items with the += operator
130 | ################################################################################
131 | # PROJECT_OPTIMIZATION_CFLAGS_RELEASE =
132 | # PROJECT_OPTIMIZATION_CFLAGS_DEBUG =
133 |
134 | ################################################################################
135 | # PROJECT COMPILERS
136 | # Custom compilers can be set for CC and CXX
137 | # (default) PROJECT_CXX = (blank)
138 | # (default) PROJECT_CC = (blank)
139 | # Note: Leave a leading space when adding list items with the += operator
140 | ################################################################################
141 | # PROJECT_CXX =
142 | # PROJECT_CC =
143 |
--------------------------------------------------------------------------------
/example-live-update/example.xcodeproj/xcshareddata/xcschemes/example Debug.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/example-live-update/example.xcodeproj/xcshareddata/xcschemes/example Release.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/example-live-update/openFrameworks-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | cc.openFrameworks.ofapp
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | APPL
15 | CFBundleSignature
16 | ????
17 | CFBundleVersion
18 | 1.0
19 | CFBundleIconFile
20 | ${ICON}
21 |
22 |
23 |
--------------------------------------------------------------------------------
/example-live-update/src/main.cpp:
--------------------------------------------------------------------------------
1 | #include "ofMain.h"
2 | #include "ofApp.h"
3 |
4 | //========================================================================
5 | int main( )
6 | {
7 | ofSetupOpenGL(1024, 768, OF_WINDOW); // <-------- setup the GL context
8 |
9 | // this kicks off the running of my app
10 | // can be OF_WINDOW or OF_FULLSCREEN
11 | // pass in width and height too:
12 | ofRunApp(new ofApp());
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/example-live-update/src/ofApp.cpp:
--------------------------------------------------------------------------------
1 | #include "ofApp.h"
2 |
3 | //--------------------------------------------------------------
4 | void ofApp::setup()
5 | {
6 | heatmap.setup(ofGetWidth(), ofGetHeight(), 32);
7 | }
8 |
9 | //--------------------------------------------------------------
10 | void ofApp::update()
11 | {
12 | heatmap.update(OFX_HEATMAP_CS_SPECTRAL_SOFT);
13 | }
14 |
15 | //--------------------------------------------------------------
16 | void ofApp::draw()
17 | {
18 | ofBackground(0, 0, 0);
19 |
20 | ofSetColor(255, 255);
21 | heatmap.draw(0, 0);
22 |
23 | ofSetWindowTitle(ofToString(ofGetFrameRate()));
24 | }
25 |
26 | //--------------------------------------------------------------
27 | void ofApp::keyPressed(int key)
28 | {
29 |
30 | }
31 |
32 | //--------------------------------------------------------------
33 | void ofApp::keyReleased(int key)
34 | {
35 |
36 | }
37 |
38 | //--------------------------------------------------------------
39 | void ofApp::mouseMoved(int x, int y )
40 | {
41 | heatmap.addPoint(x, y);
42 | }
43 |
44 | //--------------------------------------------------------------
45 | void ofApp::mouseDragged(int x, int y, int button)
46 | {
47 |
48 | }
49 |
50 | //--------------------------------------------------------------
51 | void ofApp::mousePressed(int x, int y, int button)
52 | {
53 |
54 | }
55 |
56 | //--------------------------------------------------------------
57 | void ofApp::mouseReleased(int x, int y, int button)
58 | {
59 |
60 | }
61 |
62 | //--------------------------------------------------------------
63 | void ofApp::windowResized(int w, int h)
64 | {
65 |
66 | }
67 |
68 | //--------------------------------------------------------------
69 | void ofApp::gotMessage(ofMessage msg)
70 | {
71 |
72 | }
73 |
74 | //--------------------------------------------------------------
75 | void ofApp::dragEvent(ofDragInfo dragInfo)
76 | {
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/example-live-update/src/ofApp.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "ofMain.h"
4 | #include "ofxHeatMap.h"
5 |
6 | class ofApp : public ofBaseApp
7 | {
8 |
9 | public:
10 | void setup();
11 | void update();
12 | void draw();
13 |
14 | void keyPressed(int key);
15 | void keyReleased(int key);
16 | void mouseMoved(int x, int y );
17 | void mouseDragged(int x, int y, int button);
18 | void mousePressed(int x, int y, int button);
19 | void mouseReleased(int x, int y, int button);
20 | void windowResized(int w, int h);
21 | void dragEvent(ofDragInfo dragInfo);
22 | void gotMessage(ofMessage msg);
23 |
24 | ofxHeatMap heatmap;
25 | };
26 |
--------------------------------------------------------------------------------
/example/Makefile:
--------------------------------------------------------------------------------
1 | # Attempt to load a config.make file.
2 | # If none is found, project defaults in config.project.make will be used.
3 | ifneq ($(wildcard config.make),)
4 | include config.make
5 | endif
6 |
7 | # make sure the the OF_ROOT location is defined
8 | ifndef OF_ROOT
9 | OF_ROOT=../../..
10 | endif
11 |
12 | # call the project makefile!
13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk
14 |
--------------------------------------------------------------------------------
/example/Project.xcconfig:
--------------------------------------------------------------------------------
1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT.
2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED
3 | OF_PATH = ../../..
4 |
5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE
6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig"
7 |
8 | //ICONS - NEW IN 0072
9 | ICON_NAME_DEBUG = icon-debug.icns
10 | ICON_NAME_RELEASE = icon.icns
11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/
12 |
13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to:
14 | //ICON_FILE_PATH = bin/data/
15 |
16 | OTHER_LDFLAGS = $(OF_CORE_LIBS)
17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS)
18 |
--------------------------------------------------------------------------------
/example/addons.make:
--------------------------------------------------------------------------------
1 | ofxHeatMap
2 |
--------------------------------------------------------------------------------
/example/bin/data/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hideyukisaito/ofxHeatMap/50170a744a1b3a81a4f13acbe1c24ef5fe89c5db/example/bin/data/.gitkeep
--------------------------------------------------------------------------------
/example/config.make:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # CONFIGURE PROJECT MAKEFILE (optional)
3 | # This file is where we make project specific configurations.
4 | ################################################################################
5 |
6 | ################################################################################
7 | # OF ROOT
8 | # The location of your root openFrameworks installation
9 | # (default) OF_ROOT = ../../..
10 | ################################################################################
11 | # OF_ROOT = ../../..
12 |
13 | ################################################################################
14 | # PROJECT ROOT
15 | # The location of the project - a starting place for searching for files
16 | # (default) PROJECT_ROOT = . (this directory)
17 | #
18 | ################################################################################
19 | # PROJECT_ROOT = .
20 |
21 | ################################################################################
22 | # PROJECT SPECIFIC CHECKS
23 | # This is a project defined section to create internal makefile flags to
24 | # conditionally enable or disable the addition of various features within
25 | # this makefile. For instance, if you want to make changes based on whether
26 | # GTK is installed, one might test that here and create a variable to check.
27 | ################################################################################
28 | # None
29 |
30 | ################################################################################
31 | # PROJECT EXTERNAL SOURCE PATHS
32 | # These are fully qualified paths that are not within the PROJECT_ROOT folder.
33 | # Like source folders in the PROJECT_ROOT, these paths are subject to
34 | # exlclusion via the PROJECT_EXLCUSIONS list.
35 | #
36 | # (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank)
37 | #
38 | # Note: Leave a leading space when adding list items with the += operator
39 | ################################################################################
40 | # PROJECT_EXTERNAL_SOURCE_PATHS =
41 |
42 | ################################################################################
43 | # PROJECT EXCLUSIONS
44 | # These makefiles assume that all folders in your current project directory
45 | # and any listed in the PROJECT_EXTERNAL_SOURCH_PATHS are are valid locations
46 | # to look for source code. The any folders or files that match any of the
47 | # items in the PROJECT_EXCLUSIONS list below will be ignored.
48 | #
49 | # Each item in the PROJECT_EXCLUSIONS list will be treated as a complete
50 | # string unless teh user adds a wildcard (%) operator to match subdirectories.
51 | # GNU make only allows one wildcard for matching. The second wildcard (%) is
52 | # treated literally.
53 | #
54 | # (default) PROJECT_EXCLUSIONS = (blank)
55 | #
56 | # Will automatically exclude the following:
57 | #
58 | # $(PROJECT_ROOT)/bin%
59 | # $(PROJECT_ROOT)/obj%
60 | # $(PROJECT_ROOT)/%.xcodeproj
61 | #
62 | # Note: Leave a leading space when adding list items with the += operator
63 | ################################################################################
64 | # PROJECT_EXCLUSIONS =
65 |
66 | ################################################################################
67 | # PROJECT LINKER FLAGS
68 | # These flags will be sent to the linker when compiling the executable.
69 | #
70 | # (default) PROJECT_LDFLAGS = -Wl,-rpath=./libs
71 | #
72 | # Note: Leave a leading space when adding list items with the += operator
73 | ################################################################################
74 |
75 | # Currently, shared libraries that are needed are copied to the
76 | # $(PROJECT_ROOT)/bin/libs directory. The following LDFLAGS tell the linker to
77 | # add a runtime path to search for those shared libraries, since they aren't
78 | # incorporated directly into the final executable application binary.
79 | # TODO: should this be a default setting?
80 | # PROJECT_LDFLAGS=-Wl,-rpath=./libs
81 |
82 | ################################################################################
83 | # PROJECT DEFINES
84 | # Create a space-delimited list of DEFINES. The list will be converted into
85 | # CFLAGS with the "-D" flag later in the makefile.
86 | #
87 | # (default) PROJECT_DEFINES = (blank)
88 | #
89 | # Note: Leave a leading space when adding list items with the += operator
90 | ################################################################################
91 | # PROJECT_DEFINES =
92 |
93 | ################################################################################
94 | # PROJECT CFLAGS
95 | # This is a list of fully qualified CFLAGS required when compiling for this
96 | # project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS
97 | # defined in your platform specific core configuration files. These flags are
98 | # presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below.
99 | #
100 | # (default) PROJECT_CFLAGS = (blank)
101 | #
102 | # Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in
103 | # your platform specific configuration file will be applied by default and
104 | # further flags here may not be needed.
105 | #
106 | # Note: Leave a leading space when adding list items with the += operator
107 | ################################################################################
108 | # PROJECT_CFLAGS =
109 |
110 | ################################################################################
111 | # PROJECT OPTIMIZATION CFLAGS
112 | # These are lists of CFLAGS that are target-specific. While any flags could
113 | # be conditionally added, they are usually limited to optimization flags.
114 | # These flags are added BEFORE the PROJECT_CFLAGS.
115 | #
116 | # PROJECT_OPTIMIZATION_CFLAGS_RELEASE flags are only applied to RELEASE targets.
117 | #
118 | # (default) PROJECT_OPTIMIZATION_CFLAGS_RELEASE = (blank)
119 | #
120 | # PROJECT_OPTIMIZATION_CFLAGS_DEBUG flags are only applied to DEBUG targets.
121 | #
122 | # (default) PROJECT_OPTIMIZATION_CFLAGS_DEBUG = (blank)
123 | #
124 | # Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the
125 | # PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration
126 | # file will be applied by default and further optimization flags here may not
127 | # be needed.
128 | #
129 | # Note: Leave a leading space when adding list items with the += operator
130 | ################################################################################
131 | # PROJECT_OPTIMIZATION_CFLAGS_RELEASE =
132 | # PROJECT_OPTIMIZATION_CFLAGS_DEBUG =
133 |
134 | ################################################################################
135 | # PROJECT COMPILERS
136 | # Custom compilers can be set for CC and CXX
137 | # (default) PROJECT_CXX = (blank)
138 | # (default) PROJECT_CC = (blank)
139 | # Note: Leave a leading space when adding list items with the += operator
140 | ################################################################################
141 | # PROJECT_CXX =
142 | # PROJECT_CC =
143 |
--------------------------------------------------------------------------------
/example/example.xcodeproj/xcshareddata/xcschemes/example Debug.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/example/example.xcodeproj/xcshareddata/xcschemes/example Release.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/example/openFrameworks-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | cc.openFrameworks.ofapp
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | APPL
15 | CFBundleSignature
16 | ????
17 | CFBundleVersion
18 | 1.0
19 | CFBundleIconFile
20 | ${ICON}
21 |
22 |
23 |
--------------------------------------------------------------------------------
/example/src/main.cpp:
--------------------------------------------------------------------------------
1 | #include "ofMain.h"
2 | #include "ofApp.h"
3 |
4 | //========================================================================
5 | int main( )
6 | {
7 | ofSetupOpenGL(1024, 768, OF_WINDOW); // <-------- setup the GL context
8 |
9 | // this kicks off the running of my app
10 | // can be OF_WINDOW or OF_FULLSCREEN
11 | // pass in width and height too:
12 | ofRunApp(new ofApp());
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/example/src/ofApp.cpp:
--------------------------------------------------------------------------------
1 | #include "ofApp.h"
2 |
3 | //--------------------------------------------------------------
4 | void ofApp::setup()
5 | {
6 | int w = ofGetWidth();
7 | int h = ofGetHeight();
8 |
9 | heatmap.setup(w, h, 32);
10 |
11 | for (unsigned int i = 0, len_ = 1000; i < len_; ++i) {
12 | unsigned x_ = (unsigned)((w / 2) + cos(ofRandom(TWO_PI)) * ofRandom(w / 2));
13 | unsigned y_ = (unsigned)((h / 2) + sin(ofRandom(TWO_PI)) * ofRandom(h / 2));
14 | heatmap.addPoint(x_, y_);
15 | }
16 |
17 | heatmap.update(OFX_HEATMAP_CS_SPECTRAL_SOFT);
18 | }
19 |
20 | //--------------------------------------------------------------
21 | void ofApp::update()
22 | {
23 |
24 | }
25 |
26 | //--------------------------------------------------------------
27 | void ofApp::draw()
28 | {
29 | ofBackground(0, 0, 0);
30 |
31 | ofSetColor(255, 255);
32 | heatmap.draw(0, 0);
33 | }
34 |
35 | //--------------------------------------------------------------
36 | void ofApp::keyPressed(int key)
37 | {
38 |
39 | }
40 |
41 | //--------------------------------------------------------------
42 | void ofApp::keyReleased(int key)
43 | {
44 |
45 | }
46 |
47 | //--------------------------------------------------------------
48 | void ofApp::mouseMoved(int x, int y )
49 | {
50 |
51 | }
52 |
53 | //--------------------------------------------------------------
54 | void ofApp::mouseDragged(int x, int y, int button)
55 | {
56 |
57 | }
58 |
59 | //--------------------------------------------------------------
60 | void ofApp::mousePressed(int x, int y, int button)
61 | {
62 |
63 | }
64 |
65 | //--------------------------------------------------------------
66 | void ofApp::mouseReleased(int x, int y, int button)
67 | {
68 |
69 | }
70 |
71 | //--------------------------------------------------------------
72 | void ofApp::windowResized(int w, int h)
73 | {
74 |
75 | }
76 |
77 | //--------------------------------------------------------------
78 | void ofApp::gotMessage(ofMessage msg)
79 | {
80 |
81 | }
82 |
83 | //--------------------------------------------------------------
84 | void ofApp::dragEvent(ofDragInfo dragInfo)
85 | {
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/example/src/ofApp.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "ofMain.h"
4 | #include "ofxHeatMap.h"
5 |
6 | class ofApp : public ofBaseApp
7 | {
8 |
9 | public:
10 | void setup();
11 | void update();
12 | void draw();
13 |
14 | void keyPressed(int key);
15 | void keyReleased(int key);
16 | void mouseMoved(int x, int y );
17 | void mouseDragged(int x, int y, int button);
18 | void mousePressed(int x, int y, int button);
19 | void mouseReleased(int x, int y, int button);
20 | void windowResized(int w, int h);
21 | void dragEvent(ofDragInfo dragInfo);
22 | void gotMessage(ofMessage msg);
23 |
24 | ofxHeatMap heatmap;
25 | };
26 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/Blues.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_BLUES_H
26 | #define _HEATMAP_COLORSCHEMES_BLUES_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_Blues_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_Blues_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_Blues_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_Blues_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_BLUES_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/BrBG.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_BRBG_H
26 | #define _HEATMAP_COLORSCHEMES_BRBG_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_BrBG_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_BrBG_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_BrBG_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_BrBG_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_BRBG_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/BuGn.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_BUGN_H
26 | #define _HEATMAP_COLORSCHEMES_BUGN_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_BuGn_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_BuGn_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_BuGn_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_BuGn_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_BUGN_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/BuPu.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_BUPU_H
26 | #define _HEATMAP_COLORSCHEMES_BUPU_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_BuPu_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_BuPu_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_BuPu_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_BuPu_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_BUPU_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/GnBu.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_GNBU_H
26 | #define _HEATMAP_COLORSCHEMES_GNBU_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_GnBu_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_GnBu_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_GnBu_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_GnBu_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_GNBU_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/Greens.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_GREENS_H
26 | #define _HEATMAP_COLORSCHEMES_GREENS_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_Greens_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_Greens_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_Greens_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_Greens_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_GREENS_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/Greys.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_GREYS_H
26 | #define _HEATMAP_COLORSCHEMES_GREYS_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_Greys_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_Greys_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_Greys_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_Greys_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_GREYS_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/OrRd.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_ORRD_H
26 | #define _HEATMAP_COLORSCHEMES_ORRD_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_OrRd_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_OrRd_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_OrRd_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_OrRd_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_ORRD_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/Oranges.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_ORANGES_H
26 | #define _HEATMAP_COLORSCHEMES_ORANGES_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_Oranges_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_Oranges_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_Oranges_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_Oranges_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_ORANGES_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/PRGn.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_PRGN_H
26 | #define _HEATMAP_COLORSCHEMES_PRGN_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_PRGn_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_PRGn_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_PRGn_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_PRGn_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_PRGN_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/PiYG.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_PIYG_H
26 | #define _HEATMAP_COLORSCHEMES_PIYG_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_PiYG_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_PiYG_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_PiYG_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_PiYG_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_PIYG_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/PuBu.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_PUBU_H
26 | #define _HEATMAP_COLORSCHEMES_PUBU_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_PuBu_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_PuBu_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_PuBu_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_PuBu_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_PUBU_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/PuBuGn.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_PUBUGN_H
26 | #define _HEATMAP_COLORSCHEMES_PUBUGN_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_PuBuGn_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_PuBuGn_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_PuBuGn_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_PuBuGn_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_PUBUGN_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/PuOr.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_PUOR_H
26 | #define _HEATMAP_COLORSCHEMES_PUOR_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_PuOr_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_PuOr_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_PuOr_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_PuOr_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_PUOR_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/PuRd.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_PURD_H
26 | #define _HEATMAP_COLORSCHEMES_PURD_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_PuRd_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_PuRd_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_PuRd_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_PuRd_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_PURD_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/Purples.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_PURPLES_H
26 | #define _HEATMAP_COLORSCHEMES_PURPLES_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_Purples_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_Purples_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_Purples_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_Purples_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_PURPLES_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/RdBu.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_RDBU_H
26 | #define _HEATMAP_COLORSCHEMES_RDBU_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_RdBu_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_RdBu_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_RdBu_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_RdBu_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_RDBU_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/RdGy.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_RDGY_H
26 | #define _HEATMAP_COLORSCHEMES_RDGY_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_RdGy_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_RdGy_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_RdGy_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_RdGy_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_RDGY_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/RdPu.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_RDPU_H
26 | #define _HEATMAP_COLORSCHEMES_RDPU_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_RdPu_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_RdPu_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_RdPu_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_RdPu_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_RDPU_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/RdYlBu.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_RDYLBU_H
26 | #define _HEATMAP_COLORSCHEMES_RDYLBU_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_RdYlBu_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_RdYlBu_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_RdYlBu_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_RdYlBu_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_RDYLBU_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/RdYlGn.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_RDYLGN_H
26 | #define _HEATMAP_COLORSCHEMES_RDYLGN_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_RdYlGn_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_RdYlGn_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_RdYlGn_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_RdYlGn_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_RDYLGN_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/Reds.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_REDS_H
26 | #define _HEATMAP_COLORSCHEMES_REDS_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_Reds_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_Reds_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_Reds_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_Reds_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_REDS_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/Spectral.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_SPECTRAL_H
26 | #define _HEATMAP_COLORSCHEMES_SPECTRAL_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_Spectral_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_Spectral_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_Spectral_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_Spectral_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_SPECTRAL_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/YlGn.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_YLGN_H
26 | #define _HEATMAP_COLORSCHEMES_YLGN_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_YlGn_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_YlGn_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_YlGn_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_YlGn_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_YLGN_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/YlGnBu.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_YLGNBU_H
26 | #define _HEATMAP_COLORSCHEMES_YLGNBU_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_YlGnBu_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_YlGnBu_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_YlGnBu_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_YlGnBu_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_YLGNBU_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/YlOrBr.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_YLORBR_H
26 | #define _HEATMAP_COLORSCHEMES_YLORBR_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_YlOrBr_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_YlOrBr_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_YlOrBr_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_YlOrBr_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_YLORBR_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/YlOrRd.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_YLORRD_H
26 | #define _HEATMAP_COLORSCHEMES_YLORRD_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* This one has only N discrete colors. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_YlOrRd_discrete;
34 | /* This is a very soft gradient along abovementioned discrete colors. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_YlOrRd_soft;
36 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_YlOrRd_mixed;
38 | /* An exponential version of the default mix of the above two. */
39 | /* Use this if your maximum is very "spiked". */
40 | extern const heatmap_colorscheme_t* heatmap_cs_YlOrRd_mixed_exp;
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif /* _HEATMAP_COLORSCHEMES_YLORRD_H */
47 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/colorbrewer.go:
--------------------------------------------------------------------------------
1 | // heatmap - High performance heatmap creation in C.
2 | //
3 | // The MIT License (MIT)
4 | //
5 | // Copyright (c) 2013 Lucas Beyer
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | // this software and associated documentation files (the "Software"), to deal in
9 | // the Software without restriction, including without limitation the rights to
10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | // the Software, and to permit persons to whom the Software is furnished to do so,
12 | // subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | //
24 |
25 | package main
26 |
27 | import "flag"
28 |
29 | func main() {
30 | pw := flag.Uint64("w", 40, "Width of the pictures of the colorscheme.")
31 | ph := flag.Uint64("h", 1024, "Height (number of levels) of the colorscheme.")
32 | flag.Parse()
33 |
34 | // No, I tested it, only using 3 or 4 of the keypoints isn't enough!
35 | colorschemes := map[string]GradientTable{
36 | // Sequential
37 |
38 | // Multihue
39 | "BuGn": GradientTable{
40 | {MustParseHex("#00441B"), 0.000},
41 | {MustParseHex("#006D2C"), 0.125},
42 | {MustParseHex("#238B45"), 0.250},
43 | {MustParseHex("#41AE76"), 0.375},
44 | {MustParseHex("#66C2A4"), 0.500},
45 | {MustParseHex("#99D8C9"), 0.625},
46 | {MustParseHex("#CCECE6"), 0.750},
47 | {MustParseHex("#E5F5F9"), 0.875},
48 | {MustParseHex("#F7FCFD"), 1.000},
49 | },
50 | "BuPu": GradientTable{
51 | {MustParseHex("#4D004B"), 0.000},
52 | {MustParseHex("#810F7C"), 0.125},
53 | {MustParseHex("#88419D"), 0.250},
54 | {MustParseHex("#8C6BB1"), 0.375},
55 | {MustParseHex("#8C96C6"), 0.500},
56 | {MustParseHex("#9EBCDA"), 0.625},
57 | {MustParseHex("#BFD3E6"), 0.750},
58 | {MustParseHex("#E0ECF4"), 0.875},
59 | {MustParseHex("#F7FCFD"), 1.000},
60 | },
61 | "GnBu": GradientTable{
62 | {MustParseHex("#084081"), 0.000},
63 | {MustParseHex("#0868AC"), 0.125},
64 | {MustParseHex("#2B8CBE"), 0.250},
65 | {MustParseHex("#4EB3D3"), 0.375},
66 | {MustParseHex("#7BCCC4"), 0.500},
67 | {MustParseHex("#A8DDB5"), 0.625},
68 | {MustParseHex("#CCEBC5"), 0.750},
69 | {MustParseHex("#E0F3DB"), 0.875},
70 | {MustParseHex("#F7FCF0"), 1.000},
71 | },
72 | "OrRd": GradientTable{
73 | {MustParseHex("#7F0000"), 0.000},
74 | {MustParseHex("#B30000"), 0.125},
75 | {MustParseHex("#D7301F"), 0.250},
76 | {MustParseHex("#EF6548"), 0.375},
77 | {MustParseHex("#FC8D59"), 0.500},
78 | {MustParseHex("#FDBB84"), 0.625},
79 | {MustParseHex("#FDD49E"), 0.750},
80 | {MustParseHex("#FEE8C8"), 0.875},
81 | {MustParseHex("#FFF7EC"), 1.000},
82 | },
83 | "PuBu": GradientTable{
84 | {MustParseHex("#023858"), 0.000},
85 | {MustParseHex("#045A8D"), 0.125},
86 | {MustParseHex("#0570B0"), 0.250},
87 | {MustParseHex("#3690C0"), 0.375},
88 | {MustParseHex("#74A9CF"), 0.500},
89 | {MustParseHex("#A6BDDB"), 0.625},
90 | {MustParseHex("#D0D1E6"), 0.750},
91 | {MustParseHex("#ECE7F2"), 0.875},
92 | {MustParseHex("#FFF7FB"), 1.000},
93 | },
94 | "PuBuGn": GradientTable{
95 | {MustParseHex("#014636"), 0.000},
96 | {MustParseHex("#016C59"), 0.125},
97 | {MustParseHex("#02818A"), 0.250},
98 | {MustParseHex("#3690C0"), 0.375},
99 | {MustParseHex("#67A9CF"), 0.500},
100 | {MustParseHex("#A6BDDB"), 0.625},
101 | {MustParseHex("#D0D1E6"), 0.750},
102 | {MustParseHex("#ECE2F0"), 0.875},
103 | {MustParseHex("#FFF7FB"), 1.000},
104 | },
105 | "PuRd": GradientTable{
106 | {MustParseHex("#67001F"), 0.000},
107 | {MustParseHex("#980043"), 0.125},
108 | {MustParseHex("#CE1256"), 0.250},
109 | {MustParseHex("#E7298A"), 0.375},
110 | {MustParseHex("#DF65B0"), 0.500},
111 | {MustParseHex("#C994C7"), 0.625},
112 | {MustParseHex("#D4B9DA"), 0.750},
113 | {MustParseHex("#E7E1EF"), 0.875},
114 | {MustParseHex("#F7F4F9"), 1.000},
115 | },
116 | "RdPu": GradientTable{
117 | {MustParseHex("#49006A"), 0.000},
118 | {MustParseHex("#7A0177"), 0.125},
119 | {MustParseHex("#AE017E"), 0.250},
120 | {MustParseHex("#DD3497"), 0.375},
121 | {MustParseHex("#F768A1"), 0.500},
122 | {MustParseHex("#FA9FB5"), 0.625},
123 | {MustParseHex("#FCC5C0"), 0.750},
124 | {MustParseHex("#FDE0DD"), 0.875},
125 | {MustParseHex("#FFF7F3"), 1.000},
126 | },
127 | "YlGn": GradientTable{
128 | {MustParseHex("#004529"), 0.000},
129 | {MustParseHex("#006837"), 0.125},
130 | {MustParseHex("#238443"), 0.250},
131 | {MustParseHex("#41AB5D"), 0.375},
132 | {MustParseHex("#78C679"), 0.500},
133 | {MustParseHex("#ADDD8E"), 0.625},
134 | {MustParseHex("#D9F0A3"), 0.750},
135 | {MustParseHex("#F7FCB9"), 0.875},
136 | {MustParseHex("#FFFFE5"), 1.000},
137 | },
138 | "YlGnBu": GradientTable{
139 | {MustParseHex("#081D58"), 0.000},
140 | {MustParseHex("#253494"), 0.125},
141 | {MustParseHex("#225EA8"), 0.250},
142 | {MustParseHex("#1D91C0"), 0.375},
143 | {MustParseHex("#41B6C4"), 0.500},
144 | {MustParseHex("#7FCDBB"), 0.625},
145 | {MustParseHex("#C7E9B4"), 0.750},
146 | {MustParseHex("#EDF8B1"), 0.875},
147 | {MustParseHex("#FFFFD9"), 1.000},
148 | },
149 | "YlOrBr": GradientTable{
150 | {MustParseHex("#662506"), 0.000},
151 | {MustParseHex("#993404"), 0.125},
152 | {MustParseHex("#CC4C02"), 0.250},
153 | {MustParseHex("#EC7014"), 0.375},
154 | {MustParseHex("#FE9929"), 0.500},
155 | {MustParseHex("#FEC44F"), 0.625},
156 | {MustParseHex("#FEE391"), 0.750},
157 | {MustParseHex("#FFF7BC"), 0.875},
158 | {MustParseHex("#FFFFE5"), 1.000},
159 | },
160 | "YlOrRd": GradientTable{
161 | {MustParseHex("#800026"), 0.000},
162 | {MustParseHex("#BD0026"), 0.125},
163 | {MustParseHex("#E31A1C"), 0.250},
164 | {MustParseHex("#FC4E2A"), 0.375},
165 | {MustParseHex("#FD8D3C"), 0.500},
166 | {MustParseHex("#FEB24C"), 0.625},
167 | {MustParseHex("#FED976"), 0.750},
168 | {MustParseHex("#FFEDA0"), 0.875},
169 | {MustParseHex("#FFFFCC"), 1.000},
170 | },
171 | // Single Hue
172 | "Blues": GradientTable{
173 | {MustParseHex("#08306B"), 0.000},
174 | {MustParseHex("#08519C"), 0.125},
175 | {MustParseHex("#2171B5"), 0.250},
176 | {MustParseHex("#4292C6"), 0.375},
177 | {MustParseHex("#6BAED6"), 0.500},
178 | {MustParseHex("#9ECAE1"), 0.625},
179 | {MustParseHex("#C6DBEF"), 0.750},
180 | {MustParseHex("#DEEBF7"), 0.875},
181 | {MustParseHex("#F7FBFF"), 1.000},
182 | },
183 | "Greens": GradientTable{
184 | {MustParseHex("#00441B"), 0.000},
185 | {MustParseHex("#006D2C"), 0.125},
186 | {MustParseHex("#238B45"), 0.250},
187 | {MustParseHex("#41AB5D"), 0.375},
188 | {MustParseHex("#74C476"), 0.500},
189 | {MustParseHex("#A1D99B"), 0.625},
190 | {MustParseHex("#C7E9C0"), 0.750},
191 | {MustParseHex("#E5F5E0"), 0.875},
192 | {MustParseHex("#F7FCF5"), 1.000},
193 | },
194 | "Greys": GradientTable{
195 | {MustParseHex("#000000"), 0.000},
196 | {MustParseHex("#252525"), 0.125},
197 | {MustParseHex("#525252"), 0.250},
198 | {MustParseHex("#737373"), 0.375},
199 | {MustParseHex("#969696"), 0.500},
200 | {MustParseHex("#BDBDBD"), 0.625},
201 | {MustParseHex("#D9D9D9"), 0.750},
202 | {MustParseHex("#F0F0F0"), 0.875},
203 | {MustParseHex("#FFFFFF"), 1.000},
204 | },
205 | "Oranges": GradientTable{
206 | {MustParseHex("#7F2704"), 0.000},
207 | {MustParseHex("#A63603"), 0.125},
208 | {MustParseHex("#D94801"), 0.250},
209 | {MustParseHex("#F16913"), 0.375},
210 | {MustParseHex("#FD8D3C"), 0.500},
211 | {MustParseHex("#FDAE6B"), 0.625},
212 | {MustParseHex("#FDD0A2"), 0.750},
213 | {MustParseHex("#FEE6CE"), 0.875},
214 | {MustParseHex("#FFF5EB"), 1.000},
215 | },
216 | "Purples": GradientTable{
217 | {MustParseHex("#3F007D"), 0.000},
218 | {MustParseHex("#54278F"), 0.125},
219 | {MustParseHex("#6A51A3"), 0.250},
220 | {MustParseHex("#807DBA"), 0.375},
221 | {MustParseHex("#9E9AC8"), 0.500},
222 | {MustParseHex("#BCBDDC"), 0.625},
223 | {MustParseHex("#DADAEB"), 0.750},
224 | {MustParseHex("#EFEDF5"), 0.875},
225 | {MustParseHex("#FCFBFD"), 1.000},
226 | },
227 | "Reds": GradientTable{
228 | {MustParseHex("#67000D"), 0.000},
229 | {MustParseHex("#A50F15"), 0.125},
230 | {MustParseHex("#CB181D"), 0.250},
231 | {MustParseHex("#EF3B2C"), 0.375},
232 | {MustParseHex("#FB6A4A"), 0.500},
233 | {MustParseHex("#FC9272"), 0.625},
234 | {MustParseHex("#FCBBA1"), 0.750},
235 | {MustParseHex("#FEE0D2"), 0.875},
236 | {MustParseHex("#FFF5F0"), 1.000},
237 | },
238 |
239 | // Diverging
240 | "BrBG": GradientTable{
241 | {MustParseHex("#003C30"), 0.0},
242 | {MustParseHex("#01665E"), 0.1},
243 | {MustParseHex("#35978F"), 0.2},
244 | {MustParseHex("#80CDC1"), 0.3},
245 | {MustParseHex("#C7EAE5"), 0.4},
246 | {MustParseHex("#F5F5F5"), 0.5},
247 | {MustParseHex("#F6E8C3"), 0.6},
248 | {MustParseHex("#DFC27D"), 0.7},
249 | // The following contains a typo in green in colorbrewer2!
250 | {MustParseHex("#BFC22D"), 0.8},
251 | {MustParseHex("#8C510A"), 0.9},
252 | {MustParseHex("#543005"), 1.0},
253 | },
254 | "PiYG": GradientTable{
255 | {MustParseHex("#276419"), 0.0},
256 | {MustParseHex("#4D9221"), 0.1},
257 | {MustParseHex("#7FBC41"), 0.2},
258 | {MustParseHex("#B8E186"), 0.3},
259 | {MustParseHex("#E6F5D0"), 0.4},
260 | {MustParseHex("#F7F7F7"), 0.5},
261 | {MustParseHex("#FDE0EF"), 0.6},
262 | {MustParseHex("#F1B6DA"), 0.7},
263 | {MustParseHex("#DE77AE"), 0.8},
264 | {MustParseHex("#C51B7D"), 0.9},
265 | {MustParseHex("#8E0152"), 1.0},
266 | },
267 | "PRGn": GradientTable{
268 | {MustParseHex("#00441B"), 0.0},
269 | {MustParseHex("#1B7837"), 0.1},
270 | {MustParseHex("#5AAE61"), 0.2},
271 | {MustParseHex("#A6DBA0"), 0.3},
272 | {MustParseHex("#D9F0D3"), 0.4},
273 | {MustParseHex("#F7F7F7"), 0.5},
274 | {MustParseHex("#E7D4E8"), 0.6},
275 | {MustParseHex("#C2A5CF"), 0.7},
276 | {MustParseHex("#9970AB"), 0.8},
277 | {MustParseHex("#762A83"), 0.9},
278 | {MustParseHex("#40004B"), 1.0},
279 | },
280 | "PuOr": GradientTable{
281 | {MustParseHex("#2D004B"), 0.0},
282 | {MustParseHex("#542788"), 0.1},
283 | {MustParseHex("#8073AC"), 0.2},
284 | {MustParseHex("#B2ABD2"), 0.3},
285 | {MustParseHex("#D8DAEB"), 0.4},
286 | {MustParseHex("#F7F7F7"), 0.5},
287 | {MustParseHex("#FEE0B6"), 0.6},
288 | {MustParseHex("#FDB863"), 0.7},
289 | {MustParseHex("#E08214"), 0.8},
290 | {MustParseHex("#B35806"), 0.9},
291 | {MustParseHex("#7F3B08"), 1.0},
292 | },
293 | "RdBu": GradientTable{
294 | {MustParseHex("#053061"), 0.0},
295 | {MustParseHex("#2166AC"), 0.1},
296 | {MustParseHex("#4393C3"), 0.2},
297 | {MustParseHex("#92C5DE"), 0.3},
298 | {MustParseHex("#D1E5F0"), 0.4},
299 | {MustParseHex("#F7F7F7"), 0.5},
300 | {MustParseHex("#FDDBC7"), 0.6},
301 | {MustParseHex("#F4A582"), 0.7},
302 | {MustParseHex("#D6604D"), 0.8},
303 | {MustParseHex("#B2182B"), 0.9},
304 | {MustParseHex("#67001F"), 1.0},
305 | },
306 | "RdGy": GradientTable{
307 | {MustParseHex("#1A1A1A"), 0.0},
308 | {MustParseHex("#4D4D4D"), 0.1},
309 | {MustParseHex("#878787"), 0.2},
310 | {MustParseHex("#BABABA"), 0.3},
311 | {MustParseHex("#E0E0E0"), 0.4},
312 | {MustParseHex("#FFFFFF"), 0.5},
313 | {MustParseHex("#FDDBC7"), 0.6},
314 | {MustParseHex("#F4A582"), 0.7},
315 | {MustParseHex("#D6604D"), 0.8},
316 | {MustParseHex("#B2182B"), 0.9},
317 | {MustParseHex("#67001F"), 1.0},
318 | },
319 | "RdYlBu": GradientTable{
320 | {MustParseHex("#313695"), 0.0},
321 | {MustParseHex("#4575B4"), 0.1},
322 | {MustParseHex("#74ADD1"), 0.2},
323 | {MustParseHex("#ABD9E9"), 0.3},
324 | {MustParseHex("#E0F3F8"), 0.4},
325 | {MustParseHex("#FFFFBF"), 0.5},
326 | {MustParseHex("#FEE090"), 0.6},
327 | {MustParseHex("#FDAE61"), 0.7},
328 | {MustParseHex("#F46D43"), 0.8},
329 | {MustParseHex("#D73027"), 0.9},
330 | {MustParseHex("#A50026"), 1.0},
331 | },
332 | "RdYlGn": GradientTable{
333 | {MustParseHex("#006837"), 0.0},
334 | {MustParseHex("#1A9850"), 0.1},
335 | {MustParseHex("#66BD63"), 0.2},
336 | {MustParseHex("#A6D96A"), 0.3},
337 | {MustParseHex("#D9EF8B"), 0.4},
338 | // {MustParseHex("#FFFFBF"), 0.5},
339 | {MustParseHex("#FEE08B"), 0.6},
340 | {MustParseHex("#FDAE61"), 0.7},
341 | {MustParseHex("#F46D43"), 0.8},
342 | {MustParseHex("#D73027"), 0.9},
343 | {MustParseHex("#A50026"), 1.0},
344 | },
345 | "Spectral": GradientTable{
346 | {MustParseHex("#5e4fa2"), 0.0},
347 | {MustParseHex("#3288bd"), 0.1},
348 | {MustParseHex("#66c2a5"), 0.2},
349 | {MustParseHex("#abdda4"), 0.3},
350 | {MustParseHex("#e6f598"), 0.4},
351 | // {MustParseHex("#ffffbf"), 0.5},
352 | {MustParseHex("#f1f3a7"), 0.5},
353 | {MustParseHex("#fee090"), 0.6},
354 | {MustParseHex("#fdae61"), 0.7},
355 | {MustParseHex("#f46d43"), 0.8},
356 | {MustParseHex("#d53e4f"), 0.9},
357 | {MustParseHex("#9e0142"), 1.0},
358 | },
359 | }
360 |
361 | for name, keypoints := range colorschemes {
362 | CreateColorschemes(keypoints, name, int(*pw), int(*ph))
363 | }
364 | }
365 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/colorscheme.go:
--------------------------------------------------------------------------------
1 | // heatmap - High performance heatmap creation in C.
2 | //
3 | // The MIT License (MIT)
4 | //
5 | // Copyright (c) 2013 Lucas Beyer
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | // this software and associated documentation files (the "Software"), to deal in
9 | // the Software without restriction, including without limitation the rights to
10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | // the Software, and to permit persons to whom the Software is furnished to do so,
12 | // subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | //
24 |
25 | package main
26 |
27 | import "fmt"
28 | import "github.com/lucasb-eyer/go-colorful"
29 | import "image"
30 | import "image/draw"
31 | import "image/png"
32 | import "log"
33 | import "math"
34 | import "os"
35 | import "text/template"
36 | import "strings"
37 |
38 | const LICENSE string =
39 | `/* heatmap - High performance heatmap creation in C.
40 | *
41 | * The MIT License (MIT)
42 | *
43 | * Copyright (c) 2013 Lucas Beyer
44 | *
45 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
46 | * this software and associated documentation files (the "Software"), to deal in
47 | * the Software without restriction, including without limitation the rights to
48 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
49 | * the Software, and to permit persons to whom the Software is furnished to do so,
50 | * subject to the following conditions:
51 | *
52 | * The above copyright notice and this permission notice shall be included in all
53 | * copies or substantial portions of the Software.
54 | *
55 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
56 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
57 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
58 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
59 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
60 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
61 | */
62 |
63 | `
64 |
65 | const HEADER_TEMPLATE string = LICENSE +
66 | `#ifndef _HEATMAP_COLORSCHEMES_{{ToUpper .}}_H
67 | #define _HEATMAP_COLORSCHEMES_{{ToUpper .}}_H
68 |
69 | #ifdef __cplusplus
70 | extern "C" {
71 | #endif
72 |
73 | /* This one has only N discrete colors. */
74 | extern const heatmap_colorscheme_t* heatmap_cs_{{.}}_discrete;
75 | /* This is a very soft gradient along abovementioned discrete colors. */
76 | extern const heatmap_colorscheme_t* heatmap_cs_{{.}}_soft;
77 | /* This is a mix of the above two. Makes for a pretty result in many cases. */
78 | extern const heatmap_colorscheme_t* heatmap_cs_{{.}}_mixed;
79 | /* An exponential version of the default mix of the above two. */
80 | /* Use this if your maximum is very "spiked". */
81 | extern const heatmap_colorscheme_t* heatmap_cs_{{.}}_mixed_exp;
82 |
83 | #ifdef __cplusplus
84 | }
85 | #endif
86 |
87 | #endif /* _HEATMAP_COLORSCHEMES_{{ToUpper .}}_H */
88 | `
89 |
90 | const SOURCE_TEMPLATE string = LICENSE +
91 | `#ifdef __cplusplus
92 | extern "C" {
93 | #endif
94 |
95 | #include "heatmap.h"
96 | #include "colorschemes/{{.Name}}.h"
97 |
98 | static const unsigned char discrete_data[] = {
99 | 0, 0, 0, 0{{.Discrete}}
100 | };
101 | static const heatmap_colorscheme_t discrete = { discrete_data, sizeof(discrete_data)/sizeof(discrete_data[0]/4) };
102 | const heatmap_colorscheme_t* heatmap_cs_{{.Name}}_discrete = &discrete;
103 |
104 | static const unsigned char soft_data[] = {
105 | 0, 0, 0, 0{{.Soft}}
106 | };
107 | static const heatmap_colorscheme_t soft = { soft_data, sizeof(soft_data)/sizeof(soft_data[0]/4) };
108 | const heatmap_colorscheme_t* heatmap_cs_{{.Name}}_soft = &soft;
109 |
110 | static const unsigned char mixed_data[] = {
111 | 0, 0, 0, 0{{.Mixed}}
112 | };
113 | static const heatmap_colorscheme_t mixed = { mixed_data, sizeof(mixed_data)/sizeof(mixed_data[0]/4) };
114 | const heatmap_colorscheme_t* heatmap_cs_{{.Name}}_mixed = &mixed;
115 |
116 | static const unsigned char mixed_exp_data[] = {
117 | 0, 0, 0, 0{{.MixedExp}}
118 | };
119 | static const heatmap_colorscheme_t mixed_exp = { mixed_exp_data, sizeof(mixed_exp_data)/sizeof(mixed_exp_data[0]/4) };
120 | const heatmap_colorscheme_t* heatmap_cs_{{.Name}}_mixed_exp = &mixed_exp;
121 |
122 | #ifdef __cplusplus
123 | }
124 | #endif
125 | `
126 |
127 | // This table contains the "keypoints" of the colorgradient you want to generate.
128 | // The position of each keypoint has to live in the range [0,1]
129 | type GradientTableEntry struct{
130 | Col colorful.Color
131 | Pos float64
132 | }
133 | type GradientTable []GradientTableEntry
134 |
135 | // This is the meat of the gradient computation. It returns a HCL-blend between
136 | // the two colors around `t`.
137 | // Note: It relies heavily on the fact that the gradient keypoints are sorted.
138 | func (self GradientTable) GetInterpolatedColorFor(t float64) colorful.Color {
139 | for i := 0 ; i < len(self) - 1 ; i++ {
140 | c1 := self[i]
141 | c2 := self[i+1]
142 | if c1.Pos <= t && t <= c2.Pos {
143 | // We are in between c1 and c2. Go blend them!
144 | t := (t - c1.Pos)/(c2.Pos - c1.Pos)
145 | return c1.Col.BlendHcl(c2.Col, t).Clamped()
146 | }
147 | }
148 |
149 | // Nothing found? Means we're at (or past) the last gradient keypoint.
150 | return self[len(self)-1].Col
151 | }
152 |
153 | // This returns the color of the closest gradient keypoint.
154 | // Note: This too relies on the fact that the gradient keypoints are sorted.
155 | func (self GradientTable) GetColorFor(t float64) colorful.Color {
156 | for i := 0 ; i < len(self) - 1 ; i++ {
157 | if t < (self[i].Pos + self[i+1].Pos)*0.5 {
158 | return self[i].Col
159 | }
160 | }
161 |
162 | return self[len(self)-1].Col
163 | }
164 |
165 | // This is a very nice thing Golang forces you to do!
166 | // It is necessary so that we can write out the literal of the colortable below.
167 | func MustParseHex(s string) colorful.Color {
168 | c, err := colorful.Hex(s)
169 | if err != nil {
170 | log.Fatalf("Invalid color: %v: %v\n", s, err.Error())
171 | }
172 | return c
173 | }
174 |
175 | func savepng(img image.Image, fname string) {
176 | toimg, err := os.Create(fname)
177 | if err != nil {
178 | log.Printf("Error saving png: %v\n", err)
179 | return
180 | }
181 | defer toimg.Close()
182 |
183 | png.Encode(toimg, img)
184 | }
185 |
186 | func CreateColorschemes(keypoints GradientTable, name string, w, h int) {
187 | c_file, err := os.Create(name + ".c")
188 | if err != nil { log.Fatal(err) }
189 | defer func() {
190 | if err := c_file.Close(); err != nil {
191 | log.Fatal(err)
192 | }
193 | }()
194 |
195 | h_file, err := os.Create(name + ".h")
196 | if err != nil { log.Fatal(err) }
197 | defer func() {
198 | if err := h_file.Close(); err != nil {
199 | log.Fatal(err)
200 | }
201 | }()
202 |
203 | // Might as well already create the header, we know all we need by now.
204 | tmpl, err := template.New("test").Funcs(template.FuncMap{"ToUpper": strings.ToUpper}).Parse(HEADER_TEMPLATE)
205 | if err != nil { log.Panic(err) }
206 | if err = tmpl.Execute(h_file, name); err != nil { log.Panic(err) }
207 |
208 | img_discrete := image.NewRGBA(image.Rect(0,0,w,len(keypoints)))
209 | img_soft := image.NewRGBA(image.Rect(0,0,w,h))
210 | img_mixed := image.NewRGBA(image.Rect(0,0,w,h))
211 | img_mixed_exp := image.NewRGBA(image.Rect(0,0,w,h))
212 | discrete, soft, mixed, mixed_exp := "", "", "", ""
213 |
214 | // discrete
215 | for y, kp := range keypoints {
216 | r, g, b := kp.Col.RGB255()
217 | discrete += fmt.Sprintf(", %v, %v, %v, 255", r, g, b)
218 | draw.Draw(img_discrete, image.Rect(0, y, w, y+1), &image.Uniform{kp.Col}, image.ZP, draw.Src)
219 | }
220 | savepng(img_discrete, name + "_discrete.png")
221 |
222 | // soft
223 | for y := 0 ; y < h ; y++ {
224 | t := float64(y)/float64(h)
225 | a := uint8(math.Min(t*30.0, 1.0)*255.0)
226 | c := keypoints.GetInterpolatedColorFor(t)
227 | r, g, b := c.RGB255()
228 | soft += fmt.Sprintf(", %v, %v, %v, %v", r, g, b, a)
229 | draw.Draw(img_soft, image.Rect(0, y, w, y+1), &image.Uniform{c}, image.ZP, draw.Src)
230 | }
231 | savepng(img_soft, name + "_soft.png")
232 |
233 | // mixed
234 | for y := 0 ; y < h ; y++ {
235 | t := float64(y)/float64(h)
236 | a := uint8(math.Min(t*30.0, 1.0)*255.0)
237 | // Here, we actually want to create a gradient overlaid with a stairs-like gradient.
238 | // Thus c1 is the soft gradient color and c2 the closest keypoint's color.
239 | c1 := keypoints.GetInterpolatedColorFor(t)
240 | c2 := keypoints.GetColorFor(t)
241 | c := c1.BlendRgb(c2, 0.2)
242 | r, g, b := c.RGB255()
243 | mixed += fmt.Sprintf(", %v, %v, %v, %v", r, g, b, a)
244 | draw.Draw(img_mixed, image.Rect(0, y, w, y+1), &image.Uniform{c}, image.ZP, draw.Src)
245 | }
246 | savepng(img_mixed, name + "_mixed.png")
247 |
248 | // exp
249 | for y := 0 ; y < h ; y++ {
250 | t := float64(y)/float64(h)
251 | a := uint8(math.Min(t*100.0, 1.0)*255.0) // TODO: Change a
252 | t = 1.0 - t;
253 | t = 1.0 - t*t * t*t * t*t * t*t * t*t
254 | c1 := keypoints.GetInterpolatedColorFor(t)
255 | c2 := keypoints.GetColorFor(t)
256 | c := c1.BlendRgb(c2, 0.2)
257 | r, g, b := c.RGB255()
258 | mixed_exp += fmt.Sprintf(", %v, %v, %v, %v", r, g, b, a)
259 | draw.Draw(img_mixed_exp, image.Rect(0, y, w, y+1), &image.Uniform{c}, image.ZP, draw.Src)
260 | }
261 | savepng(img_mixed_exp, name + "_mixed_exp.png")
262 |
263 | // Write the C file now that we got all data.
264 | tmpl, err = template.New("test").Parse(SOURCE_TEMPLATE)
265 | if err != nil { log.Panic(err) }
266 | if err = tmpl.Execute(c_file, struct { Name, Discrete, Soft, Mixed, MixedExp string }{ name, discrete, soft, mixed, mixed_exp }); err != nil { log.Panic(err) }
267 | }
268 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/gradientgen.go:
--------------------------------------------------------------------------------
1 | // heatmap - High performance heatmap creation in C.
2 | //
3 | // The MIT License (MIT)
4 | //
5 | // Copyright (c) 2013 Lucas Beyer
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | // this software and associated documentation files (the "Software"), to deal in
9 | // the Software without restriction, including without limitation the rights to
10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | // the Software, and to permit persons to whom the Software is furnished to do so,
12 | // subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | //
24 |
25 | package main
26 |
27 | import "flag"
28 | import "log"
29 | import "strconv"
30 |
31 | // same thing as MustParseHex but for float parsing
32 | func MustParseFloatZeroOne(s string) float64 {
33 | f, err := strconv.ParseFloat(s, 64)
34 | if err != nil {
35 | log.Fatalf("Invalid keypoint position: %v: %v\n", s, err.Error())
36 | }
37 | if f < 0.0 || 1.0 < f {
38 | log.Fatalf("Invalid keypoint position: %v: keypoints must lie within 0.0 and 1.0\n", s)
39 | }
40 | return f
41 | }
42 |
43 | func main() {
44 | pname := flag.String("name", "unnamed", "The name of the colorscheme.")
45 | pw := flag.Uint64("w", 40, "Width of the pictures of the colorscheme.")
46 | ph := flag.Uint64("h", 1024, "Height (number of levels) of the colorscheme.")
47 | flag.Parse()
48 |
49 | if flag.NArg() < 2*2 || flag.NArg() % 2 != 0 {
50 | flag.Usage()
51 | log.Fatal("Need at least two gradient keypoints!")
52 | }
53 |
54 | keypoints := GradientTable{}
55 | for i := 0 ; i < flag.NArg() ; i += 2 {
56 | keypoints = append(keypoints, GradientTableEntry{MustParseHex(flag.Arg(i)), MustParseFloatZeroOne(flag.Arg(i+1))})
57 | }
58 |
59 | CreateColorschemes(keypoints, *pname, int(*pw), int(*ph))
60 | }
61 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/gray.c:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #include "heatmap.h"
26 | #include "colorschemes/gray.h"
27 |
28 | static const unsigned char b2w_data[] = {
29 | 0, 0, 0, 0, 0, 0, 0, 255, 1, 1, 1, 255, 2, 2, 2, 255, 3, 3, 3, 255, 4, 4, 4, 255, 5, 5, 5, 255, 6, 6, 6, 255, 7, 7, 7, 255, 8, 8, 8, 255, 9, 9, 9, 255, 10, 10, 10, 255, 11, 11, 11, 255, 12, 12, 12, 255, 13, 13, 13, 255, 14, 14, 14, 255, 15, 15, 15, 255, 16, 16, 16, 255, 17, 17, 17, 255, 18, 18, 18, 255, 19, 19, 19, 255, 20, 20, 20, 255, 21, 21, 21, 255, 22, 22, 22, 255, 23, 23, 23, 255, 24, 24, 24, 255, 25, 25, 25, 255, 26, 26, 26, 255, 27, 27, 27, 255, 28, 28, 28, 255, 29, 29, 29, 255, 30, 30, 30, 255, 31, 31, 31, 255, 32, 32, 32, 255, 33, 33, 33, 255, 34, 34, 34, 255, 35, 35, 35, 255, 36, 36, 36, 255, 37, 37, 37, 255, 38, 38, 38, 255, 39, 39, 39, 255, 40, 40, 40, 255, 41, 41, 41, 255, 42, 42, 42, 255, 43, 43, 43, 255, 44, 44, 44, 255, 45, 45, 45, 255, 46, 46, 46, 255, 47, 47, 47, 255, 48, 48, 48, 255, 49, 49, 49, 255, 50, 50, 50, 255, 51, 51, 51, 255, 52, 52, 52, 255, 53, 53, 53, 255, 54, 54, 54, 255, 55, 55, 55, 255, 56, 56, 56, 255, 57, 57, 57, 255, 58, 58, 58, 255, 59, 59, 59, 255, 60, 60, 60, 255, 61, 61, 61, 255, 62, 62, 62, 255, 63, 63, 63, 255, 64, 64, 64, 255, 65, 65, 65, 255, 66, 66, 66, 255, 67, 67, 67, 255, 68, 68, 68, 255, 69, 69, 69, 255, 70, 70, 70, 255, 71, 71, 71, 255, 72, 72, 72, 255, 73, 73, 73, 255, 74, 74, 74, 255, 75, 75, 75, 255, 76, 76, 76, 255, 77, 77, 77, 255, 78, 78, 78, 255, 79, 79, 79, 255, 80, 80, 80, 255, 81, 81, 81, 255, 82, 82, 82, 255, 83, 83, 83, 255, 84, 84, 84, 255, 85, 85, 85, 255, 86, 86, 86, 255, 87, 87, 87, 255, 88, 88, 88, 255, 89, 89, 89, 255, 90, 90, 90, 255, 91, 91, 91, 255, 92, 92, 92, 255, 93, 93, 93, 255, 94, 94, 94, 255, 95, 95, 95, 255, 96, 96, 96, 255, 97, 97, 97, 255, 98, 98, 98, 255, 99, 99, 99, 255, 100, 100, 100, 255, 101, 101, 101, 255, 102, 102, 102, 255, 103, 103, 103, 255, 104, 104, 104, 255, 105, 105, 105, 255, 106, 106, 106, 255, 107, 107, 107, 255, 108, 108, 108, 255, 109, 109, 109, 255, 110, 110, 110, 255, 111, 111, 111, 255, 112, 112, 112, 255, 113, 113, 113, 255, 114, 114, 114, 255, 115, 115, 115, 255, 116, 116, 116, 255, 117, 117, 117, 255, 118, 118, 118, 255, 119, 119, 119, 255, 120, 120, 120, 255, 121, 121, 121, 255, 122, 122, 122, 255, 123, 123, 123, 255, 124, 124, 124, 255, 125, 125, 125, 255, 126, 126, 126, 255, 127, 127, 127, 255, 128, 128, 128, 255, 129, 129, 129, 255, 130, 130, 130, 255, 131, 131, 131, 255, 132, 132, 132, 255, 133, 133, 133, 255, 134, 134, 134, 255, 135, 135, 135, 255, 136, 136, 136, 255, 137, 137, 137, 255, 138, 138, 138, 255, 139, 139, 139, 255, 140, 140, 140, 255, 141, 141, 141, 255, 142, 142, 142, 255, 143, 143, 143, 255, 144, 144, 144, 255, 145, 145, 145, 255, 146, 146, 146, 255, 147, 147, 147, 255, 148, 148, 148, 255, 149, 149, 149, 255, 150, 150, 150, 255, 151, 151, 151, 255, 152, 152, 152, 255, 153, 153, 153, 255, 154, 154, 154, 255, 155, 155, 155, 255, 156, 156, 156, 255, 157, 157, 157, 255, 158, 158, 158, 255, 159, 159, 159, 255, 160, 160, 160, 255, 161, 161, 161, 255, 162, 162, 162, 255, 163, 163, 163, 255, 164, 164, 164, 255, 165, 165, 165, 255, 166, 166, 166, 255, 167, 167, 167, 255, 168, 168, 168, 255, 169, 169, 169, 255, 170, 170, 170, 255, 171, 171, 171, 255, 172, 172, 172, 255, 173, 173, 173, 255, 174, 174, 174, 255, 175, 175, 175, 255, 176, 176, 176, 255, 177, 177, 177, 255, 178, 178, 178, 255, 179, 179, 179, 255, 180, 180, 180, 255, 181, 181, 181, 255, 182, 182, 182, 255, 183, 183, 183, 255, 184, 184, 184, 255, 185, 185, 185, 255, 186, 186, 186, 255, 187, 187, 187, 255, 188, 188, 188, 255, 189, 189, 189, 255, 190, 190, 190, 255, 191, 191, 191, 255, 192, 192, 192, 255, 193, 193, 193, 255, 194, 194, 194, 255, 195, 195, 195, 255, 196, 196, 196, 255, 197, 197, 197, 255, 198, 198, 198, 255, 199, 199, 199, 255, 200, 200, 200, 255, 201, 201, 201, 255, 202, 202, 202, 255, 203, 203, 203, 255, 204, 204, 204, 255, 205, 205, 205, 255, 206, 206, 206, 255, 207, 207, 207, 255, 208, 208, 208, 255, 209, 209, 209, 255, 210, 210, 210, 255, 211, 211, 211, 255, 212, 212, 212, 255, 213, 213, 213, 255, 214, 214, 214, 255, 215, 215, 215, 255, 216, 216, 216, 255, 217, 217, 217, 255, 218, 218, 218, 255, 219, 219, 219, 255, 220, 220, 220, 255, 221, 221, 221, 255, 222, 222, 222, 255, 223, 223, 223, 255, 224, 224, 224, 255, 225, 225, 225, 255, 226, 226, 226, 255, 227, 227, 227, 255, 228, 228, 228, 255, 229, 229, 229, 255, 230, 230, 230, 255, 231, 231, 231, 255, 232, 232, 232, 255, 233, 233, 233, 255, 234, 234, 234, 255, 235, 235, 235, 255, 236, 236, 236, 255, 237, 237, 237, 255, 238, 238, 238, 255, 239, 239, 239, 255, 240, 240, 240, 255, 241, 241, 241, 255, 242, 242, 242, 255, 243, 243, 243, 255, 244, 244, 244, 255, 245, 245, 245, 255, 246, 246, 246, 255, 247, 247, 247, 255, 248, 248, 248, 255, 249, 249, 249, 255, 250, 250, 250, 255, 251, 251, 251, 255, 252, 252, 252, 255, 253, 253, 253, 255, 254, 254, 254, 255, 255, 255, 255, 255,
30 | };
31 | static const heatmap_colorscheme_t b2w = { b2w_data, sizeof(b2w_data)/sizeof(b2w_data[0])/4 };
32 | const heatmap_colorscheme_t* heatmap_cs_b2w = &b2w;
33 |
34 | static const unsigned char b2w_o_data[] = {
35 | 0, 0, 0, 255, 1, 1, 1, 255, 2, 2, 2, 255, 3, 3, 3, 255, 4, 4, 4, 255, 5, 5, 5, 255, 6, 6, 6, 255, 7, 7, 7, 255, 8, 8, 8, 255, 9, 9, 9, 255, 10, 10, 10, 255, 11, 11, 11, 255, 12, 12, 12, 255, 13, 13, 13, 255, 14, 14, 14, 255, 15, 15, 15, 255, 16, 16, 16, 255, 17, 17, 17, 255, 18, 18, 18, 255, 19, 19, 19, 255, 20, 20, 20, 255, 21, 21, 21, 255, 22, 22, 22, 255, 23, 23, 23, 255, 24, 24, 24, 255, 25, 25, 25, 255, 26, 26, 26, 255, 27, 27, 27, 255, 28, 28, 28, 255, 29, 29, 29, 255, 30, 30, 30, 255, 31, 31, 31, 255, 32, 32, 32, 255, 33, 33, 33, 255, 34, 34, 34, 255, 35, 35, 35, 255, 36, 36, 36, 255, 37, 37, 37, 255, 38, 38, 38, 255, 39, 39, 39, 255, 40, 40, 40, 255, 41, 41, 41, 255, 42, 42, 42, 255, 43, 43, 43, 255, 44, 44, 44, 255, 45, 45, 45, 255, 46, 46, 46, 255, 47, 47, 47, 255, 48, 48, 48, 255, 49, 49, 49, 255, 50, 50, 50, 255, 51, 51, 51, 255, 52, 52, 52, 255, 53, 53, 53, 255, 54, 54, 54, 255, 55, 55, 55, 255, 56, 56, 56, 255, 57, 57, 57, 255, 58, 58, 58, 255, 59, 59, 59, 255, 60, 60, 60, 255, 61, 61, 61, 255, 62, 62, 62, 255, 63, 63, 63, 255, 64, 64, 64, 255, 65, 65, 65, 255, 66, 66, 66, 255, 67, 67, 67, 255, 68, 68, 68, 255, 69, 69, 69, 255, 70, 70, 70, 255, 71, 71, 71, 255, 72, 72, 72, 255, 73, 73, 73, 255, 74, 74, 74, 255, 75, 75, 75, 255, 76, 76, 76, 255, 77, 77, 77, 255, 78, 78, 78, 255, 79, 79, 79, 255, 80, 80, 80, 255, 81, 81, 81, 255, 82, 82, 82, 255, 83, 83, 83, 255, 84, 84, 84, 255, 85, 85, 85, 255, 86, 86, 86, 255, 87, 87, 87, 255, 88, 88, 88, 255, 89, 89, 89, 255, 90, 90, 90, 255, 91, 91, 91, 255, 92, 92, 92, 255, 93, 93, 93, 255, 94, 94, 94, 255, 95, 95, 95, 255, 96, 96, 96, 255, 97, 97, 97, 255, 98, 98, 98, 255, 99, 99, 99, 255, 100, 100, 100, 255, 101, 101, 101, 255, 102, 102, 102, 255, 103, 103, 103, 255, 104, 104, 104, 255, 105, 105, 105, 255, 106, 106, 106, 255, 107, 107, 107, 255, 108, 108, 108, 255, 109, 109, 109, 255, 110, 110, 110, 255, 111, 111, 111, 255, 112, 112, 112, 255, 113, 113, 113, 255, 114, 114, 114, 255, 115, 115, 115, 255, 116, 116, 116, 255, 117, 117, 117, 255, 118, 118, 118, 255, 119, 119, 119, 255, 120, 120, 120, 255, 121, 121, 121, 255, 122, 122, 122, 255, 123, 123, 123, 255, 124, 124, 124, 255, 125, 125, 125, 255, 126, 126, 126, 255, 127, 127, 127, 255, 128, 128, 128, 255, 129, 129, 129, 255, 130, 130, 130, 255, 131, 131, 131, 255, 132, 132, 132, 255, 133, 133, 133, 255, 134, 134, 134, 255, 135, 135, 135, 255, 136, 136, 136, 255, 137, 137, 137, 255, 138, 138, 138, 255, 139, 139, 139, 255, 140, 140, 140, 255, 141, 141, 141, 255, 142, 142, 142, 255, 143, 143, 143, 255, 144, 144, 144, 255, 145, 145, 145, 255, 146, 146, 146, 255, 147, 147, 147, 255, 148, 148, 148, 255, 149, 149, 149, 255, 150, 150, 150, 255, 151, 151, 151, 255, 152, 152, 152, 255, 153, 153, 153, 255, 154, 154, 154, 255, 155, 155, 155, 255, 156, 156, 156, 255, 157, 157, 157, 255, 158, 158, 158, 255, 159, 159, 159, 255, 160, 160, 160, 255, 161, 161, 161, 255, 162, 162, 162, 255, 163, 163, 163, 255, 164, 164, 164, 255, 165, 165, 165, 255, 166, 166, 166, 255, 167, 167, 167, 255, 168, 168, 168, 255, 169, 169, 169, 255, 170, 170, 170, 255, 171, 171, 171, 255, 172, 172, 172, 255, 173, 173, 173, 255, 174, 174, 174, 255, 175, 175, 175, 255, 176, 176, 176, 255, 177, 177, 177, 255, 178, 178, 178, 255, 179, 179, 179, 255, 180, 180, 180, 255, 181, 181, 181, 255, 182, 182, 182, 255, 183, 183, 183, 255, 184, 184, 184, 255, 185, 185, 185, 255, 186, 186, 186, 255, 187, 187, 187, 255, 188, 188, 188, 255, 189, 189, 189, 255, 190, 190, 190, 255, 191, 191, 191, 255, 192, 192, 192, 255, 193, 193, 193, 255, 194, 194, 194, 255, 195, 195, 195, 255, 196, 196, 196, 255, 197, 197, 197, 255, 198, 198, 198, 255, 199, 199, 199, 255, 200, 200, 200, 255, 201, 201, 201, 255, 202, 202, 202, 255, 203, 203, 203, 255, 204, 204, 204, 255, 205, 205, 205, 255, 206, 206, 206, 255, 207, 207, 207, 255, 208, 208, 208, 255, 209, 209, 209, 255, 210, 210, 210, 255, 211, 211, 211, 255, 212, 212, 212, 255, 213, 213, 213, 255, 214, 214, 214, 255, 215, 215, 215, 255, 216, 216, 216, 255, 217, 217, 217, 255, 218, 218, 218, 255, 219, 219, 219, 255, 220, 220, 220, 255, 221, 221, 221, 255, 222, 222, 222, 255, 223, 223, 223, 255, 224, 224, 224, 255, 225, 225, 225, 255, 226, 226, 226, 255, 227, 227, 227, 255, 228, 228, 228, 255, 229, 229, 229, 255, 230, 230, 230, 255, 231, 231, 231, 255, 232, 232, 232, 255, 233, 233, 233, 255, 234, 234, 234, 255, 235, 235, 235, 255, 236, 236, 236, 255, 237, 237, 237, 255, 238, 238, 238, 255, 239, 239, 239, 255, 240, 240, 240, 255, 241, 241, 241, 255, 242, 242, 242, 255, 243, 243, 243, 255, 244, 244, 244, 255, 245, 245, 245, 255, 246, 246, 246, 255, 247, 247, 247, 255, 248, 248, 248, 255, 249, 249, 249, 255, 250, 250, 250, 255, 251, 251, 251, 255, 252, 252, 252, 255, 253, 253, 253, 255, 254, 254, 254, 255, 255, 255, 255, 255,
36 | };
37 | static const heatmap_colorscheme_t b2w_o = { b2w_o_data, sizeof(b2w_o_data)/sizeof(b2w_o_data[0])/4 };
38 | const heatmap_colorscheme_t* heatmap_cs_b2w_opaque = &b2w_o;
39 |
40 | static const unsigned char w2b_data[] = {
41 | 255, 255, 255, 0, 255, 255, 255, 255, 254, 254, 254, 255, 253, 253, 253, 255, 252, 252, 252, 255, 251, 251, 251, 255, 250, 250, 250, 255, 249, 249, 249, 255, 248, 248, 248, 255, 247, 247, 247, 255, 246, 246, 246, 255, 245, 245, 245, 255, 244, 244, 244, 255, 243, 243, 243, 255, 242, 242, 242, 255, 241, 241, 241, 255, 240, 240, 240, 255, 239, 239, 239, 255, 238, 238, 238, 255, 237, 237, 237, 255, 236, 236, 236, 255, 235, 235, 235, 255, 234, 234, 234, 255, 233, 233, 233, 255, 232, 232, 232, 255, 231, 231, 231, 255, 230, 230, 230, 255, 229, 229, 229, 255, 228, 228, 228, 255, 227, 227, 227, 255, 226, 226, 226, 255, 225, 225, 225, 255, 224, 224, 224, 255, 223, 223, 223, 255, 222, 222, 222, 255, 221, 221, 221, 255, 220, 220, 220, 255, 219, 219, 219, 255, 218, 218, 218, 255, 217, 217, 217, 255, 216, 216, 216, 255, 215, 215, 215, 255, 214, 214, 214, 255, 213, 213, 213, 255, 212, 212, 212, 255, 211, 211, 211, 255, 210, 210, 210, 255, 209, 209, 209, 255, 208, 208, 208, 255, 207, 207, 207, 255, 206, 206, 206, 255, 205, 205, 205, 255, 204, 204, 204, 255, 203, 203, 203, 255, 202, 202, 202, 255, 201, 201, 201, 255, 200, 200, 200, 255, 199, 199, 199, 255, 198, 198, 198, 255, 197, 197, 197, 255, 196, 196, 196, 255, 195, 195, 195, 255, 194, 194, 194, 255, 193, 193, 193, 255, 192, 192, 192, 255, 191, 191, 191, 255, 190, 190, 190, 255, 189, 189, 189, 255, 188, 188, 188, 255, 187, 187, 187, 255, 186, 186, 186, 255, 185, 185, 185, 255, 184, 184, 184, 255, 183, 183, 183, 255, 182, 182, 182, 255, 181, 181, 181, 255, 180, 180, 180, 255, 179, 179, 179, 255, 178, 178, 178, 255, 177, 177, 177, 255, 176, 176, 176, 255, 175, 175, 175, 255, 174, 174, 174, 255, 173, 173, 173, 255, 172, 172, 172, 255, 171, 171, 171, 255, 170, 170, 170, 255, 169, 169, 169, 255, 168, 168, 168, 255, 167, 167, 167, 255, 166, 166, 166, 255, 165, 165, 165, 255, 164, 164, 164, 255, 163, 163, 163, 255, 162, 162, 162, 255, 161, 161, 161, 255, 160, 160, 160, 255, 159, 159, 159, 255, 158, 158, 158, 255, 157, 157, 157, 255, 156, 156, 156, 255, 155, 155, 155, 255, 154, 154, 154, 255, 153, 153, 153, 255, 152, 152, 152, 255, 151, 151, 151, 255, 150, 150, 150, 255, 149, 149, 149, 255, 148, 148, 148, 255, 147, 147, 147, 255, 146, 146, 146, 255, 145, 145, 145, 255, 144, 144, 144, 255, 143, 143, 143, 255, 142, 142, 142, 255, 141, 141, 141, 255, 140, 140, 140, 255, 139, 139, 139, 255, 138, 138, 138, 255, 137, 137, 137, 255, 136, 136, 136, 255, 135, 135, 135, 255, 134, 134, 134, 255, 133, 133, 133, 255, 132, 132, 132, 255, 131, 131, 131, 255, 130, 130, 130, 255, 129, 129, 129, 255, 128, 128, 128, 255, 127, 127, 127, 255, 126, 126, 126, 255, 125, 125, 125, 255, 124, 124, 124, 255, 123, 123, 123, 255, 122, 122, 122, 255, 121, 121, 121, 255, 120, 120, 120, 255, 119, 119, 119, 255, 118, 118, 118, 255, 117, 117, 117, 255, 116, 116, 116, 255, 115, 115, 115, 255, 114, 114, 114, 255, 113, 113, 113, 255, 112, 112, 112, 255, 111, 111, 111, 255, 110, 110, 110, 255, 109, 109, 109, 255, 108, 108, 108, 255, 107, 107, 107, 255, 106, 106, 106, 255, 105, 105, 105, 255, 104, 104, 104, 255, 103, 103, 103, 255, 102, 102, 102, 255, 101, 101, 101, 255, 100, 100, 100, 255, 99, 99, 99, 255, 98, 98, 98, 255, 97, 97, 97, 255, 96, 96, 96, 255, 95, 95, 95, 255, 94, 94, 94, 255, 93, 93, 93, 255, 92, 92, 92, 255, 91, 91, 91, 255, 90, 90, 90, 255, 89, 89, 89, 255, 88, 88, 88, 255, 87, 87, 87, 255, 86, 86, 86, 255, 85, 85, 85, 255, 84, 84, 84, 255, 83, 83, 83, 255, 82, 82, 82, 255, 81, 81, 81, 255, 80, 80, 80, 255, 79, 79, 79, 255, 78, 78, 78, 255, 77, 77, 77, 255, 76, 76, 76, 255, 75, 75, 75, 255, 74, 74, 74, 255, 73, 73, 73, 255, 72, 72, 72, 255, 71, 71, 71, 255, 70, 70, 70, 255, 69, 69, 69, 255, 68, 68, 68, 255, 67, 67, 67, 255, 66, 66, 66, 255, 65, 65, 65, 255, 64, 64, 64, 255, 63, 63, 63, 255, 62, 62, 62, 255, 61, 61, 61, 255, 60, 60, 60, 255, 59, 59, 59, 255, 58, 58, 58, 255, 57, 57, 57, 255, 56, 56, 56, 255, 55, 55, 55, 255, 54, 54, 54, 255, 53, 53, 53, 255, 52, 52, 52, 255, 51, 51, 51, 255, 50, 50, 50, 255, 49, 49, 49, 255, 48, 48, 48, 255, 47, 47, 47, 255, 46, 46, 46, 255, 45, 45, 45, 255, 44, 44, 44, 255, 43, 43, 43, 255, 42, 42, 42, 255, 41, 41, 41, 255, 40, 40, 40, 255, 39, 39, 39, 255, 38, 38, 38, 255, 37, 37, 37, 255, 36, 36, 36, 255, 35, 35, 35, 255, 34, 34, 34, 255, 33, 33, 33, 255, 32, 32, 32, 255, 31, 31, 31, 255, 30, 30, 30, 255, 29, 29, 29, 255, 28, 28, 28, 255, 27, 27, 27, 255, 26, 26, 26, 255, 25, 25, 25, 255, 24, 24, 24, 255, 23, 23, 23, 255, 22, 22, 22, 255, 21, 21, 21, 255, 20, 20, 20, 255, 19, 19, 19, 255, 18, 18, 18, 255, 17, 17, 17, 255, 16, 16, 16, 255, 15, 15, 15, 255, 14, 14, 14, 255, 13, 13, 13, 255, 12, 12, 12, 255, 11, 11, 11, 255, 10, 10, 10, 255, 9, 9, 9, 255, 8, 8, 8, 255, 7, 7, 7, 255, 6, 6, 6, 255, 5, 5, 5, 255, 4, 4, 4, 255, 3, 3, 3, 255, 2, 2, 2, 255, 1, 1, 1, 255, 0, 0, 0, 255,
42 | };
43 | static const heatmap_colorscheme_t w2b = { w2b_data, sizeof(w2b_data)/sizeof(w2b_data[0])/4 };
44 | const heatmap_colorscheme_t* heatmap_cs_w2b = &w2b;
45 |
46 | static const unsigned char w2b_o_data[] = {
47 | 255, 255, 255, 255, 254, 254, 254, 255, 253, 253, 253, 255, 252, 252, 252, 255, 251, 251, 251, 255, 250, 250, 250, 255, 249, 249, 249, 255, 248, 248, 248, 255, 247, 247, 247, 255, 246, 246, 246, 255, 245, 245, 245, 255, 244, 244, 244, 255, 243, 243, 243, 255, 242, 242, 242, 255, 241, 241, 241, 255, 240, 240, 240, 255, 239, 239, 239, 255, 238, 238, 238, 255, 237, 237, 237, 255, 236, 236, 236, 255, 235, 235, 235, 255, 234, 234, 234, 255, 233, 233, 233, 255, 232, 232, 232, 255, 231, 231, 231, 255, 230, 230, 230, 255, 229, 229, 229, 255, 228, 228, 228, 255, 227, 227, 227, 255, 226, 226, 226, 255, 225, 225, 225, 255, 224, 224, 224, 255, 223, 223, 223, 255, 222, 222, 222, 255, 221, 221, 221, 255, 220, 220, 220, 255, 219, 219, 219, 255, 218, 218, 218, 255, 217, 217, 217, 255, 216, 216, 216, 255, 215, 215, 215, 255, 214, 214, 214, 255, 213, 213, 213, 255, 212, 212, 212, 255, 211, 211, 211, 255, 210, 210, 210, 255, 209, 209, 209, 255, 208, 208, 208, 255, 207, 207, 207, 255, 206, 206, 206, 255, 205, 205, 205, 255, 204, 204, 204, 255, 203, 203, 203, 255, 202, 202, 202, 255, 201, 201, 201, 255, 200, 200, 200, 255, 199, 199, 199, 255, 198, 198, 198, 255, 197, 197, 197, 255, 196, 196, 196, 255, 195, 195, 195, 255, 194, 194, 194, 255, 193, 193, 193, 255, 192, 192, 192, 255, 191, 191, 191, 255, 190, 190, 190, 255, 189, 189, 189, 255, 188, 188, 188, 255, 187, 187, 187, 255, 186, 186, 186, 255, 185, 185, 185, 255, 184, 184, 184, 255, 183, 183, 183, 255, 182, 182, 182, 255, 181, 181, 181, 255, 180, 180, 180, 255, 179, 179, 179, 255, 178, 178, 178, 255, 177, 177, 177, 255, 176, 176, 176, 255, 175, 175, 175, 255, 174, 174, 174, 255, 173, 173, 173, 255, 172, 172, 172, 255, 171, 171, 171, 255, 170, 170, 170, 255, 169, 169, 169, 255, 168, 168, 168, 255, 167, 167, 167, 255, 166, 166, 166, 255, 165, 165, 165, 255, 164, 164, 164, 255, 163, 163, 163, 255, 162, 162, 162, 255, 161, 161, 161, 255, 160, 160, 160, 255, 159, 159, 159, 255, 158, 158, 158, 255, 157, 157, 157, 255, 156, 156, 156, 255, 155, 155, 155, 255, 154, 154, 154, 255, 153, 153, 153, 255, 152, 152, 152, 255, 151, 151, 151, 255, 150, 150, 150, 255, 149, 149, 149, 255, 148, 148, 148, 255, 147, 147, 147, 255, 146, 146, 146, 255, 145, 145, 145, 255, 144, 144, 144, 255, 143, 143, 143, 255, 142, 142, 142, 255, 141, 141, 141, 255, 140, 140, 140, 255, 139, 139, 139, 255, 138, 138, 138, 255, 137, 137, 137, 255, 136, 136, 136, 255, 135, 135, 135, 255, 134, 134, 134, 255, 133, 133, 133, 255, 132, 132, 132, 255, 131, 131, 131, 255, 130, 130, 130, 255, 129, 129, 129, 255, 128, 128, 128, 255, 127, 127, 127, 255, 126, 126, 126, 255, 125, 125, 125, 255, 124, 124, 124, 255, 123, 123, 123, 255, 122, 122, 122, 255, 121, 121, 121, 255, 120, 120, 120, 255, 119, 119, 119, 255, 118, 118, 118, 255, 117, 117, 117, 255, 116, 116, 116, 255, 115, 115, 115, 255, 114, 114, 114, 255, 113, 113, 113, 255, 112, 112, 112, 255, 111, 111, 111, 255, 110, 110, 110, 255, 109, 109, 109, 255, 108, 108, 108, 255, 107, 107, 107, 255, 106, 106, 106, 255, 105, 105, 105, 255, 104, 104, 104, 255, 103, 103, 103, 255, 102, 102, 102, 255, 101, 101, 101, 255, 100, 100, 100, 255, 99, 99, 99, 255, 98, 98, 98, 255, 97, 97, 97, 255, 96, 96, 96, 255, 95, 95, 95, 255, 94, 94, 94, 255, 93, 93, 93, 255, 92, 92, 92, 255, 91, 91, 91, 255, 90, 90, 90, 255, 89, 89, 89, 255, 88, 88, 88, 255, 87, 87, 87, 255, 86, 86, 86, 255, 85, 85, 85, 255, 84, 84, 84, 255, 83, 83, 83, 255, 82, 82, 82, 255, 81, 81, 81, 255, 80, 80, 80, 255, 79, 79, 79, 255, 78, 78, 78, 255, 77, 77, 77, 255, 76, 76, 76, 255, 75, 75, 75, 255, 74, 74, 74, 255, 73, 73, 73, 255, 72, 72, 72, 255, 71, 71, 71, 255, 70, 70, 70, 255, 69, 69, 69, 255, 68, 68, 68, 255, 67, 67, 67, 255, 66, 66, 66, 255, 65, 65, 65, 255, 64, 64, 64, 255, 63, 63, 63, 255, 62, 62, 62, 255, 61, 61, 61, 255, 60, 60, 60, 255, 59, 59, 59, 255, 58, 58, 58, 255, 57, 57, 57, 255, 56, 56, 56, 255, 55, 55, 55, 255, 54, 54, 54, 255, 53, 53, 53, 255, 52, 52, 52, 255, 51, 51, 51, 255, 50, 50, 50, 255, 49, 49, 49, 255, 48, 48, 48, 255, 47, 47, 47, 255, 46, 46, 46, 255, 45, 45, 45, 255, 44, 44, 44, 255, 43, 43, 43, 255, 42, 42, 42, 255, 41, 41, 41, 255, 40, 40, 40, 255, 39, 39, 39, 255, 38, 38, 38, 255, 37, 37, 37, 255, 36, 36, 36, 255, 35, 35, 35, 255, 34, 34, 34, 255, 33, 33, 33, 255, 32, 32, 32, 255, 31, 31, 31, 255, 30, 30, 30, 255, 29, 29, 29, 255, 28, 28, 28, 255, 27, 27, 27, 255, 26, 26, 26, 255, 25, 25, 25, 255, 24, 24, 24, 255, 23, 23, 23, 255, 22, 22, 22, 255, 21, 21, 21, 255, 20, 20, 20, 255, 19, 19, 19, 255, 18, 18, 18, 255, 17, 17, 17, 255, 16, 16, 16, 255, 15, 15, 15, 255, 14, 14, 14, 255, 13, 13, 13, 255, 12, 12, 12, 255, 11, 11, 11, 255, 10, 10, 10, 255, 9, 9, 9, 255, 8, 8, 8, 255, 7, 7, 7, 255, 6, 6, 6, 255, 5, 5, 5, 255, 4, 4, 4, 255, 3, 3, 3, 255, 2, 2, 2, 255, 1, 1, 1, 255, 0, 0, 0, 255,
48 | };
49 | static const heatmap_colorscheme_t w2b_o = { w2b_o_data, sizeof(w2b_o_data)/sizeof(w2b_o_data[0])/4 };
50 | const heatmap_colorscheme_t* heatmap_cs_w2b_opaque = &w2b_o;
51 |
52 |
--------------------------------------------------------------------------------
/libs/heatmap/colorschemes/gray.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_COLORSCHEMES_GRAY_H
26 | #define _HEATMAP_COLORSCHEMES_GRAY_H
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* Black to white gradient with 0 being transparent. */
33 | extern const heatmap_colorscheme_t* heatmap_cs_b2w;
34 | /* Black to white gradient with 0 being all black. */
35 | extern const heatmap_colorscheme_t* heatmap_cs_b2w_opaque;
36 | /* White to black gradient with 0 being transparent. */
37 | extern const heatmap_colorscheme_t* heatmap_cs_w2b;
38 | /* White to black gradient with 0 being all white. */
39 | extern const heatmap_colorscheme_t* heatmap_cs_w2b_opaque;
40 |
41 | #ifdef __cplusplus
42 | } /* extern "C" */
43 | #endif
44 |
45 | #endif /* _HEATMAP_COLORSCHEMES_GRAY_H */
46 |
47 |
--------------------------------------------------------------------------------
/libs/heatmap/heatmap.c:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #include "heatmap.h"
26 |
27 | #include /* malloc, calloc, free */
28 | #include /* memcpy, memset */
29 | #include /* sqrtf */
30 | #include /* assert, #define NDEBUG to ignore. */
31 |
32 | /* Having a default stamp ready makes it easier for simple usage of the library
33 | * since there is no need to create a new stamp.
34 | */
35 | static float stamp_default_4_data[] = {
36 | 0.0f , 0.0f , 0.1055728f, 0.1753789f, 0.2f, 0.1753789f, 0.1055728f, 0.0f , 0.0f ,
37 | 0.0f , 0.1514719f, 0.2788897f, 0.3675445f, 0.4f, 0.3675445f, 0.2788897f, 0.1514719f, 0.0f ,
38 | 0.1055728f, 0.2788897f, 0.4343146f, 0.5527864f, 0.6f, 0.5527864f, 0.4343146f, 0.2788897f, 0.1055728f,
39 | 0.1753789f, 0.3675445f, 0.5527864f, 0.7171573f, 0.8f, 0.7171573f, 0.5527864f, 0.3675445f, 0.1753789f,
40 | 0.2f , 0.4f , 0.6f , 0.8f , 1.0f, 0.8f , 0.6f , 0.4f , 0.2f ,
41 | 0.1753789f, 0.3675445f, 0.5527864f, 0.7171573f, 0.8f, 0.7171573f, 0.5527864f, 0.3675445f, 0.1753789f,
42 | 0.1055728f, 0.2788897f, 0.4343146f, 0.5527864f, 0.6f, 0.5527864f, 0.4343146f, 0.2788897f, 0.1055728f,
43 | 0.0f , 0.1514719f, 0.2788897f, 0.3675445f, 0.4f, 0.3675445f, 0.2788897f, 0.1514719f, 0.0f ,
44 | 0.0f , 0.0f , 0.1055728f, 0.1753789f, 0.2f, 0.1753789f, 0.1055728f, 0.0f , 0.0f ,
45 | };
46 |
47 | static heatmap_stamp_t stamp_default_4 = {
48 | stamp_default_4_data, 9, 9
49 | };
50 |
51 | void heatmap_init(heatmap_t* hm, unsigned w, unsigned h)
52 | {
53 | memset(hm, 0, sizeof(heatmap_t));
54 | hm->buf = (float*)calloc(w*h, sizeof(float));
55 | hm->w = w;
56 | hm->h = h;
57 | }
58 |
59 | heatmap_t* heatmap_new(unsigned w, unsigned h)
60 | {
61 | heatmap_t* hm = (heatmap_t*)malloc(sizeof(heatmap_t));
62 | heatmap_init(hm, w, h);
63 | return hm;
64 | }
65 |
66 | void heatmap_free(heatmap_t* h)
67 | {
68 | free(h->buf);
69 | free(h);
70 | }
71 |
72 | void heatmap_add_point(heatmap_t* h, unsigned x, unsigned y)
73 | {
74 | heatmap_add_point_with_stamp(h, x, y, &stamp_default_4);
75 | }
76 |
77 | void heatmap_add_point_with_stamp(heatmap_t* h, unsigned x, unsigned y, const heatmap_stamp_t* stamp)
78 | {
79 | /* I'm still unsure whether we want this to be an assert or not... */
80 | if(x >= h->w || y >= h->h)
81 | return;
82 |
83 | /* I hate you, C */
84 | {
85 | /* Note: the order of operations is important, since we're computing with unsigned! */
86 |
87 | /* These are [first, last) pairs in the STAMP's pixels. */
88 | const unsigned x0 = x < stamp->w/2 ? (stamp->w/2 - x) : 0;
89 | const unsigned y0 = y < stamp->h/2 ? (stamp->h/2 - y) : 0;
90 | const unsigned x1 = (x + stamp->w/2) < h->w ? stamp->w : stamp->w/2 + (h->w - x);
91 | const unsigned y1 = (y + stamp->h/2) < h->h ? stamp->h : stamp->h/2 + (h->h - y);
92 |
93 | unsigned iy;
94 |
95 | for(iy = y0 ; iy < y1 ; ++iy) {
96 | /* TODO: could it be clearer by using separate vars and computing a ystep? */
97 | float* line = h->buf + ((y + iy) - stamp->h/2)*h->w + (x + x0) - stamp->w/2;
98 | const float* stampline = stamp->buf + iy*stamp->w + x0;
99 |
100 | unsigned ix;
101 | for(ix = x0 ; ix < x1 ; ++ix, ++line, ++stampline) {
102 | /* TODO: Let's actually accept negatives and try out funky stamps. */
103 | /* Note that that might mess with the max though. */
104 | /* And that we'll have to clamp the bottom to 0 when rendering. */
105 | assert(*stampline >= 0.0f);
106 |
107 | *line += *stampline;
108 | if(*line > h->max) {h->max = *line;}
109 |
110 | assert(*line >= 0.0f);
111 | }
112 | }
113 | } /* I hate you very much! */
114 | }
115 |
116 | unsigned char* heatmap_render_default_to(const heatmap_t* h, unsigned char* colorbuf)
117 | {
118 | return heatmap_render_to(h, heatmap_cs_default, colorbuf);
119 | }
120 |
121 | unsigned char* heatmap_render_to(const heatmap_t* h, const heatmap_colorscheme_t* colorscheme, unsigned char* colorbuf)
122 | {
123 | /* TODO: Time whether it makes a noticeable difference to inline that code
124 | * here and drop the saturation step.
125 | */
126 | /* If the heatmap is empty, h->max (and thus the saturation value) is 0.0, resulting in a 0-by-0 division.
127 | * In that case, we should set the saturation to anything but 0, since we want the result of the division to be 0.
128 | * Also, a comparison to exact 0.0f (as opposed to 1e-14) is OK, since we only do division.
129 | */
130 | return heatmap_render_saturated_to(h, colorscheme, h->max > 0.0f ? h->max : 1.0f, colorbuf);
131 | }
132 |
133 | unsigned char* heatmap_render_saturated_to(const heatmap_t* h, const heatmap_colorscheme_t* colorscheme, float saturation, unsigned char* colorbuf)
134 | {
135 | unsigned y;
136 | assert(saturation > 0.0f);
137 |
138 | /* For convenience, if no buffer is given, malloc a new one. */
139 | if(!colorbuf) {
140 | colorbuf = (unsigned char*)malloc(h->w*h->h*4);
141 | if(!colorbuf) {
142 | return 0;
143 | }
144 | }
145 |
146 | /* TODO: could actually even flatten this loop before parallelizing it. */
147 | /* I.e., to go i = 0 ; i < h*w since I don't have any padding! (yet?) */
148 | for(y = 0 ; y < h->h ; ++y) {
149 | float* bufline = h->buf + y*h->w;
150 | unsigned char* colorline = colorbuf + 4*y*h->w;
151 |
152 | unsigned x;
153 | for(x = 0 ; x < h->w ; ++x, ++bufline) {
154 | /* Saturate the heat value to the given saturation, and then
155 | * normalize by that.
156 | */
157 | const float val = (*bufline > saturation ? saturation : *bufline)/saturation;
158 |
159 | /* We add 0.5 in order to do real rounding, not just dropping the
160 | * decimal part. That way we are certain the highest value in the
161 | * colorscheme is actually used.
162 | */
163 | const size_t idx = (size_t)((float)(colorscheme->ncolors-1)*val + 0.5f);
164 |
165 | /* This is probably caused by a negative entry in the stamp! */
166 | assert(val >= 0.0f);
167 |
168 | /* This should never happen. It is likely a bug in this library. */
169 | assert(idx < colorscheme->ncolors);
170 |
171 | /* Just copy over the color from the colorscheme. */
172 | memcpy(colorline, colorscheme->colors + idx*4, 4);
173 | colorline += 4;
174 | }
175 | }
176 |
177 | return colorbuf;
178 | }
179 |
180 | void heatmap_stamp_init(heatmap_stamp_t* stamp, unsigned w, unsigned h, float* data)
181 | {
182 | if(stamp) {
183 | memset(stamp, 0, sizeof(heatmap_stamp_t));
184 | stamp->w = w;
185 | stamp->h = h;
186 | stamp->buf = data;
187 | }
188 | }
189 |
190 | heatmap_stamp_t* heatmap_stamp_new_with(unsigned w, unsigned h, float* data)
191 | {
192 | heatmap_stamp_t* stamp = (heatmap_stamp_t*)malloc(sizeof(heatmap_stamp_t));
193 | heatmap_stamp_init(stamp, w, h, data);
194 | return stamp;
195 | }
196 |
197 | heatmap_stamp_t* heatmap_stamp_load(unsigned w, unsigned h, float* data)
198 | {
199 | float* copy = (float*)malloc(sizeof(float)*w*h);
200 | memcpy(copy, data, sizeof(float)*w*h);
201 | return heatmap_stamp_new_with(w, h, copy);
202 | }
203 |
204 | static float linear_dist(float dist)
205 | {
206 | return dist;
207 | }
208 |
209 | heatmap_stamp_t* heatmap_stamp_gen(unsigned r)
210 | {
211 | return heatmap_stamp_gen_nonlinear(r, linear_dist);
212 | }
213 |
214 | heatmap_stamp_t* heatmap_stamp_gen_nonlinear(unsigned r, float (*distshape)(float))
215 | {
216 | unsigned y;
217 | unsigned d = 2*r+1;
218 |
219 | float* stamp = (float*)calloc(d*d, sizeof(float));
220 | if(!stamp)
221 | return 0;
222 |
223 | for(y = 0 ; y < d ; ++y) {
224 | float* line = stamp + y*d;
225 | unsigned x;
226 | for(x = 0 ; x < d ; ++x, ++line) {
227 | const float dist = sqrtf((float)((x-r)*(x-r) + (y-r)*(y-r)))/(float)(r+1);
228 | const float ds = (*distshape)(dist);
229 | /* This doesn't generate optimal assembly, but meh, it's readable. */
230 | const float clamped_ds = ds > 1.0f ? 1.0f
231 | : ds < 0.0f ? 0.0f
232 | : ds;
233 | *line = 1.0f - clamped_ds;
234 | }
235 | }
236 |
237 | return heatmap_stamp_new_with(d, d, stamp);
238 | }
239 |
240 | void heatmap_stamp_free(heatmap_stamp_t* s)
241 | {
242 | free(s->buf);
243 | free(s);
244 | }
245 |
246 | heatmap_colorscheme_t* heatmap_colorscheme_load(const unsigned char* in_colors, size_t ncolors)
247 | {
248 | heatmap_colorscheme_t* cs = (heatmap_colorscheme_t*)calloc(1, sizeof(heatmap_colorscheme_t));
249 | unsigned char* colors = (unsigned char*)malloc(4*ncolors);
250 |
251 | if(!cs || !colors) {
252 | free(cs);
253 | free(colors);
254 | return 0;
255 | }
256 |
257 | memcpy(colors, in_colors, 4*ncolors);
258 |
259 | cs->colors = colors;
260 | cs->ncolors = ncolors;
261 | return cs;
262 | }
263 |
264 | void heatmap_colorscheme_free(heatmap_colorscheme_t* cs)
265 | {
266 | /* ehhh, const_cast<>! */
267 | free((void*)cs->colors);
268 | free(cs);
269 | }
270 |
271 | /* Sorry dynamic wordwarp editor users! But you deserve no better anyways... */
272 | static const unsigned char mixed_data[] = {0, 0, 0, 0, 94, 79, 162, 0, 93, 79, 162, 7, 93, 80, 162, 14, 92, 80, 163, 22, 92, 81, 163, 29, 91, 81, 164, 37, 91, 82, 164, 44, 90, 82, 164, 52, 90, 83, 165, 59, 89, 83, 165, 67, 89, 84, 166, 74, 88, 84, 166, 82, 88, 85, 166, 89, 87, 85, 167, 97, 87, 86, 167, 104, 86, 86, 167, 112, 86, 87, 168, 119, 85, 87, 168, 127, 85, 88, 168, 134, 84, 88, 169, 141, 84, 89, 169, 149, 83, 89, 169, 156, 83, 90, 170, 164, 83, 90, 170, 171, 82, 91, 170, 179, 82, 91, 171, 186, 81, 92, 171, 194, 81, 92, 171, 201, 80, 93, 172, 209, 80, 93, 172, 216, 79, 94, 172, 224, 79, 94, 172, 231, 78, 95, 173, 239, 78, 95, 173, 246, 77, 95, 173, 254, 77, 96, 174, 255, 76, 96, 174, 255, 76, 97, 174, 255, 75, 97, 174, 255, 75, 98, 175, 255, 74, 98, 175, 255, 74, 99, 175, 255, 73, 99, 175, 255, 73, 100, 176, 255, 72, 100, 176, 255, 72, 101, 176, 255, 72, 101, 176, 255, 71, 101, 176, 255, 71, 102, 177, 255, 70, 102, 177, 255, 70, 103, 177, 255, 69, 103, 177, 255, 60, 115, 183, 255, 60, 115, 183, 255, 59, 116, 183, 255, 59, 116, 183, 255, 58, 117, 184, 255, 58, 117, 184, 255, 58, 118, 184, 255, 57, 118, 184, 255, 57, 118, 184, 255, 56, 119, 184, 255, 56, 119, 185, 255, 56, 120, 185, 255, 55, 120, 185, 255, 55, 121, 185, 255, 55, 121, 185, 255, 54, 121, 185, 255, 54, 122, 186, 255, 54, 122, 186, 255, 53, 123, 186, 255, 53, 123, 186, 255, 53, 124, 186, 255, 52, 124, 186, 255, 52, 124, 186, 255, 52, 125, 186, 255, 52, 125, 187, 255, 51, 126, 187, 255, 51, 126, 187, 255, 51, 126, 187, 255, 51, 127, 187, 255, 50, 127, 187, 255, 50, 128, 187, 255, 50, 128, 187, 255, 50, 128, 187, 255, 50, 129, 187, 255, 50, 129, 188, 255, 50, 130, 188, 255, 49, 130, 188, 255, 49, 130, 188, 255, 49, 131, 188, 255, 49, 131, 188, 255, 49, 132, 188, 255, 49, 132, 188, 255, 49, 132, 188, 255, 49, 133, 188, 255, 49, 133, 188, 255, 49, 133, 188, 255, 49, 134, 188, 255, 49, 134, 188, 255, 49, 135, 188, 255, 49, 135, 188, 255, 49, 135, 188, 255, 49, 136, 189, 255, 47, 136, 189, 255, 46, 137, 189, 255, 45, 138, 189, 255, 43, 138, 189, 255, 42, 139, 190, 255, 41, 139, 190, 255, 39, 140, 190, 255, 38, 140, 190, 255, 36, 141, 190, 255, 35, 141, 190, 255, 33, 142, 190, 255, 31, 142, 190, 255, 30, 143, 190, 255, 28, 143, 190, 255, 26, 144, 191, 255, 24, 145, 191, 255, 22, 145, 191, 255, 20, 146, 191, 255, 17, 146, 191, 255, 15, 147, 191, 255, 12, 147, 191, 255, 10, 148, 191, 255, 10, 148, 191, 255, 10, 149, 191, 255, 10, 149, 191, 255, 10, 150, 191, 255, 10, 150, 190, 255, 10, 151, 190, 255, 10, 151, 190, 255, 10, 152, 190, 255, 10, 152, 190, 255, 10, 153, 190, 255, 10, 153, 190, 255, 10, 154, 190, 255, 10, 154, 190, 255, 10, 155, 190, 255, 10, 155, 189, 255, 10, 156, 189, 255, 10, 156, 189, 255, 10, 157, 189, 255, 10, 157, 189, 255, 10, 158, 189, 255, 10, 158, 188, 255, 10, 158, 188, 255, 10, 159, 188, 255, 10, 159, 188, 255, 10, 160, 188, 255, 10, 160, 187, 255, 10, 161, 187, 255, 10, 161, 187, 255, 20, 173, 182, 255, 22, 174, 182, 255, 25, 174, 181, 255, 28, 175, 181, 255, 30, 175, 181, 255, 33, 176, 180, 255, 35, 176, 180, 255, 37, 176, 180, 255, 39, 177, 180, 255, 41, 177, 179, 255, 43, 178, 179, 255, 45, 178, 179, 255, 46, 179, 178, 255, 48, 179, 178, 255, 50, 179, 178, 255, 51, 180, 177, 255, 53, 180, 177, 255, 54, 181, 177, 255, 56, 181, 176, 255, 58, 182, 176, 255, 59, 182, 176, 255, 61, 182, 175, 255, 62, 183, 175, 255, 64, 183, 175, 255, 65, 184, 174, 255, 66, 184, 174, 255, 68, 184, 174, 255, 69, 185, 173, 255, 71, 185, 173, 255, 72, 186, 173, 255, 74, 186, 172, 255, 75, 186, 172, 255, 76, 187, 171, 255, 78, 187, 171, 255, 79, 187, 171, 255, 80, 188, 170, 255, 82, 188, 170, 255, 83, 189, 170, 255, 85, 189, 169, 255, 86, 189, 169, 255, 87, 190, 169, 255, 89, 190, 168, 255, 90, 190, 168, 255, 91, 191, 167, 255, 93, 191, 167, 255, 94, 191, 167, 255, 95, 192, 166, 255, 97, 192, 166, 255, 98, 193, 166, 255, 99, 193, 165, 255, 100, 193, 165, 255, 102, 194, 164, 255, 102, 194, 164, 255, 103, 194, 164, 255, 103, 194, 164, 255, 104, 194, 164, 255, 104, 195, 164, 255, 105, 195, 164, 255, 105, 195, 164, 255, 106, 195, 164, 255, 106, 196, 164, 255, 107, 196, 164, 255, 108, 196, 164, 255, 108, 196, 164, 255, 109, 196, 164, 255, 109, 197, 164, 255, 110, 197, 164, 255, 110, 197, 164, 255, 111, 197, 164, 255, 111, 198, 164, 255, 112, 198, 164, 255, 112, 198, 164, 255, 113, 198, 164, 255, 113, 198, 164, 255, 114, 199, 164, 255, 115, 199, 164, 255, 115, 199, 164, 255, 116, 199, 164, 255, 116, 200, 164, 255, 117, 200, 164, 255, 117, 200, 164, 255, 118, 200, 164, 255, 118, 200, 164, 255, 119, 201, 164, 255, 119, 201, 164, 255, 120, 201, 164, 255, 120, 201, 164, 255, 121, 201, 164, 255, 122, 202, 164, 255, 122, 202, 164, 255, 123, 202, 164, 255, 123, 202, 164, 255, 124, 203, 164, 255, 124, 203, 164, 255, 125, 203, 164, 255, 125, 203, 164, 255, 126, 203, 164, 255, 126, 204, 164, 255, 127, 204, 164, 255, 127, 204, 163, 255, 128, 204, 163, 255, 129, 204, 163, 255, 143, 210, 163, 255, 143, 210, 163, 255, 144, 210, 163, 255, 144, 211, 163, 255, 145, 211, 163, 255, 146, 211, 163, 255, 146, 211, 163, 255, 147, 212, 163, 255, 147, 212, 163, 255, 148, 212, 163, 255, 148, 212, 163, 255, 149, 212, 163, 255, 149, 213, 163, 255, 150, 213, 163, 255, 150, 213, 163, 255, 151, 213, 163, 255, 151, 213, 163, 255, 152, 214, 163, 255, 153, 214, 163, 255, 153, 214, 163, 255, 154, 214, 163, 255, 154, 214, 163, 255, 155, 215, 163, 255, 155, 215, 163, 255, 156, 215, 163, 255, 156, 215, 163, 255, 157, 215, 163, 255, 157, 216, 163, 255, 158, 216, 163, 255, 158, 216, 163, 255, 159, 216, 163, 255, 160, 216, 163, 255, 160, 217, 163, 255, 161, 217, 163, 255, 161, 217, 163, 255, 162, 217, 163, 255, 162, 217, 163, 255, 163, 218, 163, 255, 163, 218, 163, 255, 164, 218, 163, 255, 164, 218, 163, 255, 165, 218, 163, 255, 166, 219, 163, 255, 166, 219, 163, 255, 167, 219, 163, 255, 167, 219, 163, 255, 168, 219, 163, 255, 168, 220, 163, 255, 169, 220, 163, 255, 169, 220, 163, 255, 170, 220, 163, 255, 170, 220, 163, 255, 171, 221, 163, 255, 171, 221, 163, 255, 172, 221, 163, 255, 172, 221, 163, 255, 172, 222, 163, 255, 173, 222, 163, 255, 173, 222, 163, 255, 173, 222, 163, 255, 174, 222, 163, 255, 174, 223, 163, 255, 175, 223, 163, 255, 175, 223, 163, 255, 175, 223, 162, 255, 176, 223, 162, 255, 176, 224, 162, 255, 177, 224, 162, 255, 177, 224, 162, 255, 177, 224, 162, 255, 178, 224, 162, 255, 178, 225, 162, 255, 179, 225, 162, 255, 179, 225, 162, 255, 179, 225, 162, 255, 180, 225, 161, 255, 180, 226, 161, 255, 181, 226, 161, 255, 181, 226, 161, 255, 182, 226, 161, 255, 182, 226, 161, 255, 182, 227, 161, 255, 183, 227, 161, 255, 183, 227, 161, 255, 184, 227, 161, 255, 184, 227, 160, 255, 185, 228, 160, 255, 185, 228, 160, 255, 185, 228, 160, 255, 186, 228, 160, 255, 186, 228, 160, 255, 187, 229, 160, 255, 187, 229, 160, 255, 188, 229, 160, 255, 188, 229, 160, 255, 189, 229, 159, 255, 189, 230, 159, 255, 189, 230, 159, 255, 190, 230, 159, 255, 190, 230, 159, 255, 191, 230, 159, 255, 191, 231, 159, 255, 192, 231, 159, 255, 204, 236, 156, 255, 205, 236, 156, 255, 205, 236, 156, 255, 205, 236, 156, 255, 206, 236, 156, 255, 206, 237, 156, 255, 207, 237, 156, 255, 207, 237, 156, 255, 208, 237, 156, 255, 208, 237, 155, 255, 209, 238, 155, 255, 209, 238, 155, 255, 210, 238, 155, 255, 210, 238, 155, 255, 211, 238, 155, 255, 211, 238, 155, 255, 212, 239, 155, 255, 212, 239, 155, 255, 213, 239, 155, 255, 213, 239, 154, 255, 214, 239, 154, 255, 214, 240, 154, 255, 215, 240, 154, 255, 215, 240, 154, 255, 216, 240, 154, 255, 216, 240, 154, 255, 217, 240, 154, 255, 217, 241, 154, 255, 218, 241, 154, 255, 218, 241, 153, 255, 219, 241, 153, 255, 219, 241, 153, 255, 220, 241, 153, 255, 220, 242, 153, 255, 221, 242, 153, 255, 221, 242, 153, 255, 222, 242, 153, 255, 222, 242, 153, 255, 223, 242, 153, 255, 223, 243, 153, 255, 224, 243, 152, 255, 224, 243, 152, 255, 225, 243, 152, 255, 225, 243, 152, 255, 226, 243, 152, 255, 227, 244, 152, 255, 227, 244, 152, 255, 228, 244, 152, 255, 228, 244, 152, 255, 229, 244, 152, 255, 229, 244, 152, 255, 230, 244, 151, 255, 230, 244, 151, 255, 230, 244, 151, 255, 230, 244, 151, 255, 230, 244, 151, 255, 230, 244, 151, 255, 230, 244, 151, 255, 230, 244, 151, 255, 230, 244, 151, 255, 231, 244, 151, 255, 231, 244, 151, 255, 231, 244, 151, 255, 231, 243, 151, 255, 231, 243, 151, 255, 231, 243, 151, 255, 231, 243, 151, 255, 231, 243, 150, 255, 231, 243, 150, 255, 232, 243, 150, 255, 232, 243, 150, 255, 232, 243, 150, 255, 232, 243, 150, 255, 232, 243, 150, 255, 232, 243, 150, 255, 232, 243, 150, 255, 232, 242, 150, 255, 232, 242, 150, 255, 233, 242, 150, 255, 233, 242, 150, 255, 233, 242, 150, 255, 233, 242, 150, 255, 233, 242, 150, 255, 233, 242, 150, 255, 233, 242, 150, 255, 233, 242, 149, 255, 233, 242, 149, 255, 234, 242, 149, 255, 234, 241, 149, 255, 234, 241, 149, 255, 234, 241, 149, 255, 234, 241, 149, 255, 234, 241, 149, 255, 234, 241, 149, 255, 234, 241, 149, 255, 234, 241, 149, 255, 235, 241, 149, 255, 235, 241, 149, 255, 235, 241, 149, 255, 235, 241, 149, 255, 235, 240, 149, 255, 235, 240, 149, 255, 235, 240, 149, 255, 235, 240, 149, 255, 235, 240, 149, 255, 236, 240, 148, 255, 236, 240, 148, 255, 236, 240, 148, 255, 236, 240, 148, 255, 236, 240, 148, 255, 236, 240, 148, 255, 236, 240, 148, 255, 236, 239, 148, 255, 236, 239, 148, 255, 236, 239, 148, 255, 237, 239, 148, 255, 237, 239, 148, 255, 237, 239, 148, 255, 237, 239, 148, 255, 237, 239, 148, 255, 237, 239, 148, 255, 237, 239, 148, 255, 237, 239, 148, 255, 237, 239, 148, 255, 237, 238, 148, 255, 238, 238, 148, 255, 238, 238, 148, 255, 238, 238, 148, 255, 238, 238, 148, 255, 238, 238, 147, 255, 238, 238, 147, 255, 238, 238, 147, 255, 238, 238, 147, 255, 238, 238, 147, 255, 238, 238, 147, 255, 239, 238, 147, 255, 239, 237, 147, 255, 239, 237, 147, 255, 239, 237, 147, 255, 239, 237, 147, 255, 239, 237, 147, 255, 239, 237, 147, 255, 239, 237, 147, 255, 239, 237, 147, 255, 239, 237, 147, 255, 240, 237, 147, 255, 240, 237, 147, 255, 240, 237, 147, 255, 240, 236, 147, 255, 240, 236, 147, 255, 240, 236, 147, 255, 240, 236, 147, 255, 240, 236, 147, 255, 245, 232, 145, 255, 245, 232, 145, 255, 245, 232, 145, 255, 245, 232, 145, 255, 245, 232, 145, 255, 246, 231, 145, 255, 246, 231, 145, 255, 246, 231, 145, 255, 246, 231, 145, 255, 246, 231, 145, 255, 246, 231, 145, 255, 246, 231, 145, 255, 246, 231, 145, 255, 246, 231, 145, 255, 246, 231, 145, 255, 246, 231, 145, 255, 247, 231, 145, 255, 247, 230, 145, 255, 247, 230, 145, 255, 247, 230, 145, 255, 247, 230, 145, 255, 247, 230, 144, 255, 247, 230, 144, 255, 247, 230, 144, 255, 247, 230, 144, 255, 247, 230, 144, 255, 247, 230, 144, 255, 248, 230, 144, 255, 248, 230, 144, 255, 248, 229, 144, 255, 248, 229, 144, 255, 248, 229, 144, 255, 248, 229, 144, 255, 248, 229, 144, 255, 248, 229, 144, 255, 248, 229, 144, 255, 248, 229, 144, 255, 248, 229, 144, 255, 248, 229, 144, 255, 249, 229, 144, 255, 249, 229, 144, 255, 249, 229, 144, 255, 249, 228, 144, 255, 249, 228, 144, 255, 249, 228, 144, 255, 249, 228, 144, 255, 249, 228, 144, 255, 249, 228, 144, 255, 249, 228, 144, 255, 249, 228, 144, 255, 249, 228, 144, 255, 250, 228, 144, 255, 250, 228, 144, 255, 250, 228, 144, 255, 250, 227, 144, 255, 250, 227, 144, 255, 250, 227, 144, 255, 250, 227, 144, 255, 250, 227, 144, 255, 250, 227, 144, 255, 250, 227, 144, 255, 250, 227, 144, 255, 250, 227, 144, 255, 251, 227, 144, 255, 251, 227, 144, 255, 251, 227, 144, 255, 251, 226, 144, 255, 251, 226, 144, 255, 251, 226, 144, 255, 251, 226, 144, 255, 251, 226, 144, 255, 251, 226, 144, 255, 251, 226, 144, 255, 251, 226, 144, 255, 251, 226, 144, 255, 251, 226, 144, 255, 252, 226, 144, 255, 252, 226, 144, 255, 252, 225, 144, 255, 252, 225, 144, 255, 252, 225, 144, 255, 252, 225, 144, 255, 252, 225, 144, 255, 252, 225, 144, 255, 252, 225, 144, 255, 252, 225, 144, 255, 252, 225, 144, 255, 252, 225, 144, 255, 252, 225, 144, 255, 253, 225, 144, 255, 253, 225, 144, 255, 253, 224, 144, 255, 253, 224, 144, 255, 253, 224, 144, 255, 253, 224, 144, 255, 253, 224, 144, 255, 253, 224, 144, 255, 253, 224, 144, 255, 253, 224, 144, 255, 253, 224, 144, 255, 253, 224, 144, 255, 253, 224, 144, 255, 253, 224, 144, 255, 253, 223, 143, 255, 253, 223, 143, 255, 253, 223, 142, 255, 253, 222, 142, 255, 253, 222, 141, 255, 253, 221, 141, 255, 253, 221, 141, 255, 253, 221, 140, 255, 253, 220, 140, 255, 253, 220, 139, 255, 253, 220, 139, 255, 253, 219, 138, 255, 253, 219, 138, 255, 253, 218, 138, 255, 253, 218, 137, 255, 253, 218, 137, 255, 253, 217, 136, 255, 253, 217, 136, 255, 253, 217, 135, 255, 253, 216, 135, 255, 253, 216, 135, 255, 253, 215, 134, 255, 253, 215, 134, 255, 253, 215, 133, 255, 253, 214, 133, 255, 253, 214, 133, 255, 253, 214, 132, 255, 253, 213, 132, 255, 253, 213, 131, 255, 253, 212, 131, 255, 253, 212, 131, 255, 253, 212, 130, 255, 253, 211, 130, 255, 253, 211, 129, 255, 253, 211, 129, 255, 253, 210, 129, 255, 253, 210, 128, 255, 253, 209, 128, 255, 253, 209, 127, 255, 253, 209, 127, 255, 253, 208, 127, 255, 253, 208, 126, 255, 253, 207, 126, 255, 253, 207, 125, 255, 253, 207, 125, 255, 253, 206, 125, 255, 253, 206, 124, 255, 253, 205, 124, 255, 253, 205, 123, 255, 253, 205, 123, 255, 253, 204, 123, 255, 253, 194, 113, 255, 253, 194, 113, 255, 253, 193, 112, 255, 253, 193, 112, 255, 253, 192, 112, 255, 253, 192, 111, 255, 253, 192, 111, 255, 253, 191, 110, 255, 253, 191, 110, 255, 253, 190, 110, 255, 253, 190, 109, 255, 253, 190, 109, 255, 253, 189, 109, 255, 253, 189, 108, 255, 253, 188, 108, 255, 253, 188, 108, 255, 253, 188, 107, 255, 253, 187, 107, 255, 253, 187, 107, 255, 253, 186, 106, 255, 253, 186, 106, 255, 253, 186, 106, 255, 253, 185, 105, 255, 253, 185, 105, 255, 253, 184, 105, 255, 253, 184, 104, 255, 253, 184, 104, 255, 253, 183, 104, 255, 253, 183, 103, 255, 253, 182, 103, 255, 253, 182, 103, 255, 253, 182, 102, 255, 253, 181, 102, 255, 253, 181, 102, 255, 253, 180, 101, 255, 253, 180, 101, 255, 253, 180, 101, 255, 253, 179, 100, 255, 253, 179, 100, 255, 253, 178, 100, 255, 253, 178, 100, 255, 253, 178, 99, 255, 253, 177, 99, 255, 253, 177, 99, 255, 253, 176, 98, 255, 253, 176, 98, 255, 253, 175, 98, 255, 253, 175, 98, 255, 253, 175, 97, 255, 253, 174, 97, 255, 253, 174, 97, 255, 252, 173, 96, 255, 252, 173, 96, 255, 252, 172, 96, 255, 252, 172, 95, 255, 252, 172, 95, 255, 252, 171, 95, 255, 252, 171, 94, 255, 252, 170, 94, 255, 252, 170, 94, 255, 252, 169, 93, 255, 252, 169, 93, 255, 252, 168, 93, 255, 252, 168, 92, 255, 252, 167, 92, 255, 252, 167, 92, 255, 252, 166, 91, 255, 252, 166, 91, 255, 252, 165, 91, 255, 251, 165, 90, 255, 251, 164, 90, 255, 251, 164, 90, 255, 251, 163, 89, 255, 251, 163, 89, 255, 251, 162, 89, 255, 251, 162, 89, 255, 251, 162, 88, 255, 251, 161, 88, 255, 251, 161, 88, 255, 251, 160, 87, 255, 251, 160, 87, 255, 251, 159, 87, 255, 251, 159, 87, 255, 251, 158, 86, 255, 251, 158, 86, 255, 251, 157, 86, 255, 250, 157, 85, 255, 250, 156, 85, 255, 250, 156, 85, 255, 250, 155, 85, 255, 250, 155, 84, 255, 250, 154, 84, 255, 250, 154, 84, 255, 250, 153, 84, 255, 250, 153, 83, 255, 250, 152, 83, 255, 250, 152, 83, 255, 250, 151, 83, 255, 250, 151, 82, 255, 250, 150, 82, 255, 250, 150, 82, 255, 249, 149, 82, 255, 248, 136, 75, 255, 248, 135, 75, 255, 247, 135, 75, 255, 247, 134, 75, 255, 247, 134, 74, 255, 247, 133, 74, 255, 247, 133, 74, 255, 247, 132, 74, 255, 247, 132, 74, 255, 247, 131, 73, 255, 247, 131, 73, 255, 247, 130, 73, 255, 247, 130, 73, 255, 247, 129, 72, 255, 247, 129, 72, 255, 247, 128, 72, 255, 246, 128, 72, 255, 246, 127, 72, 255, 246, 126, 71, 255, 246, 126, 71, 255, 246, 125, 71, 255, 246, 125, 71, 255, 246, 124, 71, 255, 246, 124, 71, 255, 246, 123, 70, 255, 246, 123, 70, 255, 246, 122, 70, 255, 246, 122, 70, 255, 246, 121, 70, 255, 245, 121, 70, 255, 245, 120, 69, 255, 245, 120, 69, 255, 245, 119, 69, 255, 245, 119, 69, 255, 245, 118, 69, 255, 245, 117, 69, 255, 245, 117, 68, 255, 245, 116, 68, 255, 245, 116, 68, 255, 245, 115, 68, 255, 245, 115, 68, 255, 244, 114, 68, 255, 244, 114, 68, 255, 244, 113, 67, 255, 244, 113, 67, 255, 244, 112, 67, 255, 244, 111, 67, 255, 244, 111, 67, 255, 244, 110, 67, 255, 244, 110, 67, 255, 244, 109, 67, 255, 244, 109, 67, 255, 243, 108, 67, 255, 243, 108, 67, 255, 243, 107, 67, 255, 243, 107, 67, 255, 243, 107, 67, 255, 242, 106, 67, 255, 242, 106, 67, 255, 242, 106, 67, 255, 242, 105, 67, 255, 242, 105, 67, 255, 241, 104, 68, 255, 241, 104, 68, 255, 241, 104, 68, 255, 241, 103, 68, 255, 241, 103, 68, 255, 240, 102, 68, 255, 240, 102, 68, 255, 240, 102, 68, 255, 240, 101, 68, 255, 240, 101, 68, 255, 239, 101, 69, 255, 239, 100, 69, 255, 239, 100, 69, 255, 239, 99, 69, 255, 238, 99, 69, 255, 238, 99, 69, 255, 238, 98, 69, 255, 238, 98, 69, 255, 238, 98, 69, 255, 237, 97, 69, 255, 237, 97, 70, 255, 237, 96, 70, 255, 237, 96, 70, 255, 236, 96, 70, 255, 236, 95, 70, 255, 236, 95, 70, 255, 236, 95, 70, 255, 236, 94, 70, 255, 235, 94, 70, 255, 235, 94, 70, 255, 235, 93, 71, 255, 235, 93, 71, 255, 234, 92, 71, 255, 234, 92, 71, 255, 234, 92, 71, 255, 234, 91, 71, 255, 233, 91, 71, 255, 233, 91, 71, 255, 233, 90, 71, 255, 233, 90, 71, 255, 233, 89, 72, 255, 226, 80, 74, 255, 226, 79, 74, 255, 226, 79, 74, 255, 225, 79, 74, 255, 225, 78, 74, 255, 225, 78, 74, 255, 225, 77, 75, 255, 224, 77, 75, 255, 224, 77, 75, 255, 224, 76, 75, 255, 224, 76, 75, 255, 223, 76, 75, 255, 223, 75, 75, 255, 223, 75, 75, 255, 223, 75, 75, 255, 222, 74, 75, 255, 222, 74, 75, 255, 222, 73, 76, 255, 222, 73, 76, 255, 221, 73, 76, 255, 221, 72, 76, 255, 221, 72, 76, 255, 220, 72, 76, 255, 220, 71, 76, 255, 220, 71, 76, 255, 220, 71, 76, 255, 219, 70, 76, 255, 219, 70, 76, 255, 219, 70, 77, 255, 219, 69, 77, 255, 218, 69, 77, 255, 218, 68, 77, 255, 218, 68, 77, 255, 217, 68, 77, 255, 217, 67, 77, 255, 217, 67, 77, 255, 217, 67, 77, 255, 216, 66, 77, 255, 216, 66, 77, 255, 216, 66, 78, 255, 216, 65, 78, 255, 215, 65, 78, 255, 215, 65, 78, 255, 215, 64, 78, 255, 214, 64, 78, 255, 214, 63, 78, 255, 214, 63, 78, 255, 214, 63, 78, 255, 213, 62, 78, 255, 213, 62, 78, 255, 213, 62, 78, 255, 212, 61, 78, 255, 212, 61, 78, 255, 211, 61, 78, 255, 211, 60, 78, 255, 211, 60, 78, 255, 210, 59, 78, 255, 210, 59, 78, 255, 209, 59, 78, 255, 209, 58, 78, 255, 209, 58, 78, 255, 208, 57, 78, 255, 208, 57, 77, 255, 207, 57, 77, 255, 207, 56, 77, 255, 206, 56, 77, 255, 206, 56, 77, 255, 206, 55, 77, 255, 205, 55, 77, 255, 205, 54, 77, 255, 204, 54, 77, 255, 204, 54, 77, 255, 203, 53, 77, 255, 203, 53, 76, 255, 203, 52, 76, 255, 202, 52, 76, 255, 202, 52, 76, 255, 201, 51, 76, 255, 201, 51, 76, 255, 200, 50, 76, 255, 200, 50, 76, 255, 200, 50, 76, 255, 199, 49, 76, 255, 199, 49, 76, 255, 198, 48, 75, 255, 198, 48, 75, 255, 198, 48, 75, 255, 197, 47, 75, 255, 197, 47, 75, 255, 196, 46, 75, 255, 196, 46, 75, 255, 195, 46, 75, 255, 195, 45, 75, 255, 195, 45, 75, 255, 194, 44, 74, 255, 194, 44, 74, 255, 193, 43, 74, 255, 193, 43, 74, 255, 192, 43, 74, 255, 192, 42, 74, 255, 192, 42, 74, 255, 191, 41, 74, 255, 180, 29, 71, 255, 179, 28, 71, 255, 179, 28, 71, 255, 178, 27, 71, 255, 178, 27, 71, 255, 177, 27, 71, 255, 177, 26, 70, 255, 177, 26, 70, 255, 176, 25, 70, 255, 176, 25, 70, 255, 175, 24, 70, 255, 175, 24, 70, 255, 174, 23, 70, 255, 174, 23, 70, 255, 174, 23, 70, 255, 173, 22, 70, 255, 173, 22, 69, 255, 172, 21, 69, 255, 172, 21, 69, 255, 171, 20, 69, 255, 171, 20, 69, 255, 171, 19, 69, 255, 170, 19, 69, 255, 170, 18, 69, 255, 169, 18, 69, 255, 169, 17, 68, 255, 168, 17, 68, 255, 168, 16, 68, 255, 168, 16, 68, 255, 167, 15, 68, 255, 167, 14, 68, 255, 166, 14, 68, 255, 166, 13, 68, 255, 165, 13, 68, 255, 165, 12, 67, 255, 164, 12, 67, 255, 164, 11, 67, 255, 164, 10, 67, 255, 163, 10, 67, 255, 163, 9, 67, 255, 162, 8, 67, 255, 162, 7, 67, 255, 161, 7, 67, 255, 161, 6, 66, 255, 161, 5, 66, 255, 160, 5, 66, 255, 160, 4, 66, 255, 159, 3, 66, 255, 159, 2, 66, 255, 158, 2, 66, 255, 158, 1, 66, 255};
273 | static const heatmap_colorscheme_t cs_spectral_mixed = { mixed_data, sizeof(mixed_data)/sizeof(mixed_data[0])/4 };
274 | const heatmap_colorscheme_t* heatmap_cs_default = &cs_spectral_mixed;
275 |
276 |
--------------------------------------------------------------------------------
/libs/heatmap/heatmap.h:
--------------------------------------------------------------------------------
1 | /* heatmap - High performance heatmap creation in C.
2 | *
3 | * The MIT License (MIT)
4 | *
5 | * Copyright (c) 2013 Lucas Beyer
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 | * this software and associated documentation files (the "Software"), to deal in
9 | * the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 | * the Software, and to permit persons to whom the Software is furnished to do so,
12 | * subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | #ifndef _HEATMAP_H
26 | #define _HEATMAP_H
27 |
28 | /* Necessary for size_t */
29 | #include
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | /* Maybe make an opaque type out of this. But then again,
36 | * I'm assuming the users of this lib are not stupid here.
37 | * If you mess with the internals and things break, blame yourself.
38 | */
39 | typedef struct {
40 | float* buf; /* Contains the heat value of every heatmap pixel. */
41 | float max; /* The highest heat in the whole map. Used for normalization. */
42 | unsigned w, h; /* Pixel-dimension of the heatmap. */
43 | } heatmap_t;
44 |
45 | /* A stamp is "stamped" (added) onto the heatmap for every datapoint which
46 | * is seen. This is usually something spheric, but there are no limits to your
47 | * artistic freedom!
48 | */
49 | typedef struct {
50 | float* buf; /* The stampdata which is added onto the heatmap. */
51 | unsigned w, h; /* The size (in pixel) of the stamp. */
52 | } heatmap_stamp_t;
53 |
54 | /* A colorscheme is used to transform the heatmap's heat values (floats)
55 | * into an actual colorful heatmap.
56 | * Maybe counterintuitively, the coldest color comes first (stored at index 0)
57 | * and the hottest color comes last (stored at (ncolors-1)*4).
58 | * Note that one color is made up of FOUR chars, since it is RGBA.
59 | * You probably want the very first color to be (0,0,0,0) such that the heatmap
60 | * is transparent where there was no data and you can overlay it onto
61 | * another image, like a world map.
62 | */
63 | typedef struct {
64 | const unsigned char* colors; /* Color values in RGBA. */
65 | size_t ncolors; /* Amount of colors (not amount of bytes or array size). */
66 | } heatmap_colorscheme_t;
67 |
68 | /* Creates a new heatmap of given size. */
69 | heatmap_t* heatmap_new(unsigned w, unsigned h);
70 | /* Frees up all memory taken by the heatmap. */
71 | void heatmap_free(heatmap_t* h);
72 |
73 | /* Adds a single point to the heatmap using the default stamp. */
74 | void heatmap_add_point(heatmap_t* h, unsigned x, unsigned y);
75 | /* Adds a single point to the heatmap using a given stamp. */
76 | void heatmap_add_point_with_stamp(heatmap_t* h, unsigned x, unsigned y, const heatmap_stamp_t* stamp);
77 |
78 | /* Renders an image of the heatmap into the given colorbuf.
79 | *
80 | * colorbuf: A buffer large enough to hold 4*heatmap_width*heatmap_height
81 | * unsigned chars. These chars are the RGBA values of the pixels.
82 | *
83 | * If colorbuf is NULL, a new large enough buffer will be malloc'd.
84 | *
85 | * return: A pointer to the given colorbuf is returned. It is the caller's
86 | * responsibility to free that buffer. If no colorbuf is given (NULL),
87 | * a newly malloc'd buffer is returned. This buffer needs to be free'd
88 | * by the caller whenever it is not used anymore.
89 | */
90 | unsigned char* heatmap_render_default_to(const heatmap_t* h, unsigned char* colorbuf);
91 |
92 | /* Renders an RGB image of the heatmap into the given colorbuf,
93 | * using a given colorscheme.
94 | *
95 | * colorscheme: See the description of heatmap_colorscheme_t for more details.
96 | *
97 | * For details on the colorbuf and the return value, refer to the documentation
98 | * of `heatmap_render_default_to`.
99 | */
100 | unsigned char* heatmap_render_to(const heatmap_t* h, const heatmap_colorscheme_t* colorscheme, unsigned char* colorbuf);
101 |
102 | /* Renders an RGB image of the heatmap into the given colorbuf,
103 | * using a given colorscheme.
104 | *
105 | * colorscheme: See the description of heatmap_colorscheme_t for more details.
106 | *
107 | * saturation: The heatmap will be truncated at the given heat value, meaning
108 | * all spots hotter than `saturation` will be assigned the same
109 | * color as the hottest color on the scale.
110 | *
111 | * For details on the colorbuf and the return value, refer to the documentation
112 | * of `heatmap_render_default_to`.
113 | */
114 | unsigned char* heatmap_render_saturated_to(const heatmap_t* h, const heatmap_colorscheme_t* colorscheme, float saturation, unsigned char* colorbuf);
115 |
116 | /* Creates a new stamp COPYING the given w*h floats in data.
117 | *
118 | * w, h: The width/height of the stamp, in pixels.
119 | * data: exactly w*h float values which will be added to the heatmap centered
120 | * around every datapoint drawn onto the heatmap.
121 | *
122 | * For more information about stamps, read `heatmap_stamp_t`'s documentation.
123 | */
124 | heatmap_stamp_t* heatmap_stamp_load(unsigned w, unsigned h, float* data);
125 |
126 | /* Generates a default round stamp of a given radius. This means the stamp will
127 | * have a size of 2*radius+1 square. The default stamp is just a spherical
128 | * gradient around the center.
129 | *
130 | * For more information about stamps, read `heatmap_stamp_t`'s documentation.
131 | */
132 | heatmap_stamp_t* heatmap_stamp_gen(unsigned radius);
133 |
134 | /* Generates a stamp just like `heatmap_stamp_gen` but calls the given
135 | * `distshape` function in order to determine the value of every single pixel.
136 | *
137 | * distshape: Function which gets called for every pixel. The only argument
138 | * given to that function is the distance from the centre, 0 being
139 | * exactly on the centre and 1 being one-behind the radius.
140 | * One minus the returned value, clamped to [0,1] will be the
141 | * pixel's value.
142 | *
143 | * For more information about stamps, read `heatmap_stamp_t`'s documentation.
144 | */
145 | heatmap_stamp_t* heatmap_stamp_gen_nonlinear(unsigned radius, float (*distshape)(float));
146 |
147 | /* Frees up all memory taken by the stamp. */
148 | void heatmap_stamp_free(heatmap_stamp_t* s);
149 |
150 | /* Create a new colorscheme using a COPY of the given `ncolors` `colors`.
151 | *
152 | * colors: a buffer containing RGBA colors to use when rendering the heatmap.
153 | *
154 | * For more information about colorschemes, read `heatmap_colorscheme_t`'s
155 | * documentation.
156 | */
157 | heatmap_colorscheme_t* heatmap_colorscheme_load(const unsigned char* colors, size_t ncolors);
158 |
159 | /* Frees up all memory taken by the colorscheme. */
160 | void heatmap_colorscheme_free(heatmap_colorscheme_t* cs);
161 |
162 | extern const heatmap_colorscheme_t* heatmap_cs_default;
163 |
164 | #ifdef __cplusplus
165 | } /* extern "C" */
166 | #endif
167 |
168 | #ifdef __cplusplus
169 | /* C++ wrapper API, but TODO: is this even necessary? */
170 | namespace heatmap {
171 | }
172 | #endif
173 |
174 | #endif /* _HEATMAP_H */
175 |
176 |
--------------------------------------------------------------------------------
/ofxaddons_thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hideyukisaito/ofxHeatMap/50170a744a1b3a81a4f13acbe1c24ef5fe89c5db/ofxaddons_thumbnail.png
--------------------------------------------------------------------------------
/src/ofxHeatMap.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "ofMain.h"
4 | #include "heatmap.h"
5 | #include "colorschemes/Spectral.h"
6 | #include "colorschemes/gray.h"
7 | #include "colorschemes/Blues.h"
8 | #include "colorschemes/BrBG.h"
9 | #include "colorschemes/BuGn.h"
10 | #include "colorschemes/BuPu.h"
11 | #include "colorschemes/GnBu.h"
12 | #include "colorschemes/Greens.h"
13 | #include "colorschemes/Greys.h"
14 | #include "colorschemes/Oranges.h"
15 | #include "colorschemes/OrRd.h"
16 | #include "colorschemes/PiYG.h"
17 | #include "colorschemes/PRGn.h"
18 | #include "colorschemes/PuBuGn.h"
19 | #include "colorschemes/PuBu.h"
20 | #include "colorschemes/PuOr.h"
21 | #include "colorschemes/PuRd.h"
22 | #include "colorschemes/Purples.h"
23 | #include "colorschemes/RdBu.h"
24 | #include "colorschemes/RdGy.h"
25 | #include "colorschemes/RdPu.h"
26 | #include "colorschemes/RdYlBu.h"
27 | #include "colorschemes/RdYlGn.h"
28 | #include "colorschemes/Reds.h"
29 | #include "colorschemes/YlGnBu.h"
30 | #include "colorschemes/YlGn.h"
31 | #include "colorschemes/YlOrBr.h"
32 | #include "colorschemes/YlOrRd.h"
33 |
34 | /*
35 | * See color scheme examples here: http://lucasb.eyer.be/articles/colorschemes.html
36 | *
37 | */
38 |
39 | #define OFX_HEATMAP_CS_SPECTRAL heatmap_cs_Spectral_discrete
40 | #define OFX_HEATMAP_CS_SPECTRAL_SOFT heatmap_cs_Spectral_soft
41 | #define OFX_HEATMAP_CS_SPECTRAL_MIXED heatmap_cs_Spectral_mixed
42 | #define OFX_HEATMAP_CS_SPECTRAL_MIXED_EXP heatmap_cs_Spectral_mixed_exp
43 |
44 | #define OFX_HEATMAP_CS_RED_YELLOW_GREEN heatmap_cs_RdYlGn_discrete
45 | #define OFX_HEATMAP_CS_RED_YELLOW_GREEN_SOFT heatmap_cs_RdYlGn_soft
46 | #define OFX_HEATMAP_CS_RED_YELLOW_GREEN_MIXED heatmap_cs_RdYlGn_mixed
47 | #define OFX_HEATMAP_CS_RED_YELLOW_GREEN_MIXED_EXP heatmap_cs_RdYlGn_mixed_exp
48 |
49 | #define OFX_HEATMAP_CS_RED_YELLOW_BLUE heatmap_cs_RdYlBu_discrete
50 | #define OFX_HEATMAP_CS_RED_YELLOW_BLUE_SOFT heatmap_cs_RdYlBu_soft
51 | #define OFX_HEATMAP_CS_RED_YELLOW_BLUE_MIXED heatmap_cs_RdYlBu_mixed
52 | #define OFX_HEATMAP_CS_RED_YELLOW_BLUE_MIXED_EXP heatmap_cs_RdYlBu_mixed_exp
53 |
54 | #define OFX_HEATMAP_CS_RED_GRAY heatmap_cs_RdGy_discrete
55 | #define OFX_HEATMAP_CS_RED_GRAY_SOFT heatmap_cs_RdGy_soft
56 | #define OFX_HEATMAP_CS_RED_GRAY_MIXED heatmap_cs_RdGy_mixed
57 | #define OFX_HEATMAP_CS_RED_GRAY_MIXED_EXP heatmap_cs_RdGy_mixed_exp
58 |
59 | #define OFX_HEATMAP_CS_RED_BLUE heatmap_cs_RdBu_discrete
60 | #define OFX_HEATMAP_CS_RED_BLUE_SOFT heatmap_cs_RdBu_soft
61 | #define OFX_HEATMAP_CS_RED_BLUE_MIXED heatmap_cs_RdBu_mixed
62 | #define OFX_HEATMAP_CS_RED_BLUE_MIXED_EXP heatmap_cs_RdBu_mixed_exp
63 |
64 | #define OFX_HEATMAP_CS_PURPLE_ORANGE heatmap_cs_PuOr_discrete
65 | #define OFX_HEATMAP_CS_PURPLE_ORANGE_SOFT heatmap_cs_PuOr_soft
66 | #define OFX_HEATMAP_CS_PURPLE_ORANGE_MIXED heatmap_cs_PuOr_mixed
67 | #define OFX_HEATMAP_CS_PURPLE_ORANGE_MIXED_EXP heatmap_cs_PuOr_mixed_exp
68 |
69 | #define OFX_HEATMAP_CS_PURPLE_GREEN heatmap_cs_PRGn_discrete
70 | #define OFX_HEATMAP_CS_PURPLE_GREEN_SOFT heatmap_cs_PRGn_soft
71 | #define OFX_HEATMAP_CS_PURPLE_GREEN_MIXED heatmap_cs_PRGn_mixed
72 | #define OFX_HEATMAP_CS_PURPLE_GREEN_MIXED_EXP heatmap_cs_PRGn_mixed_exp
73 |
74 | #define OFX_HEATMAP_CS_PINK_YELLOWGREEN heatmap_cs_PiYG_discrete
75 | #define OFX_HEATMAP_CS_PINK_YELLOWGREEN_SOFT heatmap_cs_PiYG_soft
76 | #define OFX_HEATMAP_CS_PINK_YELLOWGREEN_MIXED heatmap_cs_PiYG_mixed
77 | #define OFX_HEATMAP_CS_PINK_YELLOWGREEN_MIXED_EXP heatmap_cs_PiYG_mixed_exp
78 |
79 | #define OFX_HEATMAP_CS_BROWN_BLUEGREEN heatmap_cs_BrBG_discrete
80 | #define OFX_HEATMAP_CS_BROWN_BLUEGREEN_SOFT heatmap_cs_BrBG_soft
81 | #define OFX_HEATMAP_CS_BROWN_BLUEGREEN_MIXED heatmap_cs_BrBG_mixed
82 | #define OFX_HEATMAP_CS_BROWN_BLUEGREEN_MIXED_EXP heatmap_cs_BrBG_discrete
83 |
84 | #define OFX_HEATMAP_CS_BLUES heatmap_cs_Blues_discrete
85 | #define OFX_HEATMAP_CS_BLUES_SOFT heatmap_cs_Blues_soft
86 | #define OFX_HEATMAP_CS_BLUES_MIXED heatmap_cs_Blues_mixed
87 | #define OFX_HEATMAP_CS_BLUES_MIXED_EXP heatmap_cs_Blues_mixed_exp
88 |
89 | #define OFX_HEATMAP_CS_GREENS heatmap_cs_Greens_discrete
90 | #define OFX_HEATMAP_CS_GREENS_SOFT heatmap_cs_Greens_soft
91 | #define OFX_HEATMAP_CS_GREENS_MIXED heatmap_cs_Greens_mixed
92 | #define OFX_HEATMAP_CS_GREENS_MIXED_EXP heatmap_cs_Greens_mixed_exp
93 |
94 | #define OFX_HEATMAP_CS_GRAYS heatmap_cs_Greys_discrete
95 | #define OFX_HEATMAP_CS_GRAYS_SOFT heatmap_cs_Greys_soft
96 | #define OFX_HEATMAP_CS_GRAYS_MIXED heatmap_cs_Greys_mixed
97 | #define OFX_HEATMAP_CS_GRAYS_MIXED_EXP heatmap_cs_Greys_mixed_exp
98 |
99 | #define OFX_HEATMAP_CS_ORANGES heatmap_cs_Oranges_discrete
100 | #define OFX_HEATMAP_CS_ORANGES_SOFT heatmap_cs_Oranges_soft
101 | #define OFX_HEATMAP_CS_ORANGES_MIXED heatmap_cs_Oranges_mixed
102 | #define OFX_HEATMAP_CS_ORANGES_MIXED_EXP heatmap_cs_Oranges_mixed_exp
103 |
104 | #define OFX_HEATMAP_CS_PURPLES heatmap_cs_Purples_discrete
105 | #define OFX_HEATMAP_CS_PURPLES_SOFT heatmap_cs_Purples_soft
106 | #define OFX_HEATMAP_CS_PURPLES_MIXED heatmap_cs_Purples_mixed
107 | #define OFX_HEATMAP_CS_PURPLES_MIXED_EXP heatmap_cs_Purples_mixed_exp
108 |
109 | #define OFX_HEATMAP_CS_REDS heatmap_cs_Reds_discrete
110 | #define OFX_HEATMAP_CS_REDS_SOFT heatmap_cs_Reds_soft
111 | #define OFX_HEATMAP_CS_REDS_MIXED heatmap_cs_Reds_mixed
112 | #define OFX_HEATMAP_CS_REDS_MIXED_EXP heatmap_cs_Reds_mixed_exp
113 |
114 | #define OFX_HEATMAP_CS_BLUE_GREEN heatmap_cs_BuGn_discrete
115 | #define OFX_HEATMAP_CS_BLUE_GREEN_SOFT heatmap_cs_BuGn_soft
116 | #define OFX_HEATMAP_CS_BLUE_GREEN_MIXED heatmap_cs_BuGn_mixed
117 | #define OFX_HEATMAP_CS_BLUE_GREEN_MIXED_EXP heatmap_cs_BuGn_mixed_exp
118 |
119 | #define OFX_HEATMAP_CS_BLUE_PURPLE heatmap_cs_BuPu_discrete
120 | #define OFX_HEATMAP_CS_BLUE_PURPLE_SOFT heatmap_cs_BuPu_soft
121 | #define OFX_HEATMAP_CS_BLUE_PURPLE_MIXED heatmap_cs_BuPu_mixed
122 | #define OFX_HEATMAP_CS_BLUE_PURPLE_MIXED_EXP heatmap_cs_BuPu_mixed_exp
123 |
124 | #define OFX_HEATMAP_CS_GREEN_BLUE heatmap_cs_GnBu_discrete
125 | #define OFX_HEATMAP_CS_GREEN_BLUE_SOFT heatmap_cs_GnBu_soft
126 | #define OFX_HEATMAP_CS_GREEN_BLUE_MIXED heatmap_cs_GnBu_mixed
127 | #define OFX_HEATMAP_CS_GREEN_BLUE_MIXED_EXP heatmap_cs_GnBu_mixed_exp
128 |
129 | #define OFX_HEATMAP_CS_ORANGE_RED heatmap_cs_OrRd_discrete
130 | #define OFX_HEATMAP_CS_ORANGE_RED_SOFT heatmap_cs_OrRd_soft
131 | #define OFX_HEATMAP_CS_ORANGE_RED_MIXED heatmap_cs_OrRd_mixed
132 | #define OFX_HEATMAP_CS_ORANGE_RED_MIXED_EXP heatmap_cs_OrRd_mixed_exp
133 |
134 | #define OFX_HEATMAP_CS_PURPLE_BLUE_GREEN heatmap_cs_PuBuGn_discrete
135 | #define OFX_HEATMAP_CS_PURPLE_BLUE_GREEN_SOFT heatmap_cs_PuBuGn_soft
136 | #define OFX_HEATMAP_CS_PURPLE_BLUE_GREEN_MIXED heatmap_cs_PuBuGn_mixed
137 | #define OFX_HEATMAP_CS_PURPLE_BLUE_GREEN_MIXED_EXP heatmap_cs_PuBuGn_mixed_exp
138 |
139 | #define OFX_HEATMAP_CS_PURPLE_BLUE heatmap_cs_PuBu_discrete
140 | #define OFX_HEATMAP_CS_PURPLE_BLUE_SOFT heatmap_cs_PuBu_soft
141 | #define OFX_HEATMAP_CS_PURPLE_BLUE_MIXED heatmap_cs_PuBu_mixed
142 | #define OFX_HEATMAP_CS_PURPLE_BLUE_MIXED_EXP heatmap_cs_PuBu_mixed_exp
143 |
144 | #define OFX_HEATMAP_CS_PURPLE_RED heatmap_cs_PuRd_discrete
145 | #define OFX_HEATMAP_CS_PURPLE_RED_SOFT heatmap_cs_PuRd_soft
146 | #define OFX_HEATMAP_CS_PURPLE_RED_MIXED heatmap_cs_PuRd_mixed
147 | #define OFX_HEATMAP_CS_PURPLE_RED_MIXED_EXP heatmap_cs_PuRd_mixed_exp
148 |
149 | #define OFX_HEATMAP_CS_RED_PURPLE heatmap_cs_RdPu_discrete
150 | #define OFX_HEATMAP_CS_RED_PURPLE_SOFT heatmap_cs_RdPu_soft
151 | #define OFX_HEATMAP_CS_RED_PURPLE_MIXED heatmap_cs_RdPu_mixed
152 | #define OFX_HEATMAP_CS_RED_PURPLE_MIXED_EXP heatmap_cs_RdPu_mixed_exp
153 |
154 | #define OFX_HEATMAP_CS_YELLOW_GREEN_BLUE heatmap_cs_YlGnBu_discrete
155 | #define OFX_HEATMAP_CS_YELLOW_GREEN_BLUE_SOFT heatmap_cs_YlGnBu_soft
156 | #define OFX_HEATMAP_CS_YELLOW_GREEN_BLUE_MIXED heatmap_cs_YlGnBu_mixed
157 | #define OFX_HEATMAP_CS_YELLOW_GREEN_BLUE_MIXED_EXP heatmap_cs_YlGnBu_mixed_exp
158 |
159 | #define OFX_HEATMAP_CS_YELLOW_GREEN heatmap_cs_YlGn_discrete
160 | #define OFX_HEATMAP_CS_YELLOW_GREEN_SOFT heatmap_cs_YlGn_soft
161 | #define OFX_HEATMAP_CS_YELLOW_GREEN_MIXED heatmap_cs_YlGn_mixed
162 | #define OFX_HEATMAP_CS_YELLOW_GREEN_MIXED_EXP heatmap_cs_YlGn_mixed_exp
163 |
164 | #define OFX_HEATMAP_CS_YELLOW_ORANGE_BROWN heatmap_cs_YlOrBr_discrete
165 | #define OFX_HEATMAP_CS_YELLOW_ORANGE_BROWN_SOFT heatmap_cs_YlOrBr_soft
166 | #define OFX_HEATMAP_CS_YELLOW_ORANGE_BROWN_MIXED heatmap_cs_YlOrBr_mixed
167 | #define OFX_HEATMAP_CS_YELLOW_ORANGE_BROWN_MIXED_EXP heatmap_cs_YlOrBr_mixed_exp
168 |
169 | #define OFX_HEATMAP_CS_BLACK_TO_WHITE heatmap_cs_b2w
170 | #define OFX_HEATMAP_CS_BLACK_TO_WHITE_OPAQUE heatmap_cs_b2w_opaque
171 | #define OFX_HEATMAP_CS_WHITE_TO_BLACK heatmap_cs_w2b
172 | #define OFX_HEATMAP_CS_WHITE_TO_BLACK_OPAQUE heatmap_cs_w2b_opaque
173 |
174 | #define OFX_HEATMAP_DEFAULT_WIDTH 512
175 | #define OFX_HEATMAP_DEFAULT_HEIGHT 512
176 |
177 | class ofxHeatMap
178 | {
179 | public:
180 | ofxHeatMap()
181 | {
182 | setup(OFX_HEATMAP_DEFAULT_WIDTH, OFX_HEATMAP_DEFAULT_HEIGHT);
183 | }
184 |
185 | ofxHeatMap(unsigned int w, unsigned int h)
186 | {
187 | setup(w, h);
188 | }
189 |
190 | ofxHeatMap(const ofxHeatMap &mom)
191 | {
192 | mHeatMap = mom.mHeatMap;
193 | mColorScheme = mom.mColorScheme;
194 | mStamp = mom.mStamp;
195 | mHeatMapImg = mom.mHeatMapImg;
196 | mRadius = mom.mRadius;
197 | }
198 |
199 | ofxHeatMap & operator=(const ofxHeatMap &mom)
200 | {
201 | mHeatMap = mom.mHeatMap;
202 | mColorScheme = mom.mColorScheme;
203 | mStamp = mom.mStamp;
204 | mHeatMapImg = mom.mHeatMapImg;
205 | mRadius = mom.mRadius;
206 | }
207 |
208 | ~ofxHeatMap()
209 | {
210 | heatmap_free(mHeatMap);
211 | heatmap_stamp_free(mStamp);
212 | mHeatMapImg.clear();
213 | }
214 |
215 | void setup(unsigned int w, unsigned int h, unsigned int radius = 16)
216 | {
217 | mHeatMap = heatmap_new(w, h);
218 | mColorScheme = const_cast(heatmap_cs_default);
219 | mColorBuf.resize(mHeatMap->w * mHeatMap->h * 4);
220 | mRadius = radius;
221 |
222 | mStamp = heatmap_stamp_gen(mRadius);
223 | }
224 |
225 | void update()
226 | {
227 | update(heatmap_cs_default);
228 | }
229 |
230 | void update(const heatmap_colorscheme_t* colorscheme)
231 | {
232 | heatmap_render_to(mHeatMap, colorscheme, &mColorBuf[0]);
233 | mHeatMapImg.setFromPixels(&mColorBuf[0], mHeatMap->w, mHeatMap->h, OF_IMAGE_COLOR_ALPHA);
234 | mColorBuf.clear();
235 | }
236 |
237 | void draw()
238 | {
239 | draw(0, 0);
240 | }
241 |
242 | void draw(int x, int y)
243 | {
244 | if (!mHeatMapImg.isAllocated()) {
245 | return;
246 | }
247 |
248 | mHeatMapImg.draw(x, y);
249 | }
250 |
251 | void addPoint(unsigned int x, unsigned int y)
252 | {
253 | heatmap_add_point_with_stamp(mHeatMap, x, y, mStamp);
254 | }
255 |
256 | void setRadius(unsigned int radius)
257 | {
258 | mRadius = radius;
259 | mStamp = heatmap_stamp_gen(mRadius);
260 | }
261 |
262 | void setColorScheme(const heatmap_colorscheme_t * colorScheme)
263 | {
264 | mColorScheme = const_cast(colorScheme);
265 | }
266 |
267 | int getWidth()
268 | {
269 | return mHeatMap->w;
270 | }
271 |
272 | int getHeight()
273 | {
274 | return mHeatMap->h;
275 | }
276 |
277 | void clear()
278 | {
279 | heatmap_free(mHeatMap);
280 | heatmap_stamp_free(mStamp);
281 | mHeatMapImg.clear();
282 | mColorBuf.clear();
283 | std::vector().swap(mColorBuf);
284 | }
285 |
286 | void save(std::string name = "heatmap-" + ofGetTimestampString() + ".png")
287 | {
288 | if (ofFilePath::getFileExt(name).empty()) {
289 | name += ".png";
290 | }
291 |
292 | mHeatMapImg.save(name);
293 | }
294 |
295 | ofImage & getImage()
296 | {
297 | return mHeatMapImg;
298 | }
299 |
300 |
301 | private:
302 | heatmap_t * mHeatMap;
303 | heatmap_colorscheme_t * mColorScheme;
304 | heatmap_stamp_t *mStamp;
305 | ofImage mHeatMapImg;
306 | std::vector mColorBuf;
307 | unsigned int mRadius;
308 | };
--------------------------------------------------------------------------------