summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-07-06 11:16:44 +0200
committerKonstantin Käfer <mail@kkaefer.com>2015-07-08 19:46:02 +0200
commit62ac43a85bac29bed4a1c93bab592e6bdaf2838b (patch)
treefb936aa4d124674a12a9aa4755e469db5fb811e7 /include
parentb2a3314192a8a1dc06e0677e1430219dd8655cf0 (diff)
downloadqtlocation-mapboxgl-62ac43a85bac29bed4a1c93bab592e6bdaf2838b.tar.gz
add ability to add random custom markers to test app
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/annotation/sprite_image.hpp40
-rw-r--r--include/mbgl/platform/default/glfw_view.hpp4
2 files changed, 44 insertions, 0 deletions
diff --git a/include/mbgl/annotation/sprite_image.hpp b/include/mbgl/annotation/sprite_image.hpp
new file mode 100644
index 0000000000..7d8ea0501c
--- /dev/null
+++ b/include/mbgl/annotation/sprite_image.hpp
@@ -0,0 +1,40 @@
+#ifndef MBGL_ANNOTATIONS_SPRITE_IMAGE
+#define MBGL_ANNOTATIONS_SPRITE_IMAGE
+
+#include <mbgl/util/noncopyable.hpp>
+#include <mbgl/util/geo.hpp>
+
+#include <string>
+#include <memory>
+#include <cstdint>
+
+namespace mbgl {
+
+class SpriteImage : private util::noncopyable {
+public:
+ SpriteImage(
+ uint16_t width, uint16_t height, float pixelRatio, std::string&& data, bool sdf = false);
+
+ // Logical dimensions of the sprite image.
+ const uint16_t width;
+ const uint16_t height;
+
+ // Pixel ratio of the sprite image.
+ const float pixelRatio;
+
+ // Physical dimensions of the sprite image.
+ const uint16_t pixelWidth;
+ const uint16_t pixelHeight;
+
+ // A string of an RGBA8 representation of the sprite. It must have exactly
+ // (width * ratio) * (height * ratio) * 4 (RGBA) bytes. The scan lines may
+ // not have gaps between them (i.e. stride == 0).
+ const std::string data;
+
+ // Whether this image should be interpreted as a signed distance field icon.
+ const bool sdf;
+};
+
+}
+
+#endif
diff --git a/include/mbgl/platform/default/glfw_view.hpp b/include/mbgl/platform/default/glfw_view.hpp
index cb40db1248..f65565c030 100644
--- a/include/mbgl/platform/default/glfw_view.hpp
+++ b/include/mbgl/platform/default/glfw_view.hpp
@@ -46,14 +46,18 @@ public:
private:
mbgl::LatLng makeRandomPoint() const;
+ static std::shared_ptr<const mbgl::SpriteImage>
+ makeSpriteImage(int width, int height, float pixelRatio);
void addRandomPointAnnotations(int count);
void addRandomShapeAnnotations(int count);
+ void addRandomCustomPointAnnotations(int count);
void clearAnnotations();
void popAnnotation();
mbgl::AnnotationIDs annotationIDs;
+ std::vector<std::string> spriteIDs;
private:
bool fullscreen = false;