Draw shape in InkCanvas using custom Stroke

Following solutions were tried

  1. using model which creates an instance of class inherited from Stroke class with overridden method void DrawCore(DrawingContext, DrawingAttributes) to draw lines, ellipses and rectangles

    Models/DrawShapeModel.cs

    Models/Strokes/ShapeStrokeBase.cs

    Models/Strokes/LineStroke.cs

    Models/Strokes/RectangleStroke.cs

    Models/Strokes/EllipseStroke.cs

    There were two problems

    • select the shape by click on shape’s lines did not work
    • when eraser crossed such shape – it divides to two smaller similar shapes, instead of erasing part of lines of those shapes

                 image_thumb[5]_thumb[1]image_thumb[3]_thumb[1] 

                 image_thumb[7]_thumb[1]image_thumb[9]_thumb[1]

  2. using model which creates an instance of original Stroke class and puts prepared StylusPoints which follows shape’s geometry drawing it by lines which can be selected and erased.  There is an issue when eraser splits the rectangle to two parts when breaks only one of lines – start point and end point are not really connected even though they are the same instance of StylusPoint class. In the second picture below top left segment is not selected when other lines are selected by click on left rectangle’s side.

                                        imageimage

Last edited May 26, 2013 at 8:56 AM by smt, version 6

Comments

No comments yet.