コード例 #1
0
        /// <summary>
        /// Gets the bounds of this PathGeometry as an axis-aligned bounding box with pen and/or transform
        /// </summary>
        internal static Rect GetPathBounds(
            PathGeometryData pathData,
            Pen pen,
            Matrix worldMatrix,
            double tolerance,
            ToleranceType type,
            bool skipHollows)
        {
            if (pathData.IsEmpty())
            {
                return(Rect.Empty);
            }
            else
            {
                MilRectD bounds = PathGeometry.GetPathBoundsAsRB(
                    pathData,
                    pen,
                    worldMatrix,
                    tolerance,
                    type,
                    skipHollows);

                return(bounds.AsRect);
            }
        }
コード例 #2
0
        private bool AreBoundsValid(ref MilRectD bounds)
        {
            if (IsEmpty())
            {
                return(false);
            }

            unsafe
            {
                Debug.Assert((_data != null) && (_data.Length >= sizeof(MIL_PATHGEOMETRY)));
                fixed(byte *pbPathData = _data)
                {
                    MIL_PATHGEOMETRY *pGeometry = (MIL_PATHGEOMETRY *)pbPathData;

                    bool areBoundsValid = (pGeometry->Flags & MilPathGeometryFlags.BoundsValid) != 0;

                    if (areBoundsValid)
                    {
                        bounds = pGeometry->Bounds;
                    }

                    return(areBoundsValid);
                }
            }
        }
コード例 #3
0
        private void CacheBounds(ref MilRectD bounds)
        {
            unsafe
            {
                Debug.Assert((_data != null) && (_data.Length >= sizeof(MIL_PATHGEOMETRY)));
                fixed(byte *pbPathData = _data)
                {
                    MIL_PATHGEOMETRY *pGeometry = (MIL_PATHGEOMETRY *)pbPathData;

                    pGeometry->Flags |= MilPathGeometryFlags.BoundsValid;
                    pGeometry->Bounds = bounds;
                }
            }
        }