public void PenVG(GraphicsDevice device) { ICanvas canvas = new GraphicsCanvas(device, device.SwapChain, new Vector2f(1.0f, 1.0f)); // We first create all needed fills. SolidFill solidFill = new SolidFill(Colour.Red); Pen pen = new Pen(solidFill, 0.003f, 0.0f, OutlineEnd.Square); Bezier2f line = new Bezier2f(new Vector2f(0.1f, 0.5f), new Vector2f(0.3f, 1.0f), new Vector2f(0.9f, 0.5f)); Bezier2f line2 = new Bezier2f(new Vector2f(0.1f, 0.5f), new Vector2f(0.3f, 0.0f), new Vector2f(0.9f, 0.5f)); LineSegment2f seg = new LineSegment2f(new Vector2f(0, 0.5f), new Vector2f(0.7f, 0.6f)); bool exit = false; device.SwapChain.Window.Closed += delegate(Window w) { exit = true; }; float a = 0; while (!exit) { device.SwapChain.Window.DoEvents(); using (DeviceLock l = device.Lock()) { device.Clear(device.SwapChain, Colour.Green); device.SetViewports(new Region2i(0, 0, (int)device.SwapChain.Width, (int)device.SwapChain.Height)); line.A = 0.5f * new Vector2f(1, 1) + new Vector2f(1, 1) * 0.5f * MathHelper.Cos(a); line2.B = 0.5f * new Vector2f(1, 1) + new Vector2f(1, 1) * 0.5f * MathHelper.Sin(a); // We render. canvas.Begin(CanvasRenderFlags.None); canvas.DrawShape(pen, line, null); canvas.DrawShape(pen, seg, null); canvas.DrawShape(pen, line2, null); canvas.End(); } device.SwapChain.Present(); a += 0.01f; } }