/// <summary>
        ///     DrawEllipse -
        ///     Draw an ellipse with the provided Brush and/or Pen.
        ///     If both the Brush and Pen are null this call is a no-op.
        /// </summary>
        /// <param name="brush">
        ///     The Brush with which to fill the ellipse.
        ///     This is optional, and can be null, in which case no fill is performed.
        /// </param>
        /// <param name="pen">
        ///     The Pen with which to stroke the ellipse.
        ///     This is optional, and can be null, in which case no stroke is performed.
        /// </param>
        /// <param name="center">
        ///     The center of the ellipse to fill and/or stroke.
        /// </param>
        /// <param name="radiusX">
        ///     The radius in the X dimension of the ellipse.
        ///     The absolute value of the radius provided will be used.
        /// </param>
        /// <param name="radiusY">
        ///     The radius in the Y dimension of the ellipse.
        ///     The absolute value of the radius provided will be used.
        /// </param>
        public override void DrawEllipse(
            Brush brush,
            Pen pen,
            Point center,
            Double radiusX,
            Double radiusY)
        {
            if ((brush != null) || Pen.ContributesToBounds(pen))
            {
                // _bounds is always in "world" space
                // So, we need to transform the geometry to world to bound it
                Rect geometryBounds = EllipseGeometry.GetBoundsHelper(
                    pen,
                    _transform, // world transform
                    center,
                    radiusX,
                    radiusY,
                    Matrix.Identity, // geometry transform
                    Geometry.StandardFlatteningTolerance,
                    ToleranceType.Absolute
                    );

                AddTransformedBounds(ref geometryBounds);
            }
        }
Esempio n. 2
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 matrix, double tolerance, ToleranceType type)
        {
            Matrix geometryMatrix;

            Transform.GetTransformValue(Transform, out geometryMatrix);

            return(EllipseGeometry.GetBoundsHelper(
                       pen,
                       matrix,
                       Center,
                       RadiusX,
                       RadiusY,
                       geometryMatrix,
                       tolerance,
                       type));
        }