Пример #1
0
 /// <summary>
 /// Creates a CanvasRenderLayer with the specified geometry string, fill brush, outline brush,
 /// strokeWidth and stroke style.
 /// </summary>
 /// <param name="creator">ICanvasResourceCreator</param>
 /// <param name="geometryData">CanvasGeometry string definition.</param>
 /// <param name="brush">ICanvasBrush used to fill the rendered geometry.</param>
 /// <param name="strokeBrush">ICanvasBrush for the rendered geometry outline.</param>
 /// <param name="strokeWidth">Width of the rendered geometry outline.</param>
 /// <param name="strokeStyle">CanvasStrokeStyle</param>
 public CanvasRenderLayer(ICanvasResourceCreator creator, string geometryData, ICanvasBrush brush, ICanvasBrush strokeBrush,
                          float strokeWidth, CanvasStrokeStyle strokeStyle)
 {
     Geometry = String.IsNullOrWhiteSpace(geometryData) ? null : CanvasObject.CreateGeometry(creator, geometryData);
     Brush    = brush;
     Stroke   = new CanvasStroke(strokeBrush, strokeWidth, strokeStyle);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="session">CanvasDrawingSession</param>
 /// <param name="x">Offset of the top left corner of the  Squircle on the x-axis</param>
 /// <param name="y">Offset of the top left corner of the  Squircle on the y-axis</param>
 /// <param name="w">Width of the  Squircle</param>
 /// <param name="h">Height of the  Squircle</param>
 /// <param name="radiusX">Corner Radius on the x axis</param>
 /// <param name="radiusY">Corner Radius on the y axis</param>
 /// <param name="offset">Offset of the Squircle from the origin.</param>
 /// <param name="brush">Brush to fill the Squircle.</param>
 public static void FillSquircle(this CanvasDrawingSession session, float x, float y, float w, float h,
                                 float radiusX, float radiusY, Vector2 offset, ICanvasBrush brush)
 {
     using (var geometry = CanvasObject.CreateSquircle(session.Device, x, y, w, h, radiusX, radiusY))
     {
         session.FillGeometry(geometry, offset, brush);
     }
 }
 /// <summary>
 /// Fills a Squircle of the specified dimensions, using the given color
 /// </summary>
 /// <param name="session">CanvasDrawingSession</param>
 /// <param name="x">Offset of the top left corner of the  Squircle on the x-axis</param>
 /// <param name="y">Offset of the top left corner of the  Squircle on the y-axis</param>
 /// <param name="w">Width of the  Squircle</param>
 /// <param name="h">Height of the  Squircle</param>
 /// <param name="radiusX">Corner Radius on the x axis</param>
 /// <param name="radiusY">Corner Radius on the y axis</param>
 /// <param name="color">Color to fill the Squircle.</param>
 public static void FillSquircle(this CanvasDrawingSession session, float x, float y, float w, float h,
                                 float radiusX, float radiusY, Color color)
 {
     using (var geometry = CanvasObject.CreateSquircle(session.Device, x, y, w, h, radiusX, radiusY))
     {
         session.FillGeometry(geometry, color);
     }
 }
 /// <summary>
 /// Draws a Squircle of the specified dimensions, using a CanvasStroke to define the stroke
 /// width, the stroke color and stroke style.
 /// </summary>
 /// <param name="session">CanvasDrawingSession</param>
 /// <param name="x">Offset of the top left corner of the  Squircle on the x-axis</param>
 /// <param name="y">Offset of the top left corner of the  Squircle on the y-axis</param>
 /// <param name="w">Width of the  Squircle</param>
 /// <param name="h">Height of the  Squircle</param>
 /// <param name="radiusX">Corner Radius on the x axis</param>
 /// <param name="radiusY">Corner Radius on the y axis</param>
 /// <param name="offset">Offset of the Squircle from the origin.</param>
 /// <param name="stroke">CanvasStroke defining the stroke width, the stroke
 /// color and stroke style.</param>
 public static void DrawSquircle(this CanvasDrawingSession session, float x, float y, float w, float h,
                                 float radiusX, float radiusY, Vector2 offset, ICanvasStroke stroke)
 {
     using (var geometry = CanvasObject.CreateSquircle(session.Device, x, y, w, h, radiusX, radiusY))
     {
         session.DrawGeometry(geometry, offset, stroke);
     }
 }
Пример #5
0
 /// <summary>
 /// Creates a CanvasRenderLayer with the geometry, fill brush and stroke specified in
 /// string formats.
 /// </summary>
 /// <param name="creator">ICanvasResourceCreator.</param>
 /// <param name="geometryData">CanvasGeometry string definition.</param>
 /// <param name="brushData">ICanvasBrush string definition.</param>
 /// <param name="strokeData">ICanvasStroke string definition.</param>
 public CanvasRenderLayer(ICanvasResourceCreator creator, string geometryData, string brushData, string strokeData)
 {
     Geometry = String.IsNullOrWhiteSpace(geometryData) ? null : CanvasObject.CreateGeometry(creator, geometryData);
     Brush    = String.IsNullOrWhiteSpace(brushData) ? null : CanvasObject.CreateBrush(creator, brushData);
     Stroke   = String.IsNullOrWhiteSpace(strokeData) ? null : CanvasObject.CreateStroke(creator, strokeData);
 }