Hi Again, I have been playing with this today and found a possible way to implement a transparent gradient working from the example here: http://1t3xt.info/examples/browse/?page=example&id=414
This is the output I am getting with following code: http://al.chemy.org/misc/TransparentGradientCurrentOutput.pdf http://al.chemy.org/misc/TransparentGradient.java And this is what I am aiming to get: http://al.chemy.org/misc/TransparentGradientDesiredOutput.pdf As you can see there is quite a difference. I am not sure if this is the right way to go about it, or even if a gradient can be used as an SOFT MASK? Thanks in advance, Karl On 2009/04/09, at 15:07, 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! > > > > As far as I can see, the change breaks other examples... > Yes you are right. > It worked straight away in Apple's default PDF reader Preview, but > unfortunately I didn't test it fully on Windows etc... > Different PDF readers seem to react differently. > The worst case scenario is that the files will not even open, > otherwise only the transparency may be lost and the colour maintained. > > I am still interested in implementing this, and have mocked up a > transparent gradient in Adobe Illustrator and checked the pdf output. > In general the output is very bloated compared to iText, but it > looks like a shape is drawn with a transparent mask on top of it (as > opposed to using the straight ARGB colours I plugged in last time). > The relevant tags in the pdf go something like this: > <</I false/K false/CS/DeviceRGB/S/Transparency>> > .. > <</OPM 1/BM/Normal/CA 1.0/OP false/SMask 18 0 R/ca 1.0/AIS false/op > false/Type/ExtGState/SA true>> > .. > <</G 17 0 R/S/Luminosity/Type/Mask/BC 19 0 R>> > .. > <</Subtype/Form/Length 67/Matrix[1.0 0.0 0.0 1.0 0.0 0.0]/Group 8 0 > R/Resources<</XObject<</Fm0 16 0 R>>/ExtGState<</GS0 21 0 R>>>>/ > BBox[455.781 456.219 579.219 332.781]>>stream > > The file itself is here (a 123x123 box at x456 y456): > http://al.chemy.org/misc/GradientTransparencyAiTest.pdf > > So my question is... what do you think is the best way to implement > this functionality using Graphics2D? > Either with a workaround in the application or by extending iText > itself. > > Thank you again for your time! > I really appreciate it. > > Best, > Karl > > - > Alchemy > An open drawing project > http://al.chemy.org > - > > > ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php