Return-Path: X-Original-To: apmail-pdfbox-dev-archive@www.apache.org Delivered-To: apmail-pdfbox-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DDA1D11B67 for ; Sun, 1 Jun 2014 01:29:01 +0000 (UTC) Received: (qmail 60766 invoked by uid 500); 1 Jun 2014 01:29:01 -0000 Delivered-To: apmail-pdfbox-dev-archive@pdfbox.apache.org Received: (qmail 60738 invoked by uid 500); 1 Jun 2014 01:29:01 -0000 Mailing-List: contact dev-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list dev@pdfbox.apache.org Received: (qmail 60730 invoked by uid 99); 1 Jun 2014 01:29:01 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jun 2014 01:29:01 +0000 Date: Sun, 1 Jun 2014 01:29:01 +0000 (UTC) From: "Shaola Ren (JIRA)" To: dev@pdfbox.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (PDFBOX-1915) Implement shading with Coons and tensor-product patch meshes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PDFBOX-1915?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] Shaola Ren updated PDFBOX-1915: ------------------------------- Attachment: pass4FlagTest.rar passed the 4 flag test file for shading type 6 code are available at https://bitbucket.org/xinshu/pdfbox.git for web view https://bitbucket.org/xinshu/pdfbox > Implement shading with Coons and tensor-product patch meshes > ------------------------------------------------------------ > > Key: PDFBOX-1915 > URL: https://issues.apache.org/jira/browse/PDFBOX-1915 > Project: PDFBox > Issue Type: Improvement > Components: Rendering > Affects Versions: 1.8.5, 1.8.6, 2.0.0 > Reporter: Tilman Hausherr > Assignee: Shaola Ren > Labels: graphical, gsoc2014, java, math, shading > Fix For: 2.0.0 > > Attachments: CONICAL.pdf, GWG060_Shading_x1a.pdf, HSBWHEEL.pdf, M= cAfee-ShadingType7.pdf, Shadingtype6week1.pdf, TENSOR.pdf, XYZsweep.pdf, as= y-coons-but-really-tensor.pdf, asy-tensor-rainbow.pdf, asy-tensor.pdf, coon= s-function.pdf, coons-function.ps, coons-nofunction-CMYK.pdf, coons-nofunct= ion-CMYK.ps, coons-nofunction-Duotone.pdf, coons-nofunction-Duotone.ps, coo= ns-nofunction-Gray.pdf, coons-nofunction-Gray.ps, coons-nofunction-RGB.pdf,= coons-nofunction-RGB.ps, coons2-function.pdf, coons2-function.ps, eci_alto= na-test-suite-v2_technical_H.pdf, lamp_cairo.pdf, pass4FlagTest.rar, patchC= ases.jpg, patchMap.jpg, shading6ContourTest.rar, shading6Done.rar, updatesh= ading6ContourTest.rar > > > Of the seven shading methods described in the PDF specification, type 6 (= Coons patch meshes) and type 7 (Tensor-product patch meshes) haven't been i= mplemented. I have done type 1, 4 and 5, but I don't know the math for type= 6 and 7. My math days are decades away. > Knowledge prerequisites:=20 > - java, although you don't have to be a java ace, just feel confortable > - math: you should know what "cubic B=C3=A9zier curves", "Degenerate B=C3= =A9zier curves", "bilinear interpolation", "tensor-product", "affine transf= orm matrix" and "Bernstein polynomials" are, or be able to learn it > - maven (basic) > - svn (basic) > - an IDE like Netbeans or Eclipse or IntelliJ (basic) > - ideally, you are either a math student who likes to program, or a compu= ter science student who is specializing in graphics. > A first look at PDFBOX: try the command utility here: > https://pdfbox.apache.org/commandline/#pdfToImage > and use your favorite PDF, or the PDFs mentioned in PDFBOX-615, these hav= e the shading types that are already implemented. > Some simple source code to convert to images: > String filename =3D "blah.pdf"; > PDDocument document =3D PDDocument.loadNonSeq(new File(filename), null); > List pdPages =3D document.getDocumentCatalog().getAllPages(); > int page =3D 0; > for (PDPage pdPage : pdPages) > { > ++page; > BufferedImage bim =3D RenderUtil.convertToImage(pdPage, BufferedImage.TYP= E_BYTE_BINARY, 300); > ImageIO.write(bim, "png", new File(filename+page+".png")); > } > document.close(); > You are not starting from scratch. The implementation of type 4 and 5 sho= ws you how to read parameters from the PDF and set the graphics. You don't = have to learn the complete PDF spec, only 15 pages related to the two shadi= ng types, and 6 pages about shading in general. The PDF specification is he= re: > http://www.adobe.com/devnet/pdf/pdf_reference.html > The tricky parts are: > - decide whether a point(x,y) is inside or outside a patch > - decide the color of a point within the patch > To get an idea about the code, look at the classes GouraudTriangle, Goura= udShadingContext, Type4ShadingContext and Vertex here > https://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apach= e/pdfbox/pdmodel/graphics/shading/ > or download the whole project from the repository. > https://pdfbox.apache.org/downloads.html#scm > If you want to see the existing code in the debugger with a Gouraud shadi= ng, try this file: > http://asymptote.sourceforge.net/gallery/Gouraud.pdf > Testing: > I have attached several example PDFs. To see which one has which shading,= open them with an editor like NOTEPAD++, and search for "/ShadingType" (wi= thout the quotes). If your images are rendering like the example PDFs, then= you were successful. > Optional: > Review and optimize the complete shading package for speed; implement cub= ic spline interpolation for type 0 (sampled) functions (that one is really = low-low priority, see details by looking up "cubic spline interpolation" in= the PDF spec, which tells that it is disregarded in printing, and I don't = have a test PDF). > Mentor: Tilman Hausherr (European timezone, languages: german, english, f= rench) -- This message was sent by Atlassian JIRA (v6.2#6252)