Thanks for the prompt reply. On 2009/04/04, at 20:40, 1T3XT info wrote:
> Alchemy wrote: >> When drawing to Java Graphics2D It seems like iText does not support >> GradientPaint gradients with transparency? > > You're right, I don't think that's supported. I had a look at the relevant iText code and lucky for me I managed to get it going by only changing one line :) I'm using only RGB at this point so I changed com.lowagie.text.pdf.PdfShading line 145 to also return the alpha value. The full function is below and the new and improved PDF output from my previous example is here: http://al.chemy.org/misc/graphics2D-2.pdf Beautiful isn't it! Thanks again! Karl public static float[] getColorArray(Color color) { int type = ExtendedColor.getType(color); switch (type) { case ExtendedColor.TYPE_GRAY: { return new float[]{((GrayColor)color).getGray()}; } case ExtendedColor.TYPE_CMYK: { CMYKColor cmyk = (CMYKColor)color; return new float[]{cmyk.getCyan(), cmyk.getMagenta(), cmyk.getYellow(), cmyk.getBlack()}; } case ExtendedColor.TYPE_SEPARATION: { return new float[]{((SpotColor)color).getTint()}; } case ExtendedColor.TYPE_RGB: { return new float[]{color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f}; } } throwColorSpaceError(); return null; } ------------------------------------------------------------------------------ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
