2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 _on_resize(Ecore_Evas *ee)
30 ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
37 PathTest(EvasApp *app) {
39 mShape = evas_vg_shape_add(mApp->root());
41 void setColor(int r, int g, int b, int a) {
42 evas_vg_node_color_set(mShape, r, g, b, a);
45 void setStrokeColor(int r, int g, int b, int a) {
46 evas_vg_shape_stroke_color_set(mShape, r, g, b, a);
49 void setStrokeWidth(int w) {
50 evas_vg_shape_stroke_width_set(mShape, w);
53 void setPath(const VPath &path) {
54 Efl_VG *shape = mShape;
55 evas_vg_shape_reset(shape);
56 const std::vector<VPath::Element> &elm = path.elements();
57 const std::vector<VPointF> &pts = path.points();
61 case VPath::Element::MoveTo:
64 evas_vg_shape_append_move_to(shape, p.x(), p.y());
67 case VPath::Element::LineTo:
70 evas_vg_shape_append_line_to(shape, p.x(), p.y());
73 case VPath::Element::CubicTo:
76 VPointF p1 = pts[i++];
77 VPointF p2 = pts[i++];
78 evas_vg_shape_append_cubic_to(shape, p.x(), p.y(), p1.x(), p1.y(), p2.x(), p2.y());
81 case VPath::Element::Close:
83 evas_vg_shape_append_close(shape);
98 APP = new EvasApp(800, 800);
99 ecore_evas_callback_resize_set(APP->mEcoreEvas, _on_resize);
103 path.addRoundRect(VRectF(100, 100, 200, 200), 20, 20, VPath::Direction::CCW);
104 path.addCircle(50, 50, 20, VPath::Direction::CCW);
106 path.addOval(VRectF(300, 100, 100, 50), VPath::Direction::CCW);
108 path.addPolystar(15.0, 106.0, 34.0, 0.0, 150,
109 150, 231.0, 88.0, VPath::Direction::CW);
113 test.setColor(255, 0, 0, 255);
114 test.setStrokeColor(200, 200, 0, 200);
115 test.setStrokeWidth(5);