Author: tilman Date: Sat Mar 8 13:16:35 2014 New Revision: 1575539 URL: http://svn.apache.org/r1575539 Log: PDFBOX-1966: Type 1, 4 and 5 shadings for shFill(); use transparency for type 6 and 7; DRY principle will be applied later
Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java?rev=1575539&r1=1575538&r2=1575539&view=diff ============================================================================== --- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java (original) +++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java Sat Mar 8 13:16:35 2014 @@ -42,11 +42,17 @@ import org.apache.pdfbox.pdmodel.common. import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.graphics.PDGraphicsState; import org.apache.pdfbox.pdmodel.graphics.PDShading; -import org.apache.pdfbox.pdmodel.graphics.shading.AxialShadingPaint; import org.apache.pdfbox.pdmodel.graphics.shading.PDShadingResources; +import org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType1; import org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType2; import org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType3; +import org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType4; +import org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType5; +import org.apache.pdfbox.pdmodel.graphics.shading.Type1ShadingPaint; +import org.apache.pdfbox.pdmodel.graphics.shading.AxialShadingPaint; import org.apache.pdfbox.pdmodel.graphics.shading.RadialShadingPaint; +import org.apache.pdfbox.pdmodel.graphics.shading.Type4ShadingPaint; +import org.apache.pdfbox.pdmodel.graphics.shading.Type5ShadingPaint; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream; @@ -571,9 +577,8 @@ public class PageDrawer extends PDFStrea switch (shadingType) { case 1: - // TODO - LOG.debug("Function based shading not yet supported"); - break; + paint = new Type1ShadingPaint((PDShadingType1)shading, ctm, pageSize.height); + break; case 2: paint = new AxialShadingPaint((PDShadingType2)shading, ctm, pageSize.height); break; @@ -581,11 +586,16 @@ public class PageDrawer extends PDFStrea paint = new RadialShadingPaint((PDShadingType3)shading, ctm, pageSize.height); break; case 4: + paint = new Type4ShadingPaint((PDShadingType4)shading, ctm, pageSize.height); + break; case 5: + paint = new Type5ShadingPaint((PDShadingType5)shading, ctm, pageSize.height); + break; case 6: case 7: // TODO LOG.debug("Shading type "+shadingType+" not yet supported"); + paint = new Color(0, 0, 0, 0); // transparent break; default: throw new IOException("Invalid ShadingType " + shadingType + " for Shading " + shadingName);