sammycage / lunasvg

SVG rendering and manipulation library in C++
MIT License
866 stars 124 forks source link

[Feature] support 'rgba()' #24

Closed lwyj123 closed 3 years ago

lwyj123 commented 3 years ago

I find when I using document.loadFromData, I get a wrong fill when using rgba().

int main() {
  // ...
  lunasvg::SVGDocument document;
  document.loadFromData(base64_decoded); // base64_decodede: "<svg xmlns='http://www.w3.org/2000/svg' fill='rgba(255,123,123,1)'><path d='M0 0L375 0L375 88L0 88L0 0Z' /></svg>"

  std::cout << document.toString() << std::endl; // I got: "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" style=\"fill:#000000;\">\n\t<path d=\"M0 0 L375 0 375 88 0 88 0 0 Z\"/>\n</svg>\n"
}

Can lunasvg support the rgba and rgb the same as modern browser behavior (like Chrome, Fireox...).

sammycage commented 3 years ago

Maybe in the future... As of now, I will stick to svg 1.1 features

lwyj123 commented 3 years ago

Ok, Thanks for your answer, I will fork and modified that part of code for my project usage.