Esempio n. 1
0
        /// <summary>
        /// Paints the fill using the brush associated with this node.
        /// </summary>
        /// <param name="paintContext">The paint context to use for painting this node.</param>
        protected virtual void PaintFill(P3PaintContext paintContext)
        {
            Device device = paintContext.Device;

            if (renderMode == PathRenderMode.Cached)
            {
                Render(device, GetValidVertexBuffer(device), 0, penStartIndex - 1);
            }
            else
            {
                // Reset the path to flatten
                TEMP_PATH.Reset();
                TEMP_PATH.AddPath(path, false);
                TEMP_PATH.FillMode = FillMode;

                Tesselate(TEMP_PATH, (Brush as SolidBrush).Color.ToArgb(), false, true);
                Render(device, renderList);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Overridden.  See <see cref="P3Node.Paint">P3Node.Paint</see>.
        /// </summary>
        protected override void Paint(PPaintContext paintContext)
        {
            if (path.PointCount > 0)
            {
                P3PaintContext p3PaintContext = paintContext as P3PaintContext;

                // Set the flatness
                flatness = tolerance / paintContext.Scale;

                // Fill the path
                if (Brush != null)
                {
                    PaintFill(p3PaintContext);
                }

                // Draw the stroke
                if (pen != null)
                {
                    PaintStroke(p3PaintContext);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Paints the stroke using the pen associated with this path.
        /// </summary>
        /// <param name="paintContext">The paint context to use for painting this node.</param>
        protected virtual void PaintStroke(P3PaintContext paintContext)
        {
            Device device = paintContext.Device;

            // Reset the path to flatten
            TEMP_PATH.Reset();
            TEMP_PATH.AddPath(path, false);

            float absLineWidth    = pen.Width * paintContext.Scale;
            bool  renderFlattened = (pen.Width == 0 || absLineWidth < 3);

            if (renderMode == PathRenderMode.Cached)
            {
                if (renderFlattened)
                {
                    Render(device, GetValidVertexBuffer(device), flattenedStartIndex, renderListTypes.Count - 1);
                }
                else
                {
                    Render(device, GetValidVertexBuffer(device), penStartIndex, flattenedStartIndex - 1);
                }
            }
            else
            {
                if (renderFlattened)
                {
                    TEMP_PATH.Flatten(new System.Drawing.Drawing2D.Matrix(), flatness);
                    Render(device, pen.Color.ToArgb(), TEMP_PATH);
                }
                else
                {
                    Tesselate(TEMP_PATH, pen.Color.ToArgb(), true, true);
                    Render(device, renderList);
                }
            }
        }