Ejemplo n.º 1
0
 /// <summary>
 /// Adds a Cairo path that represents a pair of X cursor markers aligned at the current Cairo position.
 /// </summary>
 private void AddXCursorMarkerPairPathFromCurrentPosition(PointD topMarkerPosition, PointD bottomMarkerPosition,
                                                          ScopeHorizontalAlignment horizontalAlignment)
 {
     Context.MoveTo(bottomMarkerPosition);
     AddXCursorMarkerPathFromCurrentPosition(horizontalAlignment, ScopeVerticalAlignment.Bottom);
     Context.MoveTo(topMarkerPosition);
     AddXCursorMarkerPathFromCurrentPosition(horizontalAlignment, ScopeVerticalAlignment.Top);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Draws a text aligned with a certain distance to the specified user-specific position.
        /// </summary>
        private void DrawText(RectangleRange rectangleRange,
                              string text, PointD position, Color textColor,
                              ScopeHorizontalAlignment horizontalAlignment, ScopeVerticalAlignment verticalAlignment,
                              Distance alignmentDistance)
        {
            var devicePosition = rectangleRange.Matrix.TransformPoint(position);

            DrawText(text, devicePosition, textColor, horizontalAlignment, verticalAlignment,
                     alignmentDistance);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes an instance of this class.
 /// </summary>
 /// <param name="textProvider">A function returning the caption text.</param>
 /// <param name="horizontalAlignment">
 /// The horizontal alignment with respect to the specified alignment reference.
 /// </param>
 /// <param name="verticalAlignment">
 /// The vertical alignment with respect to the specified alignment reference.
 /// </param>
 /// <param name="alignmentReference">
 /// The reference used for horizontal and vertical alignment.</param>
 /// <param name="yieldToMarker">
 /// A value indicating whether to provide additional space for the cursor marker.
 /// </param>
 /// <param name="color">The caption color.</param>
 public ScopePositionCaption(Func <string> textProvider, ScopeHorizontalAlignment horizontalAlignment,
                             ScopeVerticalAlignment verticalAlignment, ScopeAlignmentReference alignmentReference, bool yieldToMarker,
                             Color color)
 {
     TextProvider        = textProvider;
     HorizontalAlignment = horizontalAlignment;
     VerticalAlignment   = verticalAlignment;
     AlignmentReference  = alignmentReference;
     YieldToMarker       = yieldToMarker;
     Color = color;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Draws a text aligned with a certain distance to the specified user-specific position
        /// at the horizontal edge.
        /// </summary>
        private void DrawTextAtHorizontalEdge(RectangleRange rectangleRange,
                                              string text, double xPosition, Color textColor,
                                              ScopeHorizontalAlignment horizontalAlignment, ScopeVerticalAlignment verticalAlignment,
                                              Distance alignmentDistance)
        {
            var yPosition = verticalAlignment == ScopeVerticalAlignment.Bottom
                ? rectangleRange.MinY : rectangleRange.MaxY;

            DrawText(rectangleRange, text, new PointD(xPosition, yPosition), textColor,
                     horizontalAlignment, verticalAlignment, alignmentDistance);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Adds a Cairo path that represents a Y cursor marker aligned at the current Cairo position.
        /// </summary>
        private void AddYCursorMarkerPathFromCurrentPosition(ScopeHorizontalAlignment horizontalAlignment,
                                                             ScopeVerticalAlignment verticalAlignment)
        {
            var horizontalSign = horizontalAlignment == ScopeHorizontalAlignment.Right
                ? -1 : +1;

            var verticalSign = verticalAlignment == ScopeVerticalAlignment.Bottom
                ? -1 : +1;

            Context.RelLineTo(horizontalSign * _longitudinalCursorMarkerSize, 0);
            Context.RelLineTo(horizontalSign * -_longitudinalCursorMarkerSize / 2, verticalSign * _lateralCursorMarkerSize);
            Context.RelLineTo(horizontalSign * -_longitudinalCursorMarkerSize / 2, 0);
            Context.ClosePath();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Draws a text aligned with a certain distance to the specified device position.
        /// </summary>
        private void DrawText(string text, PointD position, Color textColor,
                              ScopeHorizontalAlignment horizontalAlignment, ScopeVerticalAlignment verticalAlignment,
                              Distance alignmentDistance)
        {
            using (CreateContextState())
            {
                SetFontToStandardSettings();
                var extents = Context.TextExtents(text);

                var deviceDistance = new Distance(
                    horizontalAlignment == ScopeHorizontalAlignment.Right
                    ? -alignmentDistance.Dx - extents.Width : alignmentDistance.Dx,
                    verticalAlignment == ScopeVerticalAlignment.Bottom
                    ? -alignmentDistance.Dy : alignmentDistance.Dy + extents.Height
                    );

                Context.MoveTo(position);
                Context.RelMoveTo(deviceDistance);

                Context.SetSourceColor(textColor);
                Context.ShowText(text);
            }
        }