Mode test SVG

This commit is contained in:
Edouard Dupin 2012-03-26 18:18:00 +02:00
parent 1162c5f6e8
commit fb6392be3e
20 changed files with 128 additions and 37 deletions

3
assets/05_circle.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red"/>
</svg>

After

Width:  |  Height:  |  Size: 139 B

3
assets/06_ellipse.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<ellipse cx="300" cy="80" rx="100" ry="50" style="fill:yellow;stroke:purple;stroke-width:2"/>
</svg>

After

Width:  |  Height:  |  Size: 157 B

5
assets/07_ellipse.svg Normal file
View File

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<ellipse cx="240" cy="100" rx="220" ry="30" style="fill:purple"/>
<ellipse cx="220" cy="70" rx="190" ry="20" style="fill:lime"/>
<ellipse cx="210" cy="45" rx="170" ry="15" style="fill:yellow"/>
</svg>

After

Width:  |  Height:  |  Size: 258 B

4
assets/08_ellipse.svg Normal file
View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<ellipse cx="240" cy="50" rx="220" ry="30" style="fill:yellow"/>
<ellipse cx="220" cy="50" rx="190" ry="20" style="fill:white"/>
</svg>

After

Width:  |  Height:  |  Size: 193 B

3
assets/09_line.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<line x1="0" y1="0" x2="200" y2="200" style="stroke:rgb(255,0,0);stroke-width:2"/>
</svg>

After

Width:  |  Height:  |  Size: 145 B

3
assets/10_polygon.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<polygon points="200,10 250,190 160,210" style="fill:lime;stroke:purple;stroke-width:1"/>
</svg>

After

Width:  |  Height:  |  Size: 153 B

3
assets/11_polygon.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<polygon points="220,10 300,210 170,250 123,234" style="fill:lime;stroke:purple;stroke-width:1"/>
</svg>

After

Width:  |  Height:  |  Size: 161 B

3
assets/12_polygon.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<polygon points="100,10 40,180 190,60 10,60 160,180" style="fill:lime;stroke:purple;stroke-width:5;fill-rule:nonzero;" />
</svg>

After

Width:  |  Height:  |  Size: 184 B

3
assets/13_polygon.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<polygon points="100,10 40,180 190,60 10,60 160,180" style="fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;" />
</svg>

After

Width:  |  Height:  |  Size: 184 B

3
assets/14_polyline.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<polyline points="20,20 40,25 60,40 80,120 120,140 200,180" style="fill:none;stroke:black;stroke-width:3" />
</svg>

After

Width:  |  Height:  |  Size: 171 B

3
assets/15_polyline.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<polyline points="0,40 40,40 40,80 80,80 80,120 120,120 120,160" style="fill:white;stroke:red;stroke-width:4"/>
</svg>

After

Width:  |  Height:  |  Size: 175 B

3
assets/16_path.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<path d="M150 0 L75 200 L225 200 Z" />
</svg>

After

Width:  |  Height:  |  Size: 101 B

18
assets/17_path.svg Normal file
View File

@ -0,0 +1,18 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<path id="lineAB" d="M 100 350 l 150 -300" stroke="red" stroke-width="3" fill="none" />
<path id="lineBC" d="M 250 50 l 150 300" stroke="red" stroke-width="3" fill="none" />
<path id="lineBC" d="M 175 200 l 150 0" stroke="red" stroke-width="3" fill="none" />
<path id="quadcurveABC" d="M 100 350 q 150 -300 300 0" stroke="blue" stroke-width="5" fill="none" />
<!-- Mark relevant points -->
<g stroke="black" stroke-width="3" fill="black">
<circle id="pointA" cx="100" cy="350" r="3" />
<circle id="pointB" cx="250" cy="50" r="3" />
<circle id="pointC" cx="400" cy="350" r="3" />
</g>
<!-- Label the points -->
<g font-size="30" font="sans-serif" fill="black" stroke="none" text-anchor="middle">
<text x="100" y="350" dx="-30">A</text>
<text x="250" y="50" dy="-10">B</text>
<text x="400" y="350" dx="30">C</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 901 B

3
assets/18_text.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<text x="0" y="15" fill="red">I love SVG</text>
</svg>

After

Width:  |  Height:  |  Size: 110 B

3
assets/19_text.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<text x="0" y="15" fill="red" transform="rotate(30 20,40)">I love SVG</text>
</svg>

After

Width:  |  Height:  |  Size: 139 B

8
assets/20_text.svg Normal file
View File

@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<path id="path1" d="M75,20 a1,1 0 0,0 100,0" />
</defs>
<text x="10" y="100" style="fill:red;">
<textPath xlink:href="#path1">I love SVG I love SVG</textPath>
</text>
</svg>

After

Width:  |  Height:  |  Size: 286 B

6
assets/21_text.svg Normal file
View File

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<text x="10" y="20" style="fill:red;">Several lines:
<tspan x="10" y="45">First line</tspan>
<tspan x="10" y="70">Second line</tspan>
</text>
</svg>

After

Width:  |  Height:  |  Size: 210 B

5
assets/22_text.svg Normal file
View File

@ -0,0 +1,5 @@
<svg version="1.1">
<a xlink:href="http://www.w3schools.com/svg/" target="_blank">
<text x="0" y="15" fill="red">I love SVG</text>
</a>
</svg>

After

Width:  |  Height:  |  Size: 146 B

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="15cm" height="15cm">
<svg width="15cm" height="15cm">
<g transform="rotate(10) scale (1) translate (100,10)">
<polygon fill="#f2cc99" points=" 69,18 82,8 99,3 118,5 135,12 149,21 156,13 165,9 177,13 183,28 180,50 164,91 155,107 154,114 151,121 141,127 139,136 155,206 157,251 126,342 133,357 128,376 83,376 75,368 67,350 61,350 53,369 4,369 2,361 5,354 12,342 16,321 4,257 4,244 7,218 9,179 26,127 43,93 32,77 30,70 24,67 16,49 17,35 18,23 30,12 40,7 53,7 62,12"/>
<polygon fill="#e5b27f" points=" 142,79 136,74 138,82 133,78 133,84 127,78 128,85 124,80 125,87 119,82 119,90 125,99 125,96 128,100 128,94 131,98 132,93 135,97 136,93 138,97 139,94 141,98 143,94 144,85"/>

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -397,6 +397,36 @@ class MainWindows :public ewol::Windows
static MainWindows * basicWindows = NULL;
const char * listTestSVG[] = {
"lion.svg",
"01_rectangle.svg",
"02_rectangle.svg",
"03_rectangle.svg",
"04_rectangle.svg",
"05_circle.svg",
"06_ellipse.svg",
"07_ellipse.svg",
"08_ellipse.svg",
"09_line.svg",
"10_polygon.svg",
"11_polygon.svg",
"12_polygon.svg",
"13_polygon.svg",
"14_polyline.svg",
"15_polyline.svg",
"16_path.svg",
"17_path.svg",
/*
// not supported in basic realease ...
"18_text.svg",
"19_text.svg",
"20_text.svg",
"21_text.svg",
"22_text.svg",
*/
NULL
};
/**
* @brief main application function Initialisation
*/
@ -447,42 +477,22 @@ void APP_Init(void)
// create the specific windows
ewol::DisplayWindows(basicWindows);
DRAW_INFO("==> Init Ewol Drawer (END)");
etk::File svgFile("lion.svg", etk::FILE_TYPE_DATA);
svg::Parser *mySVGElement = new svg::Parser(svgFile);
//mySVGElement->DisplayDebug();
mySVGElement->GenerateTestFile();
etk::File svgFile;
svg::Parser *mySVGElement = NULL;
etk::UString tmpString;
/*
tmpString = "H2g2.svg";
svgFile.SetCompleateName(tmpString, etk::FILE_TYPE_DATA);
mySVGElement = new svg::Parser(svgFile);
mySVGElement->GenerateTestFile();
*/
tmpString = "01_rectangle.svg";
svgFile.SetCompleateName(tmpString, etk::FILE_TYPE_DATA);
mySVGElement = new svg::Parser(svgFile);
mySVGElement->DisplayDebug();
mySVGElement->GenerateTestFile();
tmpString = "02_rectangle.svg";
svgFile.SetCompleateName(tmpString, etk::FILE_TYPE_DATA);
mySVGElement = new svg::Parser(svgFile);
mySVGElement->DisplayDebug();
mySVGElement->GenerateTestFile();
tmpString = "03_rectangle.svg";
svgFile.SetCompleateName(tmpString, etk::FILE_TYPE_DATA);
mySVGElement = new svg::Parser(svgFile);
mySVGElement->DisplayDebug();
mySVGElement->GenerateTestFile();
tmpString = "04_rectangle.svg";
svgFile.SetCompleateName(tmpString, etk::FILE_TYPE_DATA);
mySVGElement = new svg::Parser(svgFile);
mySVGElement->DisplayDebug();
mySVGElement->GenerateTestFile();
for(int32_t iii=0; listTestSVG[iii]!=NULL; iii++) {
tmpString = listTestSVG[iii];
svgFile.SetCompleateName(tmpString, etk::FILE_TYPE_DATA);
mySVGElement = new svg::Parser(svgFile);
if (NULL != mySVGElement) {
mySVGElement->DisplayDebug();
mySVGElement->GenerateTestFile();
delete(mySVGElement);
}
}
exit(-1);
}