Example #1
0
        /// <summary>
        /// General routine for adding a Primitive to DisplayList
        /// 1) Apply transformation to Geometry, Brush, Pen
        /// 2) Optimize Primitive
        /// 3) Add to DisplayList
        /// </summary>
        /// <param name="p"></param>
        public void AddPrimitive(Primitive p)
        {
            if (p.IsTransparent)
            {
                return;
            }

            p.ApplyTransform();

            if (!p.Optimize())
            {
                return;
            }

            GeometryPrimitive gp = p as GeometryPrimitive;

            if (gp != null)
            {
                if ((gp.Pen != null) && (gp.Pen.StrokeBrush.Brush is DrawingBrush))
                {
                    gp.Widen();
                }
            }

            _dl.RecordPrimitive(p);
        }