Add path rendering.
This commit is contained in:
parent
f2ab532005
commit
97afa782a0
39 changed files with 1148 additions and 131 deletions
|
@ -0,0 +1,33 @@
|
|||
#include "MediaResourceManager.h"
|
||||
|
||||
#include "SvgReader.h"
|
||||
#include "SvgDocument.h"
|
||||
#include "SvgNode.h"
|
||||
|
||||
const Path MediaResourceManager::mResourceLocation = "C:\\dev\\MediaResources";
|
||||
|
||||
Path MediaResourceManager::getSvgIconPath(Resource::Icon::Svg icon)
|
||||
{
|
||||
return mResourceLocation / MediaResources::getPath(icon);
|
||||
}
|
||||
|
||||
std::unique_ptr<AbstractVisualNode> MediaResourceManager::getSvgIconNode(Resource::Icon::Svg icon)
|
||||
{
|
||||
const auto path = getSvgIconPath(icon);
|
||||
|
||||
if (path.empty())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SvgReader svg_reader;
|
||||
auto svg_doc = svg_reader.read(path);
|
||||
if (!svg_doc)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto svg_node = std::make_unique<SvgNode>(Point(0.0, 0.0));
|
||||
svg_node->setContent(std::move(svg_doc));
|
||||
return std::move(svg_node);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue