iTextSharp.text.pdf.PdfFunction.Type2 C# (CSharp) Метод

Type2() публичный статический Метод

public static Type2 ( PdfWriter writer, float domain, float range, float c0, float c1, float n ) : PdfFunction
writer PdfWriter
domain float
range float
c0 float
c1 float
n float
Результат PdfFunction
        public static PdfFunction Type2(PdfWriter writer, float[] domain, float[] range, float[] c0, float[] c1, float n) {
            PdfFunction func = new PdfFunction(writer);
            func.dictionary = new PdfDictionary();
            func.dictionary.Put(PdfName.FUNCTIONTYPE, new PdfNumber(2));
            func.dictionary.Put(PdfName.DOMAIN, new PdfArray(domain));
            if (range != null)
                func.dictionary.Put(PdfName.RANGE, new PdfArray(range));
            if (c0 != null)
                func.dictionary.Put(PdfName.C0, new PdfArray(c0));
            if (c1 != null)
                func.dictionary.Put(PdfName.C1, new PdfArray(c1));
            func.dictionary.Put(PdfName.N, new PdfNumber(n));
            return func;
        }

Usage Example

Пример #1
0
 protected internal PdfObject GetSpotObject(PdfWriter writer) {
     PdfArray array = new PdfArray(PdfName.SEPARATION);
     array.Add(name);
     PdfFunction func = null;
     if (altcs is ExtendedColor) {
         int type = ((ExtendedColor)altcs).Type;
         switch (type) {
             case ExtendedColor.TYPE_GRAY:
                 array.Add(PdfName.DEVICEGRAY);
                 func = PdfFunction.Type2(writer, new float[]{0, 1}, null, new float[]{0}, new float[]{((GrayColor)altcs).Gray}, 1);
                 break;
             case ExtendedColor.TYPE_CMYK:
                 array.Add(PdfName.DEVICECMYK);
                 CMYKColor cmyk = (CMYKColor)altcs;
                 func = PdfFunction.Type2(writer, new float[]{0, 1}, null, new float[]{0, 0, 0, 0},
                     new float[]{cmyk.Cyan, cmyk.Magenta, cmyk.Yellow, cmyk.Black}, 1);
                 break;
             default:
                 throw new Exception("Only RGB, Gray and CMYK are supported as alternative color spaces.");
         }
     }
     else {
         array.Add(PdfName.DEVICERGB);
         func = PdfFunction.Type2(writer, new float[]{0, 1}, null, new float[]{1, 1, 1},
             new float[]{(float)altcs.R / 255, (float)altcs.G / 255, (float)altcs.B / 255}, 1);
     }
     array.Add(func.Reference);
     return array;
 }
All Usage Examples Of iTextSharp.text.pdf.PdfFunction::Type2