Пример #1
0
        internal override PathFigureCollection GetTransformedFigureCollection(Transform transform)
        {
            // Combine the transform argument with the internal transform
            Matrix matrix = GetCombinedMatrix(transform);

            // Get the figure collection
            PathFigureCollection result;

            if (matrix.IsIdentity)
            {
                // There is no need to transform, return the figure collection
                result = Figures;
                if (result == null)
                {
                    result = new PathFigureCollection();
                }
            }
            else
            {
                // Return a transformed copy of the figure collection
                result = new PathFigureCollection();
                PathFigureCollection figures = Figures;
                int count = figures != null ? figures.Count : 0;
                for (int i = 0; i < count; ++i)
                {
                    PathFigure figure = figures.Internal_GetItem(i);
                    result.Add(figure.GetTransformedCopy(matrix));
                }
            }

            Debug.Assert(result != null);
            return(result);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        public void AddGeometry(Geometry geometry)
        {
            if (geometry == null)
            {
                throw new System.ArgumentNullException("geometry");
            }

            if (geometry.IsEmpty())
            {
                return;
            }

            PathFigureCollection figureCollection = geometry.GetPathFigureCollection();

            Debug.Assert(figureCollection != null);

            PathFigureCollection figures = Figures;

            if (figures == null)
            {
                figures = Figures = new PathFigureCollection();
            }

            for (int i = 0; i < figureCollection.Count; ++i)
            {
                figures.Add(figureCollection.Internal_GetItem(i));
            }
        }
Пример #3
0
        /// <summary>
        /// GetPathGeometryData - returns a struct which contains this Geometry represented
        /// as a path geometry's serialized format.
        /// </summary>
        internal override PathGeometryData GetPathGeometryData()
        {
            PathGeometryData data = new PathGeometryData();

            data.FillRule = FillRule;
            data.Matrix   = CompositionResourceManager.TransformToMilMatrix3x2D(Transform);

            if (IsObviouslyEmpty())
            {
                return(Geometry.GetEmptyPathGeometryData());
            }

            ByteStreamGeometryContext ctx = new ByteStreamGeometryContext();

            PathFigureCollection figures = Figures;

            int figureCount = figures == null ? 0 : figures.Count;

            for (int i = 0; i < figureCount; i++)
            {
                figures.Internal_GetItem(i).SerializeData(ctx);
            }

            ctx.Close();
            data.SerializedData = ctx.GetData();

            return(data);
        }
Пример #4
0
        /// <summary>
        /// Returns true if this geometry may have curved segments
        /// </summary>
        public override bool MayHaveCurves()
        {
            PathFigureCollection figures = Figures;

            int count = (figures != null) ? figures.Count : 0;

            for (int i = 0; i < count; i++)
            {
                if (figures.Internal_GetItem(i).MayHaveCurves())
                {
                    return(true);
                }
            }

            return(false);
        }