summaryrefslogtreecommitdiff
path: root/src/mbgl/util/tiny_sdf.hpp
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2017-07-07 13:31:53 -0700
committerChris Loer <chris.loer@mapbox.com>2017-12-18 12:17:22 -0800
commit2e3e88f0276bb6b6ade009549d8927f4af96bdd9 (patch)
tree2569b055d89c7875045869de287e4394af5a4467 /src/mbgl/util/tiny_sdf.hpp
parent9c1dfe46cf39147ebe25a98eb0603828d4e8c61d (diff)
downloadqtlocation-mapboxgl-2e3e88f0276bb6b6ade009549d8927f4af96bdd9.tar.gz
[core] C++ port of TinySDF
Diffstat (limited to 'src/mbgl/util/tiny_sdf.hpp')
-rw-r--r--src/mbgl/util/tiny_sdf.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mbgl/util/tiny_sdf.hpp b/src/mbgl/util/tiny_sdf.hpp
new file mode 100644
index 0000000000..33c9280cbd
--- /dev/null
+++ b/src/mbgl/util/tiny_sdf.hpp
@@ -0,0 +1,20 @@
+#pragma once
+
+#include <mbgl/util/image.hpp>
+
+namespace mbgl {
+namespace util {
+
+/*
+ C++ port of https://github.com/mapbox/tiny-sdf, which is in turn based on the
+ Felzenszwalb/Huttenlocher distance transform paper (https://cs.brown.edu/~pff/papers/dt-final.pdf).
+ Note there exists an alternative C++ implementation from the paper’s authors at
+ https://cs.brown.edu/~pff/dt/, which this implementation is not based on.
+
+ Takes an alpha channel raster input and transforms it into an alpha channel
+ Signed Distance Field (SDF) output of the same dimensions.
+*/
+AlphaImage transformRasterToSDF(const AlphaImage& rasterInput, double radius, double cutoff);
+
+} // namespace util
+} // namespace mbgl