<Compile Include="ElmSharp\Panes.cs" />\r
<Compile Include="ElmSharp\Point.cs" />\r
<Compile Include="ElmSharp\Point3D.cs" />\r
+ <Compile Include="ElmSharp\Polygon.cs" />\r
<Compile Include="ElmSharp\Popup.cs" />\r
<Compile Include="ElmSharp\PopupItem.cs" />\r
<Compile Include="ElmSharp\ProgressBar.cs" />\r
<Compile Include="ElmSharp\Panes.cs" />\r
<Compile Include="ElmSharp\Point.cs" />\r
<Compile Include="ElmSharp\Point3D.cs" />\r
+ <Compile Include="ElmSharp\Polygon.cs" />\r
<Compile Include="ElmSharp\Popup.cs" />\r
<Compile Include="ElmSharp\PopupItem.cs" />\r
<Compile Include="ElmSharp\ProgressBar.cs" />\r
--- /dev/null
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+
+namespace ElmSharp
+{
+ /// <summary>
+ /// A view used to draw a polygon (filled).
+ /// </summary>
+ public class Polygon : EvasObject
+ {
+ /// <summary>
+ /// Create a new Polygon widget.
+ /// <param name="p">The EvasObject to which the new Polygon will be attached as a child.</param>
+ /// </summary>
+ public Polygon (EvasObject parent) : base(parent)
+ {
+ }
+
+ /// <summary>
+ /// Adds a new vertex to the polygon.
+ /// <param name="x">The X coordinate of the new vertex.</param>
+ /// <param name="y">The Y coordinate of the new vertex.</param>
+ /// </summary>
+ public void AddPoint(int x, int y)
+ {
+ Interop.Evas.evas_object_polygon_point_add(Handle, x, y);
+ }
+
+ /// <summary>
+ /// Adds a new vertex to the polygon.
+ /// <param name="p">The coordinates of the new vertex.</param>
+ /// </summary>
+ public void AddPoint(Point p)
+ {
+ AddPoint(p.X, p.Y);
+ }
+
+ /// <summary>
+ /// Removes all the vertices of the polygon, making it empty.
+ /// </summary>
+ public void ClearPoints()
+ {
+ Interop.Evas.evas_object_polygon_points_clear(Handle);
+ }
+
+ protected override IntPtr CreateHandle(EvasObject parent)
+ {
+ IntPtr evas = Interop.Evas.evas_object_evas_get(parent.Handle);
+ return Interop.Evas.evas_object_polygon_add(evas);
+ }
+ }
+}
internal static extern void evas_map_free(IntPtr map);
[DllImport(Libraries.Evas)]
+ internal static extern IntPtr evas_object_polygon_add(IntPtr evas);
+
+ [DllImport(Libraries.Evas)]
+ internal static extern IntPtr evas_object_polygon_point_add(IntPtr evas, int x, int y);
+
+ [DllImport(Libraries.Evas)]
+ internal static extern IntPtr evas_object_polygon_points_clear(IntPtr evas);
+
+ [DllImport(Libraries.Evas)]
internal static extern IntPtr evas_object_rectangle_add(IntPtr evas);
[DllImport(Libraries.Evas)]
<Compile Include="TC\PanelTest1.cs" />\r
<Compile Include="TC\PanelTest2.cs" />\r
<Compile Include="TC\PanesTest1.cs" />\r
+ <Compile Include="TC\PolygonTest1.cs" />\r
<Compile Include="TC\PopupTest1.cs" />\r
<Compile Include="TC\ProgressBarTest1.cs" />\r
<Compile Include="TC\RadioTest1.cs" />\r
--- /dev/null
+using System;
+using ElmSharp;
+
+namespace ElmSharp.Test
+{
+ class PolygonTest1 : TestCaseBase
+ {
+ public override string TestName => "PolygonTest1";
+ public override string TestDescription => "To test basic operation of Polygon";
+
+ public override void Run(Window window)
+ {
+ Background bg = new Background(window);
+ bg.Color = Color.White;
+ bg.Move(0, 0);
+ bg.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
+ bg.Show();
+
+ Polygon triangle1 = new Polygon(window);
+ triangle1.Color = Color.Blue;
+ triangle1.AddPoint(100, 100);
+ triangle1.AddPoint(100, 500);
+ triangle1.AddPoint(500, 500);
+ triangle1.Show();
+
+ Polygon triange2 = new Polygon(window);
+ triange2.AddPoint(300, 300);
+ triange2.AddPoint(new Point{X=600, Y=300});
+ triange2.AddPoint(new Point{X=600, Y=600});
+ triange2.Color = Color.Green;
+ triange2.Show();
+
+ Polygon hexagon = new Polygon(window);
+ hexagon.Color = Color.Pink;
+ hexagon.AddPoint(0, 0);
+ hexagon.AddPoint(700, 0);
+ hexagon.ClearPoints();
+ for (double a=0; a < 2 * Math.PI; a += Math.PI / 3)
+ {
+ hexagon.AddPoint(
+ 300 + (int)(120 * Math.Sin(a)),
+ 580 + (int)(120 * Math.Cos(a))
+ );
+ }
+ hexagon.Show();
+ }
+
+ }
+}