the SpriteImage constructor signature changes from
SpriteImage(
uint16_t width, uint16_t height, float pixelRatio,
std::string&& data, bool sdf = false);
to
SpriteImage(PremultipliedImage&&, float pixelRatio, bool sdf = false)
18 lines
571 B
C++
18 lines
571 B
C++
#include <mbgl/text/shaping.hpp>
|
|
#include <mbgl/layer/symbol_layer.hpp>
|
|
|
|
namespace mbgl {
|
|
|
|
PositionedIcon shapeIcon(const SpriteAtlasElement& image, const SymbolLayoutProperties& layout) {
|
|
float dx = layout.icon.offset.value[0];
|
|
float dy = layout.icon.offset.value[1];
|
|
float x1 = dx - image.spriteImage->getWidth() / 2.0f;
|
|
float x2 = x1 + image.spriteImage->getWidth();
|
|
float y1 = dy - image.spriteImage->getHeight() / 2.0f;
|
|
float y2 = y1 + image.spriteImage->getHeight();
|
|
|
|
return PositionedIcon(image, y1, y2, x1, x2);
|
|
}
|
|
|
|
} // namespace mbgl
|