public static PdfShading simpleRadial( PdfWriter writer, float x0, float y0, float r0, float x1, float y1, float r1, BaseColor startColor, BaseColor endColor, boolean extendStart, boolean extendEnd) { checkCompatibleColors(startColor, endColor); PdfFunction function = PdfFunction.type2( writer, new float[] {0, 1}, null, getColorArray(startColor), getColorArray(endColor), 1); return type3( writer, startColor, new float[] {x0, y0, r0, x1, y1, r1}, null, function, new boolean[] {extendStart, extendEnd}); }
protected PdfObject getSpotObject(PdfWriter writer) throws IOException { PdfArray array = new PdfArray(PdfName.SEPARATION); array.add(name); PdfFunction func = null; if (altcs instanceof ExtendedColor) { int type = ((ExtendedColor) altcs).type; // ssteward // having trouble with unreachable bytecode in switch default (per gcj 4.4) // so try a clumsier workaround boolean handled_b = false; 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).getGray()}, 1); handled_b = true; 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.getCyan(), cmyk.getMagenta(), cmyk.getYellow(), cmyk.getBlack() }, 1); handled_b = true; break; // default: // throw new RuntimeException("Only RGB, Gray and CMYK are supported as // alternative color spaces."); } if (!handled_b) { throw new RuntimeException( "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.getRed() / 255, (float) altcs.getGreen() / 255, (float) altcs.getBlue() / 255 }, 1); } array.add(func.getReference()); return array; }