예제 #1
0
        /// <summary>
        /// Returns the axis-aligned bounding rectangle when stroked with a pen, after applying
        /// the supplied transform (if non-null).
        /// </summary>
        internal override Rect GetBoundsInternal(Pen pen, Matrix worldMatrix, double tolerance, ToleranceType type)
        {
            Matrix geometryMatrix;

            Transform.GetTransformValue(Transform, out geometryMatrix);

            return(LineGeometry.GetBoundsHelper(
                       pen,
                       worldMatrix,
                       StartPoint,
                       EndPoint,
                       geometryMatrix,
                       tolerance,
                       type));
        }
        /// <summary>
        ///     DrawLine -
        ///     Draws a line with the specified pen.
        ///     Note that this API does not accept a Brush, as there is no area to fill.
        /// </summary>
        /// <param name="pen"> The Pen with which to stroke the line. </param>
        /// <param name="point0"> The start Point for the line. </param>
        /// <param name="point1"> The end Point for the line. </param>
        public override void DrawLine(
            Pen pen,
            Point point0,
            Point point1)
        {
            if (Pen.ContributesToBounds(pen))
            {
                // _bounds is always in "world" space
                // So, we need to transform the geometry to world to bound it
                Rect geometryBounds = LineGeometry.GetBoundsHelper(
                    pen,
                    _transform, // world transform
                    point0,
                    point1,
                    Matrix.Identity, // geometry transform
                    Geometry.StandardFlatteningTolerance,
                    ToleranceType.Absolute
                    );

                AddTransformedBounds(ref geometryBounds);
            }
        }