Browse Source

Add Svg::draw() convenience method.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
b90177811b
2 changed files with 7 additions and 0 deletions
  1. +1
    -0
      include/svg.hpp
  2. +6
    -0
      src/svg.cpp

+ 1
- 0
include/svg.hpp View File

@@ -18,6 +18,7 @@ struct Svg {
void loadFile(const std::string& filename); void loadFile(const std::string& filename);
/** Loads SVG data from a string. */ /** Loads SVG data from a string. */
void loadString(const std::string& str); void loadString(const std::string& str);
void draw(NVGcontext* vg);


/** Loads Svg from a cache. */ /** Loads Svg from a cache. */
static std::shared_ptr<Svg> load(const std::string& filename); static std::shared_ptr<Svg> load(const std::string& filename);


+ 6
- 0
src/svg.cpp View File

@@ -41,6 +41,12 @@ void Svg::loadString(const std::string& str) {
} }




void Svg::draw(NVGcontext* vg) {
svgDraw(vg, handle);
}



static std::map<std::string, std::weak_ptr<Svg>> svgCache; static std::map<std::string, std::weak_ptr<Svg>> svgCache;






Loading…
Cancel
Save