Displays svg files located in "./svgs" dir.
Change-Id: I4b9a281dc31fefb28c969780fa28adb74a5f5c02
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100">
+ <a xlink:href="http://www.tbray.org/ongoing/When/200x/2004/01/11/PostelPilgrim">
+ <path d="M10,15c10,10,10,0,40,0c30,0,30,10,40,0q-10,30-40,30q-30,0-40-30"
+ stroke="black" fill="red"/>
+ <ellipse stroke="black" fill="white" cx="50" cy="40" rx="22" ry="35"/>
+ <circle cx="50" cy="40" r="5" stroke="black" fill="red"/>
+ <circle cx="48" cy="38" r="1" fill="white"/>
+ <path d="M35,45C40,75,60,75,65,45Q50,60,35,45Z"
+ stroke="red" stroke-width="2" stroke-linejoin="round"/>
+ <circle cx="40" cy="30" r="2"/>
+ <circle cx="60" cy="30" r="2"/>
+ <path d="M35,30q5-10,10,0q-5-30-10,0" stroke="black" fill="none"/>
+ <path d="M55,30q5-10,10,0q-5-30-10,0" stroke="black" fill="none"/>
+ </a>
+</svg>
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" stroke-linejoin="round" viewBox="0 0 100 100">
+ <path d="M50,4L4,50L50,96L96,50Z" stroke="#FE4" stroke-width="3"/>
+ <path d="M50,5L5,50L50,95L95,50Z" stroke="#333" fill="#FE4" stroke-width="3"/>
+ <g transform="scale(0.8) translate(14,30)">
+ <path d="M37,42c-1,0,11-20,13-20c1,0,15,20,13,20h-9c0,8,9,22,12,25l-4,4l-8,-7v13h-10v-35z" stroke="#CA0" fill="#CA0"/>
+ <path d="M35,40c-1,0,11-20,13-20c1,0,15,20,13,20h-9c0,8,9,22,12,25l-4,4l-8,-7v13h-10v-35z" stroke="#333" fill="#555"/>
+ </g>
+ <g transform="translate(50,26) scale(0.25)" stroke-width="2">
+ <g fill="none">
+ <ellipse stroke="#469" rx="6" ry="44"/>
+ <ellipse stroke="#ba5" rx="6" ry="44" transform="rotate(-66)"/>
+ <ellipse stroke="#68c" rx="6" ry="44" transform="rotate(66)"/>
+ <circle stroke="#331" r="44"/>
+ </g>
+ <g fill="#689" stroke="#FE4">
+ <circle fill="#80a3cf" r="13"/>
+ <circle cy="-44" r="9"/>
+ <circle cx="-40" cy="18" r="9"/>
+ <circle cx="40" cy="18" r="9"/>
+ </g>
+ </g>
+</svg>
+
--- /dev/null
+<svg viewBox='0 0 104 97' xmlns='http://www.w3.org/2000/svg'>
+ <path d='M14,85l3,9h72c0,0,5-9,4-10c-2-2-79,0-79,1' fill='#7C4E32'/>
+ <path d='M19,47c0,0-9,7-13,14c-5,6,3,7,3,7l1,14c0,0,10,8,23,8c14,0,26,1,28,0c2-1,9-2,9-4c1-1,27,1,27-9c0-10,7-20-11-29c-17-9-67-1-67-1' fill='#E30000'/>
+ <path d='M17,32c-3,48,80,43,71-3 l-35-15' fill='#FFE1C4'/>
+ <path d="M17,32c9-36,61-32,71-3c-20-9-40-9-71,3" fill="#8ED8F8"/>
+ <path d='M54,35a10 8 60 1 1 0,0.1zM37,38a10 8 -60 1 1 0,0.1z' fill='#FFF'/>
+ <path d='M41,6c1-1,4-3,8-3c3-0,9-1,14,3l-1,2h-2h-2c0,0-3,1-5,0c-2-1-1-1-1-1l-3,1l-2-1h-1c0,0-1,2-3,2c0,0-2-1-2-3M17,34l0-2c0,0,35-20,71-3v2c0,0-35-17-71,3M5,62c3-2,5-2,8,0c3,2,13,6,8,11c-2,2-6,0-8,0c-1,1-4,2-6,1c-4-3-6-8-2-12M99,59c0,0-9-2-11,4l-3,5c0,1-2,3,3,3c5,0,5,2,7,2c3,0,7-1,7-4c0-4-1-11-3-10' fill='#FFF200'/>
+ <path d='M56,78v1M55,69v1M55,87v1' stroke='#000' stroke-linecap='round'/>
+ <path d='M60,36a1 1 0 1 1 0-0.1M49,36a1 1 0 1 1 0-0.1M57,55a2 3 0 1 1 0-0.1M12,94c0,0,20-4,42,0c0,0,27-4,39,0z'/>
+ <path d='M50,59c0,0,4,3,10,0M56,66l2,12l-2,12M25,50c0,0,10,12,23,12c13,0,24,0,35-15' fill='none' stroke='#000' stroke-width='0.5'/>
+</svg>
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" >
+ <g transform="translate(50,50)">
+ <path d="M38,-1h12v2h-12zM-38-1h-12v2h12z"/>
+ <path d="M40,-1h8v2h-8zM-40-1h-8v2h8z" transform="rotate(30)"/>
+ <path d="M40,-1h8v2h-8zM-40-1h-8v2h8z" transform="rotate(60)"/>
+ <path d="M38,-1h12v2h-12zM-38-1h-12v2h12z" transform="rotate(90)"/>
+ <path d="M40,-1h8v2h-8zM-40-1h-8v2h8z" transform="rotate(120)"/>
+ <path d="M40,-1h8v2h-8zM-40-1h-8v2h8z" transform="rotate(150)"/>
+ <path d="M-0.5,0v-35h1v35z"/>
+ <path d="M0,-0.75h30v1.5h-30z"/>
+ <path d="M0,-0.75h30v1.5h-30z" transform="rotate(-30)" fill="#F88"/>
+ <path d="M25-12A28,28 0,0,1 28-2m-0.3,0l-1-2h2z" stroke-width="1" stroke-linejoin="round" stroke="#F00" fill="#F00"/>
+ <circle r="2"/>
+ </g>
+</svg>
--- /dev/null
+<?xml version="1.0" standalone="no"?>
+<svg width="200" height="250" version="1.1" xmlns="http://www.w3.org/2000/svg">
+
+ <rect x="10" y="10" width="30" height="30" stroke="black" fill="transparent" stroke-width="5"/>
+ <rect x="60" y="10" rx="10" ry="10" width="30" height="30" stroke="black" fill="transparent" stroke-width="5"/>
+
+ <circle cx="25" cy="75" r="20" stroke="red" fill="transparent" stroke-width="5"/>
+ <ellipse cx="75" cy="75" rx="20" ry="5" stroke="red" fill="transparent" stroke-width="5"/>
+
+ <line x1="10" x2="50" y1="110" y2="150" stroke="orange" stroke-width="5"/>
+ <polyline points="60 110 65 120 70 115 75 130 80 125 85 140 90 135 95 150 100 145"
+ stroke="orange" fill="transparent" stroke-width="5"/>
+
+ <polygon points="50 160 55 180 70 180 60 190 65 205 50 195 35 205 40 190 30 180 45 180"
+ stroke="green" fill="transparent" stroke-width="5"/>
+
+ <path d="M20,230 Q40,205 50,230 T90,230" fill="none" stroke="blue" stroke-width="5"/>
+</svg>
static uint32_t buffer[WIDTH * HEIGHT];
-void tvgtest()
-{
- //Initialize ThorVG Engine
- tvg::Initializer::init(tvg::CanvasEngine::Sw);
+unique_ptr<tvg::SwCanvas> canvas = nullptr;
+int count = 0;
+static const int numberPerLine = 3;
+
+static int x = 30;
+static int y = 30;
- //Create a Canvas
- auto canvas = tvg::SwCanvas::gen();
- canvas->target(buffer, WIDTH, WIDTH, HEIGHT);
- // Create a SVG scene, request the original size,
+void svgDirCallback(const char* name, const char* path, void* data)
+{
auto scene = tvg::Scene::gen();
- scene->load("sample.svg");
+ char buf[255];
+ sprintf(buf,"%s/%s", path, name);
+ scene->load(buf);
+ printf("SVG Load : %s\n", buf);
+ scene->translate(((WIDTH - (x * 2)) / numberPerLine) * (count % numberPerLine) + x, ((HEIGHT - (y * 2))/ numberPerLine) * (int)((float)count / (float)numberPerLine) + y);
canvas->push(move(scene));
-
- canvas->draw();
- canvas->sync();
-
- //Terminate ThorVG Engine
- tvg::Initializer::term(tvg::CanvasEngine::Sw);
+ count++;
}
-void win_del(void *data, Evas_Object *o, void *ev)
+
+void win_del(void* data, Evas_Object* o, void* ev)
{
elm_exit();
}
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
- tvgtest();
+ //Initialize ThorVG Engine
+ tvg::Initializer::init(tvg::CanvasEngine::Sw);
+
+ //Create a Canvas
+ canvas = tvg::SwCanvas::gen();
+ canvas->target(buffer, WIDTH, WIDTH, HEIGHT);
+
+ //Draw white background
+ auto scene = tvg::Scene::gen();
+ auto shape1 = tvg::Shape::gen();
+ shape1->appendRect(0, 0, WIDTH, HEIGHT, 0);
+ shape1->fill(255, 255, 255, 255);
+ scene->push(move(shape1));
+ canvas->push(move(scene));
+
+ eina_file_dir_list("./svgs", EINA_TRUE, svgDirCallback, NULL);
+
+ canvas->draw();
+ canvas->sync();
//Show the result using EFL...
elm_init(argc, argv);
elm_run();
elm_shutdown();
+
+ //Terminate ThorVG Engine
+ tvg::Initializer::term(tvg::CanvasEngine::Sw);
}