Advertisement
j0h

svg.h

j0h
May 27th, 2022
981
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.60 KB | None | 0 0
  1. /* svg.h*/
  2. /*
  3.  * A simple svg header for c++
  4.  * */
  5. #ifndef  _svg_h
  6. #define _svg_h
  7. #include <iostream>
  8. using namespace std;
  9. void SVGhead(){
  10. cout << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n";
  11. cout << "<svg\n ";
  12. cout << " xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n";
  13. cout << " xmlns:cc=\"http://creativecommons.org/ns#\"\n";
  14. cout <<" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
  15. cout << " xmlns:svg=\"http://www.w3.org/2000/svg\"\n";
  16. cout << " xmlns=\"http://www.w3.org/2000/svg\"\n";
  17. cout << " id=\"svg8\"\n";
  18. cout << " version=\"1.1\"\n";
  19. cout << " viewBox=\"0 0 300 300\"\n";
  20. cout << " height=\"100%\"\n";
  21. cout << " width=\"100%\">\n";
  22.     }
  23.    
  24. void circle(int x,int y,int r){ //x,y,radius
  25.     cout <<" <circle cx=\""<< x << "\" ";
  26.      cout <<" cy=\"" << y << "\" ";
  27.      cout <<" r=\""<< r << "\" ";
  28.      cout << " stroke=\"red\" ";
  29.      cout << " stroke-width=\"0.1\" ";
  30.      cout << " fill=\"none\" />" ;
  31.     }
  32. void square(int x,int y,int side){ // x,y,side
  33.     cout << " <rect \n";
  34.     cout << "   style=\"fill:#f8ff30; \n";
  35.     cout << "   fill-opacity:0;\n";
  36.     cout << "  stroke:#ff0000;\n";
  37.     cout << "   stroke-width:0.26458333;\n";
  38.     cout << "  stroke-miterlimit:4;\n";
  39.     cout << "stroke-dasharray:none;\n";
  40.     cout << "stroke-opacity:1\n";
  41.        //cout << "id=\"rect815\"\n";
  42.        cout << "width=\""<< side<< "\" \n";
  43.        cout << "height=\""<< side<<"\"\n";
  44.        cout << "x=\""<< x <<"\"\n";
  45.        cout << "y=\"" <<  y <<"\"\n";
  46.         cout  << "/>\n";
  47.  
  48. }
  49. void SVGend(){
  50.         cout << "</svg>" << endl;        //end svg
  51.     }  
  52.  
  53. #endif
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement