public override void WriteFunctionDictionary(PDFContextBase context, PDFWriter writer) { writer.BeginDictionary(); writer.WriteDictionaryNumberEntry("FunctionType", 2); writer.BeginDictionaryEntry("Domain"); writer.WriteArrayRealEntries(this.DomainStart, this.DomainEnd); writer.EndDictionaryEntry(); writer.BeginDictionaryEntry("C0"); writer.WriteArrayRealEntries(this.ColorZero.Red.Value, this.ColorZero.Green.Value, this.ColorZero.Blue.Value); writer.EndDictionaryEntry(); writer.BeginDictionaryEntry("C1"); writer.WriteArrayRealEntries(this.ColorOne.Red.Value, this.ColorOne.Green.Value, this.ColorOne.Blue.Value); writer.EndDictionaryEntry(); writer.WriteDictionaryRealEntry("N", this.Exponent); writer.EndDictionary(); //function }
// // methods // #region protected override PDFObjectRef DoRenderToPDF(PDFContextBase context, PDFWriter writer) /// <summary> /// Renders the tiling image /// </summary> /// <param name="context"></param> /// <param name="writer"></param> /// <returns></returns> protected override PDFObjectRef DoRenderToPDF(PDFContextBase context, PDFWriter writer) { IStreamFilter[] filters = writer.DefaultStreamFilters; PDFObjectRef pattern = writer.BeginObject(); writer.BeginDictionary(); writer.WriteDictionaryNameEntry("Type", "Pattern"); writer.WriteDictionaryNumberEntry("PatternType", (int)this.PatternType); writer.WriteDictionaryNumberEntry("PaintType", (int)this.PaintType); writer.WriteDictionaryNumberEntry("TilingType", (int)this.TilingType); writer.BeginDictionaryEntry("BBox"); PDFPoint offset = new PDFPoint(this.Start.X, this.Start.Y - this.ImageSize.Height);// this.Start; PDFSize size = this.ImageSize; PDFSize graphicsSize = new PDFSize(size.Width + offset.X, size.Height + offset.Y); writer.WriteArrayRealEntries(true, offset.X.PointsValue, offset.Y.PointsValue, offset.X.PointsValue + size.Width.PointsValue, offset.Y.PointsValue + size.Height.PointsValue); writer.EndDictionaryEntry(); writer.WriteDictionaryRealEntry("XStep", this.Step.Width.PointsValue); writer.WriteDictionaryRealEntry("YStep", this.Step.Height.PointsValue); PDFObjectRef all = this.Resources.WriteResourceList(context, writer); writer.WriteDictionaryObjectRefEntry("Resources", all); writer.BeginStream(pattern); using (PDFGraphics g = PDFGraphics.Create(writer, false, this, DrawingOrigin.TopLeft, graphicsSize, context)) { offset = new PDFPoint(offset.X, 0.0); g.PaintImageRef(this.Image, size, offset); } long len = writer.EndStream(); if (null != filters && filters.Length > 0) { writer.BeginDictionaryEntry("Length"); writer.WriteNumberS(len); writer.EndDictionaryEntry(); writer.BeginDictionaryEntry("Filter"); writer.BeginArray(); foreach (IStreamFilter filter in filters) { writer.BeginArrayEntry(); writer.WriteName(filter.FilterName); writer.EndArrayEntry(); } writer.EndArray(); writer.EndDictionaryEntry(); } else { writer.BeginDictionaryEntry("Length"); writer.WriteNumberS(len); writer.EndDictionaryEntry(); } writer.EndDictionary(); writer.EndObject(); return(pattern); }