Esempio n. 1
0
        protected virtual PDFObjectRef RenderShadingDictionary(PDFContextBase context, PDFWriter writer)
        {
            PDFPoint offset = new PDFPoint(this.Start.X, this.Start.Y);// this.Start;
            PDFSize  size   = this.Size;

            PDFSize graphicsSize = new PDFSize(size.Width + offset.X, size.Height + offset.Y);
            var     func         = this._descriptor.GetGradientFunction(offset, size);
            var     coords       = GetCoords(offset, size, _descriptor.Size, _descriptor.XCentre, _descriptor.YCentre);


            writer.BeginDictionaryEntry("Shading");
            writer.BeginDictionary();
            writer.WriteDictionaryNumberEntry("ShadingType", (int)ShadingType.Radial);
            writer.WriteDictionaryNameEntry("ColorSpace", "DeviceRGB");
            writer.WriteDictionaryBooleanEntry("AntiAlias", true);

            writer.BeginDictionaryEntry("BBox");
            writer.WriteArrayRealEntries(true, offset.X.PointsValue,
                                         offset.Y.PointsValue,
                                         offset.X.PointsValue + size.Width.PointsValue,
                                         offset.Y.PointsValue + size.Height.PointsValue);
            writer.EndDictionaryEntry();

            writer.BeginDictionaryEntry("Coords");
            writer.WriteArrayRealEntries(true, coords);
            writer.EndDictionaryEntry();

            writer.BeginDictionaryEntry("Extend");
            writer.BeginArray();

            writer.BeginArrayEntry();
            writer.WriteBooleanS(true);
            writer.EndArrayEntry();

            writer.BeginArrayEntry();
            writer.WriteBooleanS(true);
            writer.EndArrayEntry();

            writer.EndArray();
            writer.EndDictionaryEntry();

            if (null != func)
            {
                writer.BeginDictionaryEntry("Function");
                func.WriteFunctionDictionary(context, writer);
                writer.EndDictionaryEntry();
            }


            writer.EndDictionary();//shading
            return(null);
        }
Esempio n. 2
0
 /// <summary>
 /// Writes the underlying data of the file object to the passed text writer
 /// </summary>
 /// <param name="tw">The text writer object to write data to</param>
 public void WriteData(PDFWriter writer)
 {
     writer.WriteBooleanS(this.Value);
 }