示例#1
0
        public override void Draw(IPrimitiveRenderer renderer, MeshList meshList)
        {
            var r = renderer as GraphicsImplementation.BuiltinPrimitiveRenderer;

            Debug.Assert(r != null);
            r.DrawPrimitive(this.Primitive, this.Rect, this.RuleSet, meshList);
        }
 /// <summary>
 /// Draws a filled polygon.
 /// </summary>
 /// <param name="primitives"></param>
 /// <param name="color"></param>
 /// <param name="polygon"></param>
 public static void FillPolygon(this IPrimitiveRenderer primitives, Effect effect, Color color, Polygon polygon)
 {
     if (polygon.IsConvex)
     {
         primitives.FillPolygon(effect, color, polygon.Points);
     }
     else
     {
         foreach (var convexPoly in polygon.ConvexDecomposition)
         {
             primitives.FillPolygon(effect, color, convexPoly.Points);
         }
     }
 }
 /// <summary>
 /// Draws a filled circle.
 /// </summary>
 /// <param name="primitives"></param>
 /// <param name="color"></param>
 /// <param name="center"></param>
 /// <param name="radius"></param>
 public static void FillCircle(this IPrimitiveRenderer primitives, Effect effect, Color color, Vector2 center, double radius)
 {
     primitives.FillPolygon(effect, color, new EllipseBuilder().BuildCircle(center, radius).ToArray());
 }
 /// <summary>
 /// Draws a filled ellipse.
 /// </summary>
 /// <param name="primitives"></param>
 /// <param name="color"></param>
 /// <param name="center"></param>
 /// <param name="majorAxisRadius"></param>
 /// <param name="minorAxisRadius"></param>
 /// <param name="rotationAngle"></param>
 public static void FillEllipse(this IPrimitiveRenderer primitives, Effect effect, Color color, Vector2 center,
                                double majorAxisRadius, double minorAxisRadius, double rotationAngle)
 {
     primitives.FillPolygon(effect, color, new EllipseBuilder().BuildEllipse(center, majorAxisRadius, minorAxisRadius, rotationAngle).ToArray());
 }
 /// <summary>
 /// Draws a filled ellipse, inscribed inside a rectangle.
 /// </summary>
 /// <param name="primitives"></param>
 /// <param name="color"></param>
 /// <param name="boundingRect"></param>
 public static void FillEllipse(this IPrimitiveRenderer primitives, Effect effect, Color color, RectangleF boundingRect)
 {
     primitives.FillPolygon(effect, color, new EllipseBuilder().BuildEllipse(boundingRect).ToArray());
 }
 /// <summary>
 /// Draws a filled ellipse, inscribed inside a rectangle.
 /// </summary>
 /// <param name="primitives"></param>
 /// <param name="color"></param>
 /// <param name="boundingRect"></param>
 public static void FillEllipse(this IPrimitiveRenderer primitives, Effect effect, Color color, Rectangle boundingRect)
 {
     primitives.FillEllipse(effect, color, (RectangleF)boundingRect);
 }
 /// <summary>
 /// Draws a filled rectangle.
 /// </summary>
 /// <param name="primitives"></param>
 /// <param name="color"></param>
 /// <param name="rect"></param>
 public static void FillRect(this IPrimitiveRenderer primitives, Effect effect, Color color, RectangleF rect)
 {
     primitives.FillPolygon(effect, color, new QuadrilateralBuilder().BuildRectangle(rect));
 }
 /// <summary>
 /// Draws a filled rectangle.
 /// </summary>
 /// <param name="primitives"></param>
 /// <param name="color"></param>
 /// <param name="rect"></param>
 public static void FillRect(this IPrimitiveRenderer primitives, Effect effect, Color color, Rectangle rect)
 {
     primitives.FillRect(effect, color, (RectangleF)rect);
 }
 /// <summary>
 /// Draws an unfilled polygon.
 /// </summary>
 /// <param name="primitives"></param>
 /// <param name="color"></param>
 /// <param name="polygon"></param>
 public static void DrawPolygon(this IPrimitiveRenderer primitives, Effect effect, Color color, Polygon polygon)
 {
     primitives.DrawLines(effect, LineType.Polygon, color, polygon.Points);
 }
 /// <summary>
 /// Draws the outline of an ellipse, inscribed inside a rectangle.
 /// </summary>
 /// <param name="primitives"></param>
 /// <param name="color"></param>
 /// <param name="boundingRect">The rectangle the circle should be inscribed in.</param>
 public static void DrawEllipse(this IPrimitiveRenderer primitives, Effect effect, Color color, RectangleF boundingRect)
 {
     primitives.DrawLines(effect, LineType.Polygon, color,
                          new EllipseBuilder().BuildEllipse(boundingRect));
 }
 /// <summary>
 /// Draws the outline of a rectangle.
 /// </summary>
 /// <param name="primitives"></param>
 /// <param name="color"></param>
 /// <param name="rect"></param>
 public static void DrawRect(this IPrimitiveRenderer primitives, Effect effect, Color color, RectangleF rect)
 {
     primitives.DrawLines(effect, LineType.Polygon, color,
                          new QuadrilateralBuilder().BuildRectangle(rect));
 }
 /// <summary>
 ///     Draws a line between the two points specified.
 /// </summary>
 /// <param name="primitives"></param>
 /// <param name="color"></param>
 /// <param name="a"></param>
 /// <param name="b"></param>
 public static void DrawLine(this IPrimitiveRenderer primitives, Effect effect, Color color, Vector2 a, Vector2 b)
 {
     primitives.DrawLines(effect, LineType.LineSegments, color, new[] { a, b });
 }
 /// <summary>
 /// Draws a filled convex polygon.
 /// </summary>
 /// <param name="color"></param>
 /// <param name="points"></param>
 public static void FillPolygon(this IPrimitiveRenderer primitives, Effect effect, Color color, IReadOnlyList <Vector2> points)
 {
     primitives.FillConvexPolygon(effect, color, points);
 }
 /// <summary>
 /// Draws a set of lines. The lineType parameter controls how
 /// lines are connected.
 /// </summary>
 /// <param name="lineType">The type of lines to draw.</param>
 /// <param name="color">The color of lines to draw.</param>
 /// <param name="points">The points that are used to
 /// build the individual line segments.</param>
 public static void DrawLines(this IPrimitiveRenderer primitives, Effect effect, LineType lineType, Color color,
                              IEnumerable <Vector2> points)
 {
     primitives.DrawLines(effect, lineType, color, points);
 }
示例#15
0
 public static void RenderBullet(this IPrimitiveRenderer drawList, Point pos, double lineHeight, Color color)
 {
     drawList.AddCircleFilled(pos, (float)lineHeight * 0.20f, color, 8);
 }