コード例 #1
0
ファイル: PdfFunction.cs プロジェクト: Daoting/dt
        /// <summary>
        /// Type2s the specified domain.
        /// </summary>
        /// <param name="domain">The domain.</param>
        /// <param name="range">The range.</param>
        /// <param name="n">The n.</param>
        /// <param name="c0">The c0.</param>
        /// <param name="c1">The c1.</param>
        /// <returns></returns>
        public static PdfDictionary Type2(float[] domain, float[] range, float n, float[] c0, float[] c1)
        {
            if (domain == null)
            {
                throw new PdfArgumentNullException("domain");
            }
            PdfVersionDependDictionary dictionary2 = new PdfVersionDependDictionary();

            dictionary2.Add(PdfName.FunctionType, PdfNumber.Two);
            dictionary2.Add(PdfName.Domain, PdfArray.Convert(domain));
            dictionary2.Add(PdfName.N, new PdfNumber((double)n));
            PdfVersionDependDictionary dictionary = dictionary2;

            if (range != null)
            {
                dictionary.Add(PdfName.Range, PdfArray.Convert(range));
            }
            if (c0 != null)
            {
                dictionary.Add(PdfName.C0, PdfArray.Convert(c0));
            }
            if (c1 != null)
            {
                dictionary.Add(PdfName.C1, PdfArray.Convert(c1));
            }
            dictionary.PdfVersion = PdfVersion.PDF1_3;
            return(dictionary);
        }
コード例 #2
0
ファイル: PdfFunction.cs プロジェクト: Daoting/dt
        /// <summary>
        /// Type3s the specified domain.
        /// </summary>
        /// <param name="domain">The domain.</param>
        /// <param name="range">The range.</param>
        /// <param name="functions">The functions.</param>
        /// <param name="bounds">The bounds.</param>
        /// <param name="encode">The encode.</param>
        /// <returns></returns>
        public static PdfDictionary Type3(float[] domain, float[] range, PdfObjectBase[] functions, float[] bounds, float[] encode)
        {
            if (domain == null)
            {
                throw new PdfArgumentNullException("domain");
            }
            if (functions == null)
            {
                throw new PdfArgumentNullException("functions");
            }
            if (bounds == null)
            {
                throw new PdfArgumentNullException("bounds");
            }
            if (encode == null)
            {
                throw new PdfArgumentNullException("encode");
            }
            PdfVersionDependDictionary dictionary2 = new PdfVersionDependDictionary();

            dictionary2.Add(PdfName.FunctionType, PdfNumber.Three);
            dictionary2.Add(PdfName.Domain, PdfArray.Convert(domain));
            dictionary2.Add(PdfName.Functions, new PdfArray(functions));
            dictionary2.Add(PdfName.Bounds, PdfArray.Convert(bounds));
            dictionary2.Add(PdfName.Encode, PdfArray.Convert(encode));
            PdfVersionDependDictionary dictionary = dictionary2;

            if (range != null)
            {
                dictionary.Add(PdfName.Range, PdfArray.Convert(range));
            }
            dictionary.PdfVersion = PdfVersion.PDF1_3;
            return(dictionary);
        }