mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
test: revise sample.
this patch adds the showcase how to handle exceptional cases. Change-Id: Ic8e3c740bbf613f4dccace511b6c8d93b987a10c
This commit is contained in:
parent
4bc0b584f3
commit
61cb144122
19 changed files with 187 additions and 144 deletions
|
@ -13,8 +13,7 @@ bool tvgUpdateCmds(tvg::Canvas* canvas)
|
||||||
auto t = ecore_time_get();
|
auto t = ecore_time_get();
|
||||||
|
|
||||||
//Explicitly clear all retained paint nodes.
|
//Explicitly clear all retained paint nodes.
|
||||||
if (canvas->clear() != tvg::Result::Success)
|
if (canvas->clear() != tvg::Result::Success) {
|
||||||
{
|
|
||||||
//Logically wrong! Probably, you missed to call sync() before.
|
//Logically wrong! Probably, you missed to call sync() before.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +44,10 @@ bool tvgUpdateCmds(tvg::Canvas* canvas)
|
||||||
fill->colorStops(colorStops, 3);
|
fill->colorStops(colorStops, 3);
|
||||||
shape->fill(move(fill));
|
shape->fill(move(fill));
|
||||||
|
|
||||||
canvas->push(move(shape));
|
if (canvas->push(move(shape)) != tvg::Result::Success) {
|
||||||
|
//Did you call clear()? Make it sure if canvas is on rendering
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t3 = ecore_time_get();
|
t3 = ecore_time_get();
|
||||||
|
@ -72,7 +74,7 @@ Eina_Bool animSwCb(void* data)
|
||||||
if (!tvgUpdateCmds(swCanvas.get())) return ECORE_CALLBACK_RENEW;
|
if (!tvgUpdateCmds(swCanvas.get())) return ECORE_CALLBACK_RENEW;
|
||||||
|
|
||||||
//Drawing task can be performed asynchronously.
|
//Drawing task can be performed asynchronously.
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() != tvg::Result::Success) return false;
|
||||||
|
|
||||||
//Update Efl Canvas
|
//Update Efl Canvas
|
||||||
Eo* img = (Eo*) data;
|
Eo* img = (Eo*) data;
|
||||||
|
|
|
@ -12,19 +12,19 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape1 = tvg::Shape::gen();
|
auto shape1 = tvg::Shape::gen();
|
||||||
shape1->appendRect(0, 0, 400, 400, 50); //x, y, w, h, cornerRadius
|
shape1->appendRect(0, 0, 400, 400, 50); //x, y, w, h, cornerRadius
|
||||||
shape1->fill(0, 255, 0, 255); //r, g, b, a
|
shape1->fill(0, 255, 0, 255); //r, g, b, a
|
||||||
canvas->push(move(shape1));
|
if (canvas->push(move(shape1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Prepare Circle
|
//Prepare Circle
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
shape2->appendCircle(400, 400, 200, 200); //cx, cy, radiusW, radiusH
|
shape2->appendCircle(400, 400, 200, 200); //cx, cy, radiusW, radiusH
|
||||||
shape2->fill(170, 170, 0, 170); //r, g, b, a
|
shape2->fill(170, 170, 0, 170); //r, g, b, a
|
||||||
canvas->push(move(shape2));
|
if (canvas->push(move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Prepare Ellipse
|
//Prepare Ellipse
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
shape3->appendCircle(400, 400, 250, 100); //cx, cy, radiusW, radiusH
|
shape3->appendCircle(400, 400, 250, 100); //cx, cy, radiusW, radiusH
|
||||||
shape3->fill(100, 100, 100, 100); //r, g, b, a
|
shape3->fill(100, 100, 100, 100); //r, g, b, a
|
||||||
canvas->push(move(shape3));
|
if (canvas->push(move(shape3)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Prepare Star
|
//Prepare Star
|
||||||
auto shape4 = tvg::Shape::gen();
|
auto shape4 = tvg::Shape::gen();
|
||||||
|
@ -40,13 +40,13 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape4->lineTo(146, 343);
|
shape4->lineTo(146, 343);
|
||||||
shape4->close();
|
shape4->close();
|
||||||
shape4->fill(200, 0, 200, 200);
|
shape4->fill(200, 0, 200, 200);
|
||||||
canvas->push(move(shape4));
|
if (canvas->push(move(shape4)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Prepare Opaque Ellipse
|
//Prepare Opaque Ellipse
|
||||||
auto shape5 = tvg::Shape::gen();
|
auto shape5 = tvg::Shape::gen();
|
||||||
shape5->appendCircle(600, 650, 200, 150);
|
shape5->appendCircle(600, 650, 200, 150);
|
||||||
shape5->fill(0, 0, 255, 255);
|
shape5->fill(0, 0, 255, 255);
|
||||||
canvas->push(move(shape5));
|
if (canvas->push(move(shape5)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,9 +71,10 @@ void tvgSwTest(uint32_t* buffer)
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -109,9 +110,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -12,31 +12,31 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape1 = tvg::Shape::gen();
|
auto shape1 = tvg::Shape::gen();
|
||||||
shape1->appendRect(-100, -100, 1000, 1000, 50);
|
shape1->appendRect(-100, -100, 1000, 1000, 50);
|
||||||
shape1->fill(255, 255, 255, 255);
|
shape1->fill(255, 255, 255, 255);
|
||||||
canvas->push(move(shape1));
|
if (canvas->push(move(shape1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Prepare Shape2
|
//Prepare Shape2
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
shape2->appendRect(-100, -100, 250, 250, 50);
|
shape2->appendRect(-100, -100, 250, 250, 50);
|
||||||
shape2->fill(0, 0, 255, 255);
|
shape2->fill(0, 0, 255, 255);
|
||||||
canvas->push(move(shape2));
|
if (canvas->push(move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Prepare Shape3
|
//Prepare Shape3
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
shape3->appendRect(500, 500, 550, 550, 0);
|
shape3->appendRect(500, 500, 550, 550, 0);
|
||||||
shape3->fill(0, 255, 255, 255);
|
shape3->fill(0, 255, 255, 255);
|
||||||
canvas->push(move(shape3));
|
if (canvas->push(move(shape3)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Prepare Shape4
|
//Prepare Shape4
|
||||||
auto shape4 = tvg::Shape::gen();
|
auto shape4 = tvg::Shape::gen();
|
||||||
shape4->appendCircle(800, 100, 200, 200);
|
shape4->appendCircle(800, 100, 200, 200);
|
||||||
shape4->fill(255, 255, 0, 255);
|
shape4->fill(255, 255, 0, 255);
|
||||||
canvas->push(move(shape4));
|
if (canvas->push(move(shape4)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Prepare Shape5
|
//Prepare Shape5
|
||||||
auto shape5 = tvg::Shape::gen();
|
auto shape5 = tvg::Shape::gen();
|
||||||
shape5->appendCircle(200, 650, 250, 200);
|
shape5->appendCircle(200, 650, 250, 200);
|
||||||
shape5->fill(0, 0, 0, 255);
|
shape5->fill(0, 0, 0, 255);
|
||||||
canvas->push(move(shape5));
|
if (canvas->push(move(shape5)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -60,9 +60,10 @@ void tvgSwTest(uint32_t* buffer)
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -98,9 +99,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -26,7 +26,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape->lineTo(-53, -5.5);
|
shape->lineTo(-53, -5.5);
|
||||||
shape->close();
|
shape->close();
|
||||||
shape->fill(0, 0, 255, 255);
|
shape->fill(0, 0, 255, 255);
|
||||||
canvas->push(move(shape));
|
if (canvas->push(move(shape)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||||
|
@ -107,9 +107,10 @@ void transitSwCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progre
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -145,9 +146,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void transitGlCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
|
void transitGlCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape->stroke(0, 0, 255, 255);
|
shape->stroke(0, 0, 255, 255);
|
||||||
shape->stroke(1);
|
shape->stroke(1);
|
||||||
|
|
||||||
canvas->push(move(shape));
|
if (canvas->push(move(shape)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||||
|
@ -30,14 +30,15 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||||
You can update only necessary properties of this shape,
|
You can update only necessary properties of this shape,
|
||||||
while retaining other properties. */
|
while retaining other properties. */
|
||||||
|
|
||||||
pShape->reset(); //reset path
|
//Reset Shape
|
||||||
|
if (pShape->reset() == tvg::Result::Success) {
|
||||||
pShape->appendRect(-100 + (800 * progress), -100 + (800 * progress), 200, 200, (100 * progress));
|
pShape->appendRect(-100 + (800 * progress), -100 + (800 * progress), 200, 200, (100 * progress));
|
||||||
pShape->stroke(30 * progress);
|
pShape->stroke(30 * progress);
|
||||||
|
|
||||||
//Update shape for drawing (this may work asynchronously)
|
//Update shape for drawing (this may work asynchronously)
|
||||||
canvas->update(pShape);
|
canvas->update(pShape);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -71,9 +72,10 @@ void transitSwCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progre
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -109,9 +111,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void transitGlCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
|
void transitGlCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
fill->colorStops(colorStops, 3);
|
fill->colorStops(colorStops, 3);
|
||||||
shape->fill(move(fill));
|
shape->fill(move(fill));
|
||||||
shape->translate(385, 400);
|
shape->translate(385, 400);
|
||||||
canvas->push(move(shape));
|
if (canvas->push(move(shape)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Shape2
|
//Shape2
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
|
@ -53,7 +53,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
|
|
||||||
fill2->colorStops(colorStops2, 2);
|
fill2->colorStops(colorStops2, 2);
|
||||||
shape2->fill(move(fill2));
|
shape2->fill(move(fill2));
|
||||||
canvas->push(move(shape2));
|
if (canvas->push(move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Shape3
|
//Shape3
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
|
@ -78,7 +78,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
|
|
||||||
shape3->fill(move(fill3));
|
shape3->fill(move(fill3));
|
||||||
shape3->translate(400, 400);
|
shape3->translate(400, 400);
|
||||||
canvas->push(move(shape3));
|
if (canvas->push(move(shape3)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||||
|
@ -92,17 +92,17 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||||
pShape->rotate(360 * progress);
|
pShape->rotate(360 * progress);
|
||||||
|
|
||||||
//Update shape for drawing (this may work asynchronously)
|
//Update shape for drawing (this may work asynchronously)
|
||||||
canvas->update(pShape);
|
if (canvas->update(pShape) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Update Shape2
|
//Update Shape2
|
||||||
pShape2->rotate(360 * progress);
|
pShape2->rotate(360 * progress);
|
||||||
pShape2->translate(400 + progress * 300, 400);
|
pShape2->translate(400 + progress * 300, 400);
|
||||||
canvas->update(pShape2);
|
if (canvas->update(pShape2) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Update Shape3
|
//Update Shape3
|
||||||
pShape3->rotate(-360 * progress);
|
pShape3->rotate(-360 * progress);
|
||||||
pShape3->scale(0.5 + progress);
|
pShape3->scale(0.5 + progress);
|
||||||
canvas->update(pShape3);
|
if (canvas->update(pShape3) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,9 +137,10 @@ void transitSwCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progre
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -175,9 +176,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void transitGlCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
|
void transitGlCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
fill->colorStops(colorStops, 2);
|
fill->colorStops(colorStops, 2);
|
||||||
|
|
||||||
shape1->fill(move(fill));
|
shape1->fill(move(fill));
|
||||||
canvas->push(move(shape1));
|
if (canvas->push(move(shape1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Prepare Circle
|
//Prepare Circle
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
|
@ -43,7 +43,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
fill2->colorStops(colorStops2, 3);
|
fill2->colorStops(colorStops2, 3);
|
||||||
|
|
||||||
shape2->fill(move(fill2));
|
shape2->fill(move(fill2));
|
||||||
canvas->push(move(shape2));
|
if (canvas->push(move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
|
|
||||||
//Prepare Ellipse
|
//Prepare Ellipse
|
||||||
|
@ -64,7 +64,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
fill3->colorStops(colorStops3, 4);
|
fill3->colorStops(colorStops3, 4);
|
||||||
|
|
||||||
shape3->fill(move(fill3));
|
shape3->fill(move(fill3));
|
||||||
canvas->push(move(shape3));
|
if (canvas->push(move(shape3)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,9 +89,10 @@ void tvgSwTest(uint32_t* buffer)
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -127,9 +128,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -12,19 +12,19 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape1 = tvg::Shape::gen();
|
auto shape1 = tvg::Shape::gen();
|
||||||
shape1->appendRect(0, 0, 400, 400, 50); //x, y, w, h, cornerRadius
|
shape1->appendRect(0, 0, 400, 400, 50); //x, y, w, h, cornerRadius
|
||||||
shape1->fill(0, 255, 0, 255); //r, g, b, a
|
shape1->fill(0, 255, 0, 255); //r, g, b, a
|
||||||
canvas->push(move(shape1));
|
if (canvas->push(move(shape1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Prepare Circle
|
//Prepare Circle
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
shape2->appendCircle(400, 400, 200, 200); //cx, cy, radiusW, radiusH
|
shape2->appendCircle(400, 400, 200, 200); //cx, cy, radiusW, radiusH
|
||||||
shape2->fill(255, 255, 0, 255); //r, g, b, a
|
shape2->fill(255, 255, 0, 255); //r, g, b, a
|
||||||
canvas->push(move(shape2));
|
if (canvas->push(move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Prepare Ellipse
|
//Prepare Ellipse
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
shape3->appendCircle(600, 600, 150, 100); //cx, cy, radiusW, radiusH
|
shape3->appendCircle(600, 600, 150, 100); //cx, cy, radiusW, radiusH
|
||||||
shape3->fill(0, 255, 255, 255); //r, g, b, a
|
shape3->fill(0, 255, 255, 255); //r, g, b, a
|
||||||
canvas->push(move(shape3));
|
if (canvas->push(move(shape3)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,9 +49,10 @@ void tvgSwTest(uint32_t* buffer)
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -87,9 +88,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -22,7 +22,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape1->lineTo(146, 143);
|
shape1->lineTo(146, 143);
|
||||||
shape1->close();
|
shape1->close();
|
||||||
shape1->fill(0, 0, 255, 255);
|
shape1->fill(0, 0, 255, 255);
|
||||||
canvas->push(move(shape1));
|
if (canvas->push(move(shape1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
|
|
||||||
//Circle
|
//Circle
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
|
@ -39,7 +40,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape2->cubicTo(cx - halfRadius, cy + radius, cx - radius, cy + halfRadius, cx - radius, cy);
|
shape2->cubicTo(cx - halfRadius, cy + radius, cx - radius, cy + halfRadius, cx - radius, cy);
|
||||||
shape2->cubicTo(cx - radius, cy - halfRadius, cx - halfRadius, cy - radius, cx, cy - radius);
|
shape2->cubicTo(cx - radius, cy - halfRadius, cx - halfRadius, cy - radius, cx, cy - radius);
|
||||||
shape2->fill(255, 0, 0, 255);
|
shape2->fill(255, 0, 0, 255);
|
||||||
canvas->push(move(shape2));
|
if (canvas->push(move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -63,9 +65,10 @@ void tvgSwTest(uint32_t* buffer)
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -101,9 +104,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -38,8 +38,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape1 = tvg::Shape::gen();
|
auto shape1 = tvg::Shape::gen();
|
||||||
shape1->appendPath(cmds, 11, pts, 10); //copy path data
|
shape1->appendPath(cmds, 11, pts, 10); //copy path data
|
||||||
shape1->fill(0, 255, 0, 255);
|
shape1->fill(0, 255, 0, 255);
|
||||||
canvas->push(move(shape1));
|
if (canvas->push(move(shape1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
|
|
||||||
/* Circle */
|
/* Circle */
|
||||||
auto cx = 550.0f;
|
auto cx = 550.0f;
|
||||||
|
@ -79,7 +78,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
shape2->appendPath(cmds2, 6, pts2, 13); //copy path data
|
shape2->appendPath(cmds2, 6, pts2, 13); //copy path data
|
||||||
shape2->fill(255, 255, 0, 255);
|
shape2->fill(255, 255, 0, 255);
|
||||||
canvas->push(move(shape2));
|
if (canvas->push(move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -103,9 +103,10 @@ void tvgSwTest(uint32_t* buffer)
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -141,9 +142,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -24,7 +24,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
fill->colorStops(colorStops, 2);
|
fill->colorStops(colorStops, 2);
|
||||||
|
|
||||||
shape1->fill(move(fill));
|
shape1->fill(move(fill));
|
||||||
canvas->push(move(shape1));
|
if (canvas->push(move(shape1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Prepare Circle
|
//Prepare Circle
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
|
@ -43,7 +43,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
fill2->colorStops(colorStops2, 3);
|
fill2->colorStops(colorStops2, 3);
|
||||||
|
|
||||||
shape2->fill(move(fill2));
|
shape2->fill(move(fill2));
|
||||||
canvas->push(move(shape2));
|
if (canvas->push(move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
|
|
||||||
//Prepare Ellipse
|
//Prepare Ellipse
|
||||||
|
@ -64,7 +64,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
fill3->colorStops(colorStops3, 4);
|
fill3->colorStops(colorStops3, 4);
|
||||||
|
|
||||||
shape3->fill(move(fill3));
|
shape3->fill(move(fill3));
|
||||||
canvas->push(move(shape3));
|
if (canvas->push(move(shape3)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,9 +89,10 @@ void tvgSwTest(uint32_t* buffer)
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -127,9 +128,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -96,9 +96,10 @@ void tvgSwTest(uint32_t* buffer)
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -134,9 +135,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -132,9 +132,10 @@ void transitSwCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progre
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -170,9 +171,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void transitGlCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
|
void transitGlCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,9 +39,10 @@ void tvgSwTest(uint32_t* buffer)
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -77,9 +78,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -14,7 +14,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape1->stroke(tvg::StrokeJoin::Bevel); //default is Bevel
|
shape1->stroke(tvg::StrokeJoin::Bevel); //default is Bevel
|
||||||
shape1->stroke(10); //width: 10px
|
shape1->stroke(10); //width: 10px
|
||||||
|
|
||||||
canvas->push(move(shape1));
|
if (canvas->push(move(shape1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Shape 2
|
//Shape 2
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
|
@ -24,7 +24,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape2->stroke(tvg::StrokeJoin::Round);
|
shape2->stroke(tvg::StrokeJoin::Round);
|
||||||
shape2->stroke(10);
|
shape2->stroke(10);
|
||||||
|
|
||||||
canvas->push(move(shape2));
|
if (canvas->push(move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Shape 3
|
//Shape 3
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
|
@ -34,7 +34,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape3->stroke(tvg::StrokeJoin::Miter);
|
shape3->stroke(tvg::StrokeJoin::Miter);
|
||||||
shape3->stroke(10);
|
shape3->stroke(10);
|
||||||
|
|
||||||
canvas->push(move(shape3));
|
if (canvas->push(move(shape3)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Shape 4
|
//Shape 4
|
||||||
auto shape4 = tvg::Shape::gen();
|
auto shape4 = tvg::Shape::gen();
|
||||||
|
@ -43,7 +43,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape4->stroke(255, 255, 255, 255);
|
shape4->stroke(255, 255, 255, 255);
|
||||||
shape4->stroke(1);
|
shape4->stroke(1);
|
||||||
|
|
||||||
canvas->push(move(shape4));
|
if (canvas->push(move(shape4)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Shape 5
|
//Shape 5
|
||||||
auto shape5 = tvg::Shape::gen();
|
auto shape5 = tvg::Shape::gen();
|
||||||
|
@ -52,7 +52,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape5->stroke(255, 255, 255, 255);
|
shape5->stroke(255, 255, 255, 255);
|
||||||
shape5->stroke(2);
|
shape5->stroke(2);
|
||||||
|
|
||||||
canvas->push(move(shape5));
|
if (canvas->push(move(shape5)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Shape 6
|
//Shape 6
|
||||||
auto shape6 = tvg::Shape::gen();
|
auto shape6 = tvg::Shape::gen();
|
||||||
|
@ -61,7 +61,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape6->stroke(255, 255, 255, 255);
|
shape6->stroke(255, 255, 255, 255);
|
||||||
shape6->stroke(4);
|
shape6->stroke(4);
|
||||||
|
|
||||||
canvas->push(move(shape6));
|
if (canvas->push(move(shape6)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,9 +86,10 @@ void tvgSwTest(uint32_t* buffer)
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -124,9 +125,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -14,7 +14,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape->stroke(255, 255, 255, 255); //color: r, g, b, a
|
shape->stroke(255, 255, 255, 255); //color: r, g, b, a
|
||||||
shape->stroke(i + 1); //stroke width
|
shape->stroke(i + 1); //stroke width
|
||||||
shape->stroke(tvg::StrokeCap::Round); //default is Square
|
shape->stroke(tvg::StrokeCap::Round); //default is Square
|
||||||
canvas->push(move(shape));
|
if (canvas->push(move(shape)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Test for StrokeJoin & StrokeCap
|
//Test for StrokeJoin & StrokeCap
|
||||||
|
@ -28,7 +28,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape1->stroke(10);
|
shape1->stroke(10);
|
||||||
shape1->stroke(tvg::StrokeJoin::Round);
|
shape1->stroke(tvg::StrokeJoin::Round);
|
||||||
shape1->stroke(tvg::StrokeCap::Round);
|
shape1->stroke(tvg::StrokeCap::Round);
|
||||||
canvas->push(move(shape1));
|
if (canvas->push(move(shape1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
shape2->moveTo(270, 350);
|
shape2->moveTo(270, 350);
|
||||||
|
@ -40,7 +40,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape2->stroke(10);
|
shape2->stroke(10);
|
||||||
shape2->stroke(tvg::StrokeJoin::Bevel);
|
shape2->stroke(tvg::StrokeJoin::Bevel);
|
||||||
shape2->stroke(tvg::StrokeCap::Square);
|
shape2->stroke(tvg::StrokeCap::Square);
|
||||||
canvas->push(move(shape2));
|
if (canvas->push(move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
shape3->moveTo(520, 350);
|
shape3->moveTo(520, 350);
|
||||||
|
@ -52,7 +52,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape3->stroke(10);
|
shape3->stroke(10);
|
||||||
shape3->stroke(tvg::StrokeJoin::Miter);
|
shape3->stroke(tvg::StrokeJoin::Miter);
|
||||||
shape3->stroke(tvg::StrokeCap::Butt);
|
shape3->stroke(tvg::StrokeCap::Butt);
|
||||||
canvas->push(move(shape3));
|
if (canvas->push(move(shape3)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Test for Stroke Dash
|
//Test for Stroke Dash
|
||||||
auto shape4 = tvg::Shape::gen();
|
auto shape4 = tvg::Shape::gen();
|
||||||
|
@ -68,7 +68,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
|
|
||||||
float dashPattern1[2] = {10, 10};
|
float dashPattern1[2] = {10, 10};
|
||||||
shape4->stroke(dashPattern1, 2);
|
shape4->stroke(dashPattern1, 2);
|
||||||
canvas->push(move(shape4));
|
if (canvas->push(move(shape4)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape5 = tvg::Shape::gen();
|
auto shape5 = tvg::Shape::gen();
|
||||||
shape5->moveTo(270, 600);
|
shape5->moveTo(270, 600);
|
||||||
|
@ -83,7 +83,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
|
|
||||||
float dashPattern2[4] = {10, 10};
|
float dashPattern2[4] = {10, 10};
|
||||||
shape5->stroke(dashPattern2, 4);
|
shape5->stroke(dashPattern2, 4);
|
||||||
canvas->push(move(shape5));
|
if (canvas->push(move(shape5)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape6 = tvg::Shape::gen();
|
auto shape6 = tvg::Shape::gen();
|
||||||
shape6->moveTo(520, 600);
|
shape6->moveTo(520, 600);
|
||||||
|
@ -98,7 +98,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
|
|
||||||
float dashPattern3[2] = {10, 10};
|
float dashPattern3[2] = {10, 10};
|
||||||
shape6->stroke(dashPattern3, 2);
|
shape6->stroke(dashPattern3, 2);
|
||||||
canvas->push(move(shape6));
|
if (canvas->push(move(shape6)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,9 +123,10 @@ void tvgSwTest(uint32_t* buffer)
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -161,9 +162,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -16,10 +16,11 @@ void svgDirCallback(const char* name, const char* path, void* data)
|
||||||
|
|
||||||
auto scene = tvg::Scene::gen();
|
auto scene = tvg::Scene::gen();
|
||||||
|
|
||||||
char buf[255];
|
char buf[PATH_MAX];
|
||||||
sprintf(buf,"%s/%s", path, name);
|
sprintf(buf,"%s/%s", path, name);
|
||||||
|
|
||||||
scene->load(buf);
|
if (scene->load(buf) != tvg::Result::Success) return;
|
||||||
|
|
||||||
scene->translate(((WIDTH - (x * 2)) / NUM_PER_LINE) * (count % NUM_PER_LINE) + x, ((HEIGHT - (y * 2))/ NUM_PER_LINE) * (int)((float)count / (float)NUM_PER_LINE) + y);
|
scene->translate(((WIDTH - (x * 2)) / NUM_PER_LINE) * (count % NUM_PER_LINE) + x, ((HEIGHT - (y * 2))/ NUM_PER_LINE) * (int)((float)count / (float)NUM_PER_LINE) + y);
|
||||||
canvas->push(move(scene));
|
canvas->push(move(scene));
|
||||||
|
|
||||||
|
@ -30,11 +31,12 @@ void svgDirCallback(const char* name, const char* path, void* data)
|
||||||
|
|
||||||
void tvgDrawCmds(tvg::Canvas* canvas)
|
void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
{
|
{
|
||||||
auto shape1 = tvg::Shape::gen();
|
//Background
|
||||||
shape1->appendRect(0, 0, WIDTH, HEIGHT, 0); //x, y, w, h, cornerRadius
|
auto shape = tvg::Shape::gen();
|
||||||
shape1->fill(255, 255, 255, 255); //r, g, b, a
|
shape->appendRect(0, 0, WIDTH, HEIGHT, 0); //x, y, w, h, cornerRadius
|
||||||
|
shape->fill(255, 255, 255, 255); //r, g, b, a
|
||||||
|
|
||||||
canvas->push(move(shape1));
|
if (canvas->push(move(shape)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
eina_file_dir_list("./svgs", EINA_TRUE, svgDirCallback, canvas);
|
eina_file_dir_list("./svgs", EINA_TRUE, svgDirCallback, canvas);
|
||||||
}
|
}
|
||||||
|
@ -61,9 +63,10 @@ void tvgSwTest(uint32_t* buffer)
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -99,9 +102,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -22,7 +22,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape->appendCircle(115, 200, 170, 100);
|
shape->appendCircle(115, 200, 170, 100);
|
||||||
shape->fill(255, 255, 255, 255);
|
shape->fill(255, 255, 255, 255);
|
||||||
shape->translate(385, 400);
|
shape->translate(385, 400);
|
||||||
canvas->push(move(shape));
|
if (canvas->push(move(shape)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Shape2
|
//Shape2
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
|
@ -30,7 +30,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape2->appendRect(-50, -50, 100, 100, 0);
|
shape2->appendRect(-50, -50, 100, 100, 0);
|
||||||
shape2->fill(0, 255, 255, 255);
|
shape2->fill(0, 255, 255, 255);
|
||||||
shape2->translate(400, 400);
|
shape2->translate(400, 400);
|
||||||
canvas->push(move(shape2));
|
if (canvas->push(move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Shape3
|
//Shape3
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
|
@ -41,7 +41,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape3->appendRect(100, 100, 150, 50, 20);
|
shape3->appendRect(100, 100, 150, 50, 20);
|
||||||
shape3->fill(255, 0, 255, 255);
|
shape3->fill(255, 0, 255, 255);
|
||||||
shape3->translate(400, 400);
|
shape3->translate(400, 400);
|
||||||
canvas->push(move(shape3));
|
if (canvas->push(move(shape3)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||||
|
@ -55,17 +55,17 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||||
pShape->rotate(360 * progress);
|
pShape->rotate(360 * progress);
|
||||||
|
|
||||||
//Update shape for drawing (this may work asynchronously)
|
//Update shape for drawing (this may work asynchronously)
|
||||||
canvas->update(pShape);
|
if (canvas->update(pShape) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Update Shape2
|
//Update Shape2
|
||||||
pShape2->rotate(360 * progress);
|
pShape2->rotate(360 * progress);
|
||||||
pShape2->translate(400 + progress * 300, 400);
|
pShape2->translate(400 + progress * 300, 400);
|
||||||
canvas->update(pShape2);
|
if (canvas->update(pShape2) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Update Shape3
|
//Update Shape3
|
||||||
pShape3->rotate(-360 * progress);
|
pShape3->rotate(-360 * progress);
|
||||||
pShape3->scale(0.5 + progress);
|
pShape3->scale(0.5 + progress);
|
||||||
canvas->update(pShape3);
|
if (canvas->update(pShape3) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,9 +100,10 @@ void transitSwCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progre
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -138,9 +139,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void transitGlCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
|
void transitGlCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||||
{
|
{
|
||||||
//Explicitly clear all retained paint nodes.
|
//Explicitly clear all retained paint nodes.
|
||||||
canvas->clear();
|
if (canvas->clear() != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Shape
|
//Shape
|
||||||
auto shape = tvg::Shape::gen();
|
auto shape = tvg::Shape::gen();
|
||||||
|
@ -61,9 +61,10 @@ void transitSwCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progre
|
||||||
|
|
||||||
void drawSwView(void* data, Eo* obj)
|
void drawSwView(void* data, Eo* obj)
|
||||||
{
|
{
|
||||||
swCanvas->draw();
|
if (swCanvas->draw() == tvg::Result::Success) {
|
||||||
swCanvas->sync();
|
swCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -99,9 +100,10 @@ void drawGLview(Evas_Object *obj)
|
||||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||||
gl->glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
|
|
||||||
glCanvas->draw();
|
if (glCanvas->draw() == tvg::Result::Success) {
|
||||||
glCanvas->sync();
|
glCanvas->sync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void transitGlCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
|
void transitGlCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue