Ejemplo n.º 1
0
        /// <summary>
        /// Setups the shading pattern from the specified brush.
        /// </summary>
        internal void SetupFromBrush(XLinearGradientBrush brush, XMatrix matrix, XGraphicsPdfRenderer renderer)
        {
            if (brush == null)
            {
                throw new ArgumentNullException("brush");
            }

            PdfShading shading = new PdfShading(_document);

            shading.SetupFromBrush(brush, renderer);
            Elements[Keys.Shading] = shading;
            //Elements[Keys.Matrix] = new PdfLiteral("[" + PdfEncoders.ToString(matrix) + "]");
            Elements.SetMatrix(Keys.Matrix, matrix);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds the specified shading to this resource dictionary
        /// and returns its local resource name.
        /// </summary>
        public string AddShading(PdfShading shading)
        {
            string name;

            if (!_resources.TryGetValue(shading, out name))
            {
                name = NextShadingName;
                _resources[shading] = name;
                if (shading.Reference == null)
                {
                    Owner._irefTable.Add(shading);
                }
                Shadings.Elements[name] = shading.Reference;
            }
            return(name);
        }