コード例 #1
0
        private Point[] GetPointList()
        {
            Point[] points = new Point[GetPointCount()];

            unsafe
            {
                fixed(Point *pPoints = points)
                {
                    EllipseGeometry.GetPointList(pPoints, GetPointCount(), Center, RadiusX, RadiusY);
                }
            }

            return(points);
        }
コード例 #2
0
        internal static Rect GetBoundsHelper(Pen pen, Matrix worldMatrix, Point center, double radiusX, double radiusY,
                                             Matrix geometryMatrix, double tolerance, ToleranceType type)
        {
            Rect rect;

            Debug.Assert(worldMatrix != null);
            Debug.Assert(geometryMatrix != null);

            if ((pen == null || pen.DoesNotContainGaps) &&
                worldMatrix.IsIdentity && geometryMatrix.IsIdentity)
            {
                double strokeThickness = 0.0;

                if (Pen.ContributesToBounds(pen))
                {
                    strokeThickness = Math.Abs(pen.Thickness);
                }

                rect = new Rect(
                    center.X - Math.Abs(radiusX) - 0.5 * strokeThickness,
                    center.Y - Math.Abs(radiusY) - 0.5 * strokeThickness,
                    2.0 * Math.Abs(radiusX) + strokeThickness,
                    2.0 * Math.Abs(radiusY) + strokeThickness);
            }
            else
            {
                unsafe
                {
                    Point *pPoints = stackalloc Point[(int)c_pointCount];
                    EllipseGeometry.GetPointList(pPoints, c_pointCount, center, radiusX, radiusY);

                    fixed(byte *pTypes = EllipseGeometry.s_roundedPathTypes)
                    {
                        rect = Geometry.GetBoundsHelper(
                            pen,
                            &worldMatrix,
                            pPoints,
                            pTypes,
                            c_pointCount,
                            c_segmentCount,
                            &geometryMatrix,
                            tolerance,
                            type,
                            false); // skip hollows - meaningless here, this is never a hollow
                    }
                }
            }

            return(rect);
        }
コード例 #3
0
        internal override bool ContainsInternal(Pen pen, Point hitPoint, double tolerance, ToleranceType type)
        {
            unsafe
            {
                Point *pPoints = stackalloc Point[(int)GetPointCount()];
                EllipseGeometry.GetPointList(pPoints, GetPointCount(), Center, RadiusX, RadiusY);

                fixed(byte *pTypes = GetTypeList())
                {
                    return(ContainsInternal(
                               pen,
                               hitPoint,
                               tolerance,
                               type,
                               pPoints,
                               GetPointCount(),
                               pTypes,
                               GetSegmentCount()));
                }
            }
        }