private static void DrawBoundNodesCore(CanvasDrawingSession drawingSession, Vector2 leftTop, Vector2 rightTop, Vector2 rightBottom, Vector2 leftBottom, Windows.UI.Color accentColor, bool disabledRadian) { // Line CanvasDrawingSessionExtensions.DrawBoundCore(drawingSession, leftTop, rightTop, rightBottom, leftBottom, accentColor); // Center Vector2 centerLeft = (leftTop + leftBottom) / 2; Vector2 centerTop = (leftTop + rightTop) / 2; Vector2 centerRight = (rightTop + rightBottom) / 2; Vector2 centerBottom = (leftBottom + rightBottom) / 2; // Scale2 drawingSession.DrawNode2(leftTop, accentColor); drawingSession.DrawNode2(rightTop, accentColor); drawingSession.DrawNode2(rightBottom, accentColor); drawingSession.DrawNode2(leftBottom, accentColor); if (disabledRadian == false) { // Outside Vector2 outsideLeft = Math.GetOutsidePointInTransformer(centerLeft, centerRight); Vector2 outsideTop = Math.GetOutsidePointInTransformer(centerTop, centerBottom); Vector2 outsideRight = Math.GetOutsidePointInTransformer(centerRight, centerLeft); Vector2 outsideBottom = Math.GetOutsidePointInTransformer(centerBottom, centerTop); // Radian drawingSession.DrawThickLine(outsideTop, centerTop); drawingSession.DrawNode(outsideTop, accentColor); // Skew // drawingSession.DrawNode2(outsideTop, accentColor); // drawingSession.DrawNode2(outsideLeft, accentColor); drawingSession.DrawNode2(outsideRight, accentColor); drawingSession.DrawNode2(outsideBottom, accentColor); } // Scale1 if (Math.OutNodeDistance(centerLeft, centerRight)) { drawingSession.DrawNode2(centerTop, accentColor); drawingSession.DrawNode2(centerBottom, accentColor); } if (Math.OutNodeDistance(centerTop, centerBottom)) { drawingSession.DrawNode2(centerLeft, accentColor); drawingSession.DrawNode2(centerRight, accentColor); } }
/// <summary> /// Draw bezier-curve by NodeCollection. /// </summary> /// <param name="drawingSession"> The drawing-session. </param> /// <param name="nodeCollection"> The NodeCollection. </param> /// <param name="matrix"> The matrix. </param> /// <param name="accentColor"> The accent color. </param> public static void DrawNodeCollection(this CanvasDrawingSession drawingSession, NodeCollection nodeCollection, Matrix3x2 matrix, Windows.UI.Color accentColor) { foreach (Node node in nodeCollection) { switch (node.Type) { case NodeType.BeginFigure: { Vector2 vector = Vector2.Transform(node.Point, matrix); if (node.IsChecked == false) { if (node.IsSmooth == false) { drawingSession.DrawNode3(vector, Windows.UI.Colors.Gold); } else { drawingSession.DrawNode(vector, Windows.UI.Colors.Gold); } } else { if (node.IsSmooth == false) { drawingSession.DrawNode4(vector, Windows.UI.Colors.Gold); } else { //Right Vector2 rightControlPoint = Vector2.Transform(node.RightControlPoint, matrix); drawingSession.DrawLine(vector, rightControlPoint, accentColor); drawingSession.DrawNode5(rightControlPoint, Windows.UI.Colors.Gold); //Left Vector2 leftControlPoint = Vector2.Transform(node.LeftControlPoint, matrix); drawingSession.DrawLine(vector, leftControlPoint, accentColor); drawingSession.DrawNode5(leftControlPoint, Windows.UI.Colors.Gold); drawingSession.DrawNode2(vector, Windows.UI.Colors.Gold); } } } break; case NodeType.Node: { Vector2 vector = Vector2.Transform(node.Point, matrix); if (node.IsChecked == false) { if (node.IsSmooth == false) { drawingSession.DrawNode3(vector, accentColor); } else { drawingSession.DrawNode(vector, accentColor); } } else { if (node.IsSmooth == false) { drawingSession.DrawNode4(vector, accentColor); } else { //Right Vector2 rightControlPoint = Vector2.Transform(node.RightControlPoint, matrix); drawingSession.DrawLine(vector, rightControlPoint, accentColor); drawingSession.DrawNode5(rightControlPoint, accentColor); //Left Vector2 leftControlPoint = Vector2.Transform(node.LeftControlPoint, matrix); drawingSession.DrawLine(vector, leftControlPoint, accentColor); drawingSession.DrawNode5(leftControlPoint, accentColor); drawingSession.DrawNode2(vector, accentColor); } } } break; case NodeType.EndFigure: break; } } }