Geometrize 1.0
C++ library for geometrizing images into geometric primitives
svgexporter.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string>
5#include <vector>
6
7#include "../bitmap/rgba.h"
8
9namespace geometrize
10{
11class Shape;
12struct ShapeResult;
13}
14
15namespace geometrize
16{
17
18namespace exporter
19{
20
24static const std::string SVG_STYLE_HOOK = "::svg_style_hook::";
25
27{
28 ELLIPSE_ITEM = 0, // Export as a translated, rotated and scaled svg <ellipse>. OpenFL's SVG library can't handle this
29 POLYGON = 1 // Export as a <polygon>, OpenFL's SVG library can handle this, but it looks quite ugly
30};
31
36{
38 std::size_t itemId{ 0 }; // Id to tag the exported SVG shapes with
39};
40
48std::string getSingleShapeSVGData(const geometrize::rgba& color, const geometrize::Shape& shape, SVGExportOptions options = SVGExportOptions{});
49
59std::string exportSingleShapeSVG(const geometrize::rgba& color, const geometrize::Shape& shape, const std::uint32_t width, const std::uint32_t height, SVGExportOptions options = SVGExportOptions{});
60
69std::string exportSVG(const std::vector<geometrize::ShapeResult>& data, const std::uint32_t width, const std::uint32_t height, SVGExportOptions options = SVGExportOptions{});
70
71}
72
73}
Definition: shape.h:18
std::string getSingleShapeSVGData(const geometrize::rgba &color, const geometrize::Shape &shape, SVGExportOptions options)
getSvgShapeData Gets the SVG data for a single shape. This is just the <rect>/<path> etc block for th...
Definition: svgexporter.cpp:240
std::string exportSingleShapeSVG(const geometrize::rgba &color, const geometrize::Shape &shape, const std::uint32_t width, const std::uint32_t height, SVGExportOptions options)
exportSVG Exports a single shape as a complete SVG image.
Definition: svgexporter.cpp:245
static const std::string SVG_STYLE_HOOK
SVG_STYLE_HOOK A hook that an SVG exporter should use to augment shape styling produced by the getSvg...
Definition: svgexporter.h:24
std::string exportSVG(const std::vector< geometrize::ShapeResult > &data, const std::uint32_t width, const std::uint32_t height, SVGExportOptions options)
exportSVG Exports shape data as a complete SVG image.
Definition: svgexporter.cpp:261
RotatedEllipseSVGExportMode
Definition: svgexporter.h:27
Definition: bitmap.cpp:8
The SVGExportOptions struct represents the options that can be set for the SVG export.
Definition: svgexporter.h:36
std::size_t itemId
Definition: svgexporter.h:38
RotatedEllipseSVGExportMode rotatedEllipseExportMode
Definition: svgexporter.h:37
The rgba struct is a helper for manipulating RGBA8888 color data.
Definition: rgba.h:13