examples: updated SVG samples.

increase the canvas to afford more resources.
This commit is contained in:
Hermet Park 2023-05-16 11:08:38 +09:00 committed by Hermet Park
parent 2cfa5505c3
commit 41c41b538d
7 changed files with 74 additions and 31 deletions

View file

@ -27,8 +27,10 @@
using namespace std; using namespace std;
#define WIDTH 800 static uint32_t WIDTH = 800;
#define HEIGHT 800 static uint32_t HEIGHT = 800;
static uint32_t* buffer = nullptr;
/************************************************************************/ /************************************************************************/
/* Common Infrastructure Code */ /* Common Infrastructure Code */
@ -39,12 +41,16 @@ void drawSwView(void* data, Eo* obj);
void win_del(void *data, Evas_Object *o, void *ev) void win_del(void *data, Evas_Object *o, void *ev)
{ {
free(buffer);
elm_exit(); elm_exit();
} }
static Eo* createSwView() static Eo* createSwView(uint32_t w = 800, uint32_t h = 800)
{ {
static uint32_t buffer[WIDTH * HEIGHT]; WIDTH = w;
HEIGHT = h;
buffer = static_cast<uint32_t*>(malloc(w * h * sizeof(uint32_t)));
Eo* win = elm_win_util_standard_add(NULL, "ThorVG Test"); Eo* win = elm_win_util_standard_add(NULL, "ThorVG Test");
evas_object_smart_callback_add(win, "delete,request", win_del, 0); evas_object_smart_callback_add(win, "delete,request", win_del, 0);
@ -70,8 +76,11 @@ static Eo* createSwView()
void initGLview(Evas_Object *obj); void initGLview(Evas_Object *obj);
void drawGLview(Evas_Object *obj); void drawGLview(Evas_Object *obj);
static Eo* createGlView() static Eo* createGlView(uint32_t w = 800, uint32_t h = 800)
{ {
WIDTH = w;
HEIGHT = h;
elm_config_accel_preference_set("gl"); elm_config_accel_preference_set("gl");
Eo* win = elm_win_util_standard_add(NULL, "ThorVG Test"); Eo* win = elm_win_util_standard_add(NULL, "ThorVG Test");

View file

@ -31,9 +31,9 @@ using namespace std;
/************************************************************************/ /************************************************************************/
/* Drawing Commands */ /* Drawing Commands */
/************************************************************************/ /************************************************************************/
#define WIDTH 800 #define WIDTH 1024
#define HEIGHT 800 #define HEIGHT 1024
#define NUM_PER_LINE 5 #define NUM_PER_LINE 7
#define SIZE (WIDTH/NUM_PER_LINE) #define SIZE (WIDTH/NUM_PER_LINE)
static size_t counter = 0; static size_t counter = 0;

View file

@ -28,7 +28,7 @@
/************************************************************************/ /************************************************************************/
#define NUM_PER_LINE 16 #define NUM_PER_LINE 16
#define SIZE 50 #define SIZE 80
static bool rendered = false; static bool rendered = false;
static int xCnt = 0; static int xCnt = 0;
@ -235,10 +235,10 @@ int main(int argc, char **argv)
Elm_Transit *transit = elm_transit_add(); Elm_Transit *transit = elm_transit_add();
if (tvgEngine == tvg::CanvasEngine::Sw) { if (tvgEngine == tvg::CanvasEngine::Sw) {
auto view = createSwView(); auto view = createSwView(1280, 1280);
elm_transit_effect_add(transit, transitSwCb, view, nullptr); elm_transit_effect_add(transit, transitSwCb, view, nullptr);
} else { } else {
auto view = createGlView(); auto view = createGlView(1280, 1280);
elm_transit_effect_add(transit, transitGlCb, view, nullptr); elm_transit_effect_add(transit, transitGlCb, view, nullptr);
} }

View file

@ -28,7 +28,7 @@
/************************************************************************/ /************************************************************************/
#define NUM_PER_ROW 7 #define NUM_PER_ROW 7
#define NUM_PER_COL 6 #define NUM_PER_COL 7
#define SIZE (WIDTH/NUM_PER_ROW) #define SIZE (WIDTH/NUM_PER_ROW)
static int counter = 0; static int counter = 0;
@ -186,9 +186,9 @@ int main(int argc, char **argv)
elm_init(argc, argv); elm_init(argc, argv);
if (tvgEngine == tvg::CanvasEngine::Sw) { if (tvgEngine == tvg::CanvasEngine::Sw) {
createSwView(); createSwView(1280, 1280);
} else { } else {
createGlView(); createGlView(1280, 1280);
} }
elm_run(); elm_run();

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="858px" height="245px" viewBox="0 0 858 245" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 53.2 (72643) - https://sketchapp.com -->
<title>lf_Logo</title>
<desc>Created with Sketch.</desc>
<defs>
<linearGradient x1="0.260883299%" y1="10.3043172%" x2="95.3936038%" y2="72.4618806%" id="linearGradient-1">
<stop stop-color="#2BEAED" offset="0%"></stop>
<stop stop-color="#0FCCCE" offset="100%"></stop>
</linearGradient>
</defs>
<g id="lf_Logo" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Logo" transform="translate(39.607873, 43.766155)">
<rect id="Rectangle" fill="url(#linearGradient-1)" fill-rule="nonzero" x="0" y="0" width="156.235102" height="156.644295" rx="12.6881879"></rect>
<path d="M119.051594,30.8255039 C123.336947,31.4603785 126.294995,35.4543174 125.662603,39.744408 C125.030002,44.0359205 121.043533,47.0033043 116.756754,46.3682183 C109.165831,45.2436237 97.7937371,57.0646985 85.0619695,81.3710892 C68.8082808,112.401227 53.679639,127.185853 37.7520893,126.00602 C33.4315183,125.685974 30.1904166,121.918243 30.5091961,117.5931 C30.8280292,113.267228 34.5875305,110.01692 38.9088326,110.33702 C46.7741162,110.91964 58.3269568,98.5949648 71.1726655,74.0710477 C87.5303275,42.8424127 102.86428,28.4273547 119.051594,30.8255039 Z" id="path" fill="#FFFFFF" fill-rule="nonzero"></path>
<g id="text" transform="translate(193.071020, 29.291210)">
<path d="M0.254040816,94.2412834 L0.254040816,3.82059257 L18.4179592,3.82059257 L18.4179592,78.3221477 L58.3023673,78.3221477 L58.3023673,94.2412834 L0.254040816,94.2412834 Z M98.6948571,95.3874611 C78.8796735,95.3874611 65.669551,81.760681 65.669551,63.1671305 C65.669551,44.57358 78.8796735,31.0741529 98.6948571,31.0741529 C118.001959,31.0741529 131.593143,44.0641676 131.593143,63.1671305 C131.593143,82.1427402 118.001959,95.3874611 98.6948571,95.3874611 Z M98.6948571,80.359797 C107.586286,80.359797 114.699429,73.3553773 114.699429,63.1671305 C114.699429,52.9788836 107.840327,45.9744639 98.6948571,45.9744639 C89.0413061,45.9744639 82.5632653,53.3609429 82.5632653,63.1671305 C82.5632653,72.845965 89.1683265,80.359797 98.6948571,80.359797 Z M160.680816,95.3874611 C150.011102,95.3874611 143.02498,88.6377476 143.02498,74.6289082 L143.02498,45.8471108 L135.657796,45.8471108 L135.657796,31.9656245 L143.02498,31.9656245 L143.02498,11.7164839 L159.664653,9.93354068 L159.664653,31.9656245 L176.431347,31.9656245 L176.431347,45.8471108 L159.664653,45.8471108 L159.664653,72.2091995 C159.664653,77.6853822 161.061878,80.2324439 164.99951,80.2324439 C167.031837,80.2324439 170.080327,79.4683254 172.874776,78.0674415 L177.066449,91.4395155 C173.128816,93.6045179 169.064163,95.3874611 160.680816,95.3874611 Z M207.551347,95.3874611 C196.881633,95.3874611 189.89551,88.6377476 189.89551,74.6289082 L189.89551,45.8471108 L182.528327,45.8471108 L182.528327,31.9656245 L189.89551,31.9656245 L189.89551,11.7164839 L206.535184,9.93354068 L206.535184,31.9656245 L223.301878,31.9656245 L223.301878,45.8471108 L206.535184,45.8471108 L206.535184,72.2091995 C206.535184,77.6853822 207.932408,80.2324439 211.870041,80.2324439 C213.902367,80.2324439 216.950857,79.4683254 219.745306,78.0674415 L223.93698,91.4395155 C219.999347,93.6045179 215.934694,95.3874611 207.551347,95.3874611 Z M244.514286,23.5603208 C238.417306,23.5603208 233.971592,18.9756098 233.971592,13.2447209 C233.971592,7.64118514 238.417306,3.05647405 244.514286,3.05647405 C250.484245,3.05647405 255.05698,7.64118514 255.05698,13.2447209 C255.05698,18.9756098 250.484245,23.5603208 244.514286,23.5603208 Z M236.003918,94.2412834 L236.003918,31.9656245 L252.643592,31.9656245 L252.643592,94.2412834 L236.003918,94.2412834 Z M323.902041,62.530365 C323.902041,64.5680144 323.648,67.4971354 323.52098,68.5159601 L279.95298,68.5159601 C281.985306,76.0297921 287.955265,80.4871501 296.338612,80.4871501 C303.324735,80.4871501 308.15151,77.5580291 311.454041,73.4827304 L322.250776,83.5436242 C317.042939,90.2933377 309.040653,95.3874611 295.195429,95.3874611 C276.142367,95.3874611 262.678204,82.5247995 262.678204,63.0397774 C262.678204,44.0641676 275.761306,31.0741529 294.179265,31.0741529 C311.708082,31.0741529 323.902041,44.3188738 323.902041,62.530365 Z M294.052245,45.5924046 C287.320163,45.5924046 281.985306,49.4129972 280.08,56.54477 L307.389388,56.54477 C305.738122,49.9224096 301.292408,45.5924046 294.052245,45.5924046 Z" id="lottie" fill="#18C8CA"></path>
<path d="M335.841959,94.2412834 L335.841959,3.82059257 L395.668571,3.82059257 L395.668571,19.7397283 L353.497796,19.7397283 L353.497796,43.9368145 L388.682449,43.9368145 L388.682449,59.9833033 L353.497796,59.9833033 L353.497796,94.2412834 L335.841959,94.2412834 Z M418.024163,23.5603208 C411.927184,23.5603208 407.481469,18.9756098 407.481469,13.2447209 C407.481469,7.64118514 411.927184,3.05647405 418.024163,3.05647405 C423.994122,3.05647405 428.566857,7.64118514 428.566857,13.2447209 C428.566857,18.9756098 423.994122,23.5603208 418.024163,23.5603208 Z M409.513796,94.2412834 L409.513796,31.9656245 L426.153469,31.9656245 L426.153469,94.2412834 L409.513796,94.2412834 Z M439.744653,94.2412834 L439.744653,0.509412342 L456.384327,0.509412342 L456.384327,94.2412834 L439.744653,94.2412834 Z M527.642776,62.530365 C527.642776,64.5680144 527.388735,67.4971354 527.261714,68.5159601 L483.693714,68.5159601 C485.726041,76.0297921 491.696,80.4871501 500.079347,80.4871501 C507.065469,80.4871501 511.892245,77.5580291 515.194776,73.4827304 L525.99151,83.5436242 C520.783673,90.2933377 512.781388,95.3874611 498.936163,95.3874611 C479.883102,95.3874611 466.418939,82.5247995 466.418939,63.0397774 C466.418939,44.0641676 479.502041,31.0741529 497.92,31.0741529 C515.448816,31.0741529 527.642776,44.3188738 527.642776,62.530365 Z M497.79298,45.5924046 C491.060898,45.5924046 485.726041,49.4129972 483.820735,56.54477 L511.130122,56.54477 C509.478857,49.9224096 505.033143,45.5924046 497.79298,45.5924046 Z M560.668082,95.3874611 C550.76049,95.3874611 542.250122,92.0762809 535.518041,86.218039 L543.520327,74.6289082 C548.601143,79.3409723 553.936,81.760681 560.795102,81.760681 C565.621878,81.760681 568.289306,79.7230316 568.289306,76.6665575 C568.289306,73.9921427 565.113796,72.5912588 557.11151,69.916844 C546.822857,66.4783107 537.931429,61.6388934 537.931429,49.5403503 C537.931429,38.3332788 547.58498,31.0741529 560.414041,31.0741529 C568.924408,31.0741529 575.910531,33.3665084 583.023673,38.8426911 L574.894367,51.1959404 C570.194612,46.6112293 564.605714,44.57358 560.03298,44.57358 C557.492571,44.57358 554.190041,45.8471108 554.190041,49.158291 C554.190041,51.7053528 557.238531,53.488296 563.33551,55.7806515 C576.799673,60.7474218 584.674939,63.6765428 584.674939,76.0297921 C584.674939,86.9821575 576.926694,95.3874611 560.668082,95.3874611 Z" id="files" fill="#006B78"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.9 KiB

View file

@ -0,0 +1,28 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="flag-icons-eu" viewBox="0 0 640 480">
<defs>
<g id="d">
<g id="b">
<path id="a" d="m0-1-.3 1 .5.1z"/>
<use xlink:href="#a" transform="scale(-1 1)"/>
</g>
<g id="c">
<use xlink:href="#b" transform="rotate(72)"/>
<use xlink:href="#b" transform="rotate(144)"/>
</g>
<use xlink:href="#c" transform="scale(-1 1)"/>
</g>
</defs>
<path fill="#039" d="M0 0h640v480H0z"/>
<g fill="#fc0" transform="translate(320 242.3) scale(23.7037)">
<use xlink:href="#d" width="100%" height="100%" y="-6"/>
<use xlink:href="#d" width="100%" height="100%" y="6"/>
<g id="e">
<use xlink:href="#d" width="100%" height="100%" x="-6"/>
<use xlink:href="#d" width="100%" height="100%" transform="rotate(-144 -2.3 -2.1)"/>
<use xlink:href="#d" width="100%" height="100%" transform="rotate(144 -2.1 -2.3)"/>
<use xlink:href="#d" width="100%" height="100%" transform="rotate(72 -4.7 -2)"/>
<use xlink:href="#d" width="100%" height="100%" transform="rotate(72 -5 .5)"/>
</g>
<use xlink:href="#e" width="100%" height="100%" transform="scale(-1 1)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -1,16 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" id="OpenSearchicon" viewBox="0 0 100 100">
<defs>
<linearGradient x1="0.085" y1="0.085" x2="0.915" y2="0.915" id="OpenSearchg">
<stop offset="0" stop-color="#1417cc" stop-opacity="1"/>
<stop offset="0.5" stop-color="#1517cc" stop-opacity="0"/>
<stop offset="1" stop-color="#1517cc" stop-opacity="1"/>
</linearGradient>
</defs>
<g transform="scale(0.39)">
<rect width="256" height="256" rx="55" ry="55" x="0" y="0" fill="#1517cc"/>
<rect width="246" height="246" rx="50" ry="50" x="5" y="5" fill="#5252f4"/>
<rect width="236" height="236" rx="45" ry="45" x="10" y="10" fill="url(#OpenSearchg)"/>
<path fill="none" stroke="#fff" stroke-width="26" d="M 178 103 A 74 74 0 1 1 30,103 A 74 74 0 1 1 178 103 z" transform="matrix(0.918696,0,0,0.918696,4.331024,5.50348)"/>
<rect fill="#fff" stroke="none" width="102.33237" height="39.089138" x="211.87753" y="-19.544645" transform="matrix(0.707107,0.707107,-0.707107,0.707107,0,0)"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1,023 B