I am trying to edit the JUCE demo to draw a specific SVG but I get error:
jassert (isValidXmlName (tagName));
void createSVGDrawable()
{
lastSVGLoadTime = Time::getCurrentTime();
MemoryInputStream iconsFileStream (BinaryData::icons_zip, BinaryData::icons_zipSize, false);
ZipFile icons (&iconsFileStream, false);
// Load a random SVG file from our embedded icons.zip file.
const ScopedPointer<InputStream> svgFileStream (icons.createStreamForEntry (Random::getSystemRandom().nextInt (icons.getNumEntries())));
if (svgFileStream != nullptr)
{
svgDrawable = dynamic_cast<DrawableComposite*> (Drawable::createFromSVG(juce::XmlElement("D:/Desktop/media-playback-pause.svg")));
if (svgDrawable != nullptr)
{
// to make our icon the right size, we'll set its bounding box to the size and position that we want.
svgDrawable->setBoundingBox (RelativeParallelogram (Point<float> (-100, -100),
Point<float> (100, -100),
Point<float> (-100, 100)));
}
}
}
You can’t create an XmlElement from a file path. Instead, create an XmlDocument object representing your file and then use the XmlDocument::getDocumentElement() method to get the main document node.