public override void DrawBezier(Primitives.Point p1, Primitives.Point p2, Primitives.Point p3, Primitives.Point p4, Primitives.Pen pen, MusicalSymbol owner) { if (Settings.RenderingMode != ScoreRenderingModes.Panorama) { p1 = p1.Translate(CurrentScore.DefaultPageSettings); p2 = p2.Translate(CurrentScore.DefaultPageSettings); p3 = p3.Translate(CurrentScore.DefaultPageSettings); p4 = p4.Translate(CurrentScore.DefaultPageSettings); } PathGeometry pathGeom = new PathGeometry(); PathFigure pf = new PathFigure(); pf.StartPoint = new Windows.Foundation.Point(p1.X, p1.Y); BezierSegment bezierSegment = new BezierSegment(); bezierSegment.Point1 = ConvertPoint(p2); bezierSegment.Point2 = ConvertPoint(p3); bezierSegment.Point3 = ConvertPoint(p4); pf.Segments.Add(bezierSegment); pathGeom.Figures.Add(pf); Path path = new Path(); path.Stroke = new SolidColorBrush(ConvertColor(pen.Color)); path.StrokeThickness = pen.Thickness; path.Data = pathGeom; path.Visibility = BoolToVisibility(owner.IsVisible); Canvas.Children.Add(path); OwnershipDictionary.Add(path, owner); }
public override void DrawString(string text, MusicFontStyles fontStyle, Primitives.Point location, Primitives.Color color, MusicalSymbol owner) { if (Settings.RenderingMode != ScoreRenderingModes.Panorama) { location = location.Translate(CurrentScore.DefaultPageSettings); } location = TranslateTextLocation(location, fontStyle); TextBlock textBlock = new TextBlock(); textBlock.FontSize = Fonts.GetSize(fontStyle); textBlock.FontFamily = Fonts.Get(fontStyle); textBlock.Text = text; textBlock.Foreground = new SolidColorBrush(ConvertColor(color)); textBlock.Visibility = BoolToVisibility(owner.IsVisible); Canvas.SetLeft(textBlock, location.X + 3d); Canvas.SetTop(textBlock, location.Y); Canvas.Children.Add(textBlock); OwnershipDictionary.Add(textBlock, owner); }
public override void DrawArc(Primitives.Rectangle rect, double startAngle, double sweepAngle, Primitives.Pen pen, MusicalSymbol owner) { if (Settings.RenderingMode != ScoreRenderingModes.Panorama) { rect = rect.Translate(CurrentScore.DefaultPageSettings); } if (rect.Width < 0 || rect.Height < 0) { return; //TODO: Sprawdzić czemu tak się dzieje, poprawić } PathGeometry pathGeom = new PathGeometry(); PathFigure pf = new PathFigure(); pf.StartPoint = new Windows.Foundation.Point(rect.X, rect.Y); ArcSegment arcSeg = new ArcSegment(); arcSeg.Point = new Windows.Foundation.Point(rect.X + rect.Width, rect.Y); arcSeg.RotationAngle = startAngle; arcSeg.Size = new Windows.Foundation.Size(rect.Width, rect.Height); arcSeg.SweepDirection = sweepAngle < 180 ? SweepDirection.Counterclockwise : SweepDirection.Clockwise; arcSeg.IsLargeArc = sweepAngle > 180; pf.Segments.Add(arcSeg); pathGeom.Figures.Add(pf); Path path = new Path(); path.Stroke = new SolidColorBrush(ConvertColor(pen.Color)); path.StrokeThickness = pen.Thickness; path.Data = pathGeom; path.Visibility = BoolToVisibility(owner.IsVisible); Canvas.SetZIndex(path, (int)pen.ZIndex); Canvas.Children.Add(path); OwnershipDictionary.Add(path, owner); }
public override void DrawLine(Primitives.Point startPoint, Primitives.Point endPoint, Primitives.Pen pen, MusicalSymbol owner) { if (Settings.RenderingMode != ScoreRenderingModes.Panorama) { startPoint = startPoint.Translate(CurrentScore.DefaultPageSettings); endPoint = endPoint.Translate(CurrentScore.DefaultPageSettings); } var line = new Line(); line.Stroke = new SolidColorBrush(ConvertColor(pen.Color)); line.UseLayoutRounding = true; line.X1 = startPoint.X; line.X2 = endPoint.X; line.Y1 = startPoint.Y; line.Y2 = endPoint.Y; Canvas.SetZIndex(line, (int)pen.ZIndex); line.StrokeThickness = pen.Thickness; line.Visibility = BoolToVisibility(owner.IsVisible); Canvas.Children.Add(line); OwnershipDictionary.Add(line, owner); }