public void FillEllipse(Color innerColor, Color outerColor, GraphicsPoint center, double hRadius, double vRadius) { if (hRadius == 0 && vRadius == 0) { Draw(PrimitiveType.Points, new[] { center }, innerColor); return; } var ellipse = Polygon.Ellipse(center, hRadius, vRadius); var vertices = new GraphicsPoint[ellipse.Length + 2]; int i = 0; vertices[i++] = center; foreach (var p in ellipse.Vertices) { vertices[i++] = (GraphicsPoint)p; } vertices[vertices.Length - 1] = new GraphicsPoint(center.X + hRadius, center.Y); var colors = new Color[ellipse.Length + 2]; colors[0] = innerColor; for (int j = 1; j < colors.Length; j++) { colors[j] = outerColor; } _renderSystem.SetVertices(vertices); _renderSystem.SetColors(colors); _renderSystem.Render(PrimitiveType.TriangleFan); }
public static GraphicsPoint[] Tesselate(this Polygon polygon) { var result = new GraphicsPoint[polygon.Length]; for (int i = 0, sign = 1; i < polygon.Length; i++, sign = -sign) { result[i] = (GraphicsPoint)polygon.Vertex(i * sign); } return(result); }
internal SubTexture(Texture buffer, GraphicsPoint topLeft, GraphicsPoint topRight, GraphicsPoint bottomLeft, GraphicsPoint bottomRight) { TriangleStripCoords = new[] { topLeft, topRight, bottomLeft, bottomRight }; Texture = buffer; }
public void FillEllipse(Color color, GraphicsPoint location, double hRadius, double vRadius) { _renderSystem.SetVertices(Polygon.Ellipse(location, hRadius, vRadius).Tesselate()); _renderSystem.SetColor(color); _renderSystem.Render(PrimitiveType.LineLoop); }