Hi all,
I have a mask in a png file and I need to create different objects of
different colors with this same mask.
I am creating on a template a rectangle filled with the required color and
then an image starting from the template. On a content i clip the mask but
then adding the rectangle image the clipping is not working and the full
rectangle appears instead of the masked one.
What I am doing wrong?
Thanks.
This is the code:
over = Pdfwriter.getDirectContent();
over.saveState();
PdfTemplate content = over.createTemplate(186,71);
content.rectangle (0,0, 186, 71);
content.setColorFill(new Color (0x999999));
content.setColorStroke(new Color (0x999999));
content.fillStroke();
Image img = Image.getInstance(content);
Image mask = Image.getInstance("shape03.png");
mask.scaleToFit(187, 71);
over.addImage(mask, mask.getScaledWidth(), 0,0, mask.getScaledHeight(),0,0);
over.clip();
over.newPath();
over.addImage(img,img.getScaledWidth(), 0,0, img.getScaledHeight(),0,0);
over.restoreState();
Cheers,
Matteo
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Image-clipping-tp3166048p3166048.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php