/// <summary>
        ///     Applies VertexBuffer over pipeline and into device and outputs the buffer onto the screen.
        /// </summary>
        public void Draw()
        {
            var device        = Drawing.Direct3DDevice;
            var deviceOptions =
                new DeviceOption(device).AddRenderState(RenderState.AlphaBlendEnable, true)
                .AddTexture(0, null)
                .AddPixelShader(null)
                .AddRenderState(RenderState.SourceBlend, RenderState.SourceBlendAlpha)
                .AddRenderState(RenderState.DestinationBlend, RenderState.DestinationBlendAlpha)
                .AddStreamSource(0, buffer, 0, Utilities.SizeOf <Vertex>())
                .AddVertexFormat(VertexFormat.Diffuse | VertexFormat.PositionRhw);

            if (Smooth)
            {
                deviceOptions.AddRenderState(RenderState.MultisampleAntialias, true);
                deviceOptions.AddRenderState(RenderState.AntialiasedLineEnable, true);
            }

            device.Clear(ClearFlags.Target, new ColorBGRA(255f, 255f, 255f, 255f), 0f, 1);
            using (new DeviceOptions(deviceOptions))
            {
                device.DrawPrimitives(PrimitiveType.LineStrip, 0, Resolution);
            }
        }
        /// <summary>
        ///     Draw a circle directly without instancing a new circle, external drawing method.
        /// </summary>
        /// <param name="position">Position to draw the Circle</param>
        /// <param name="radius">Circle Radius</param>
        /// <param name="rotate">Circle Rotation</param>
        /// <param name="type">Circle Type</param>
        /// <param name="smooth">Smooth Circle</param>
        /// <param name="resolution">Circle Resolution</param>
        /// <param name="color">Circle Color</param>
        public static void Draw(Vector2 position,
                                float radius,
                                int rotate,
                                CircleType type,
                                bool smooth,
                                int resolution,
                                ColorBGRA color)
        {
            var vertexVertices = new Vertex[resolution + 2];
            var angle          = rotate * System.Math.PI / 180;
            var x  = position.X;
            var y  = position.Y;
            var pi = (type == CircleType.Full)
                ? System.Math.PI
                : (type == CircleType.Half) ? System.Math.PI / 2 : System.Math.PI / 4;
            var device = Drawing.Direct3DDevice;

            #region Circle

            byte[] b   = { color.R, color.G, color.B, color.A };
            var    bgr = BitConverter.ToInt32(b, 0);

            for (var i = 0; i < vertexVertices.Length; ++i)
            {
                vertexVertices[i] = new Vertex
                {
                    X     = (float)(x - radius * System.Math.Cos(i * (2 * pi / resolution))),
                    Y     = (float)(y - radius * System.Math.Sin(i * (2 * pi / resolution))),
                    Z     = 0f,
                    Rhw   = 1f,
                    Color = bgr
                };
            }

            #endregion

            #region Set Angle

            for (var i = 0; i < vertexVertices.Length; ++i)
            {
                vertexVertices[i].X =
                    (float)
                    (x + System.Math.Cos(angle) * (vertexVertices[i].X - x) -
                     System.Math.Sin(angle) * (vertexVertices[i].Y - y));
                vertexVertices[i].Y =
                    (float)
                    (y + System.Math.Sin(angle) * (vertexVertices[i].X - x) -
                     System.Math.Cos(angle) * (vertexVertices[i].Y - y));
            }

            #endregion

            #region Buffer

            var buffer = new VertexBuffer(
                device, vertexVertices.Length * Utilities.SizeOf <Vertex>(), Usage.WriteOnly, VertexFormat.Diffuse,
                Pool.Default);

            var vertices = buffer.Lock(0, vertexVertices.Length * Utilities.SizeOf <Vertex>(), LockFlags.None);
            foreach (var v in vertexVertices)
            {
                vertices.Write(v);
            }
            buffer.Unlock();

            #endregion

            #region Draw

            var deviceOptions =
                new DeviceOption(device).AddRenderState(RenderState.AlphaBlendEnable, true)
                .AddTexture(0, null)
                .AddPixelShader(null)
                .AddRenderState(RenderState.SourceBlend, RenderState.SourceBlendAlpha)
                .AddRenderState(RenderState.DestinationBlend, RenderState.DestinationBlendAlpha)
                .AddStreamSource(0, buffer, 0, Utilities.SizeOf <Vertex>())
                .AddVertexFormat(VertexFormat.PositionRhw | VertexFormat.Diffuse);

            if (smooth)
            {
                deviceOptions.AddRenderState(RenderState.MultisampleAntialias, true);
                deviceOptions.AddRenderState(RenderState.AntialiasedLineEnable, true);
            }

            using (new DeviceOptions(deviceOptions))
            {
                device.DrawPrimitives(PrimitiveType.LineStrip, 0, resolution);
            }

            #endregion

            buffer.Dispose();
        }