DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42352>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42352

           Summary: Problem with tiff gray render
           Product: Fop
           Version: 0.93
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: svg
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: [EMAIL PROTECTED]


I wrote some code
       final TIFFRenderer render = new TIFFRenderer() {
          protected BufferedImage getBufferedImage(int w, int h) {
            return new BufferedImage(w, h, BufferedImage.TYPE_BYTE_GRAY);
          }
        };
        render.setUserAgent(userAgent);
        userAgent.setRendererOverride(render);

... and try exception
javax.xml.transform.TransformerException: java.lang.ClassCastException
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1430)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:709)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1284)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1262)
        at
com.academsoft.printing.PrintingProtocol.processOutData(PrintingProtocol.java:206)
        at
com.academsoft.printing.PrintingProtocol.processInput(PrintingProtocol.java:173)
        at com.academsoft.printing.Worker.process(Worker.java:48)
        at com.academsoft.printing.Worker.run(Worker.java:68)
Caused by: java.lang.ClassCastException
        at
org.apache.fop.render.bitmap.TIFFRenderer$LazyPageImagesIterator.next(TIFFRenderer.java:234)
        at
org.apache.fop.render.bitmap.TIFFRenderer.stopRenderer(TIFFRenderer.java:166)
        at
org.apache.fop.area.RenderPagesModel.endDocument(RenderPagesModel.java:241)
        at 
org.apache.fop.area.AreaTreeHandler.endDocument(AreaTreeHandler.java:426)
        at org.apache.fop.fo.FOTreeBuilder.endDocument(FOTreeBuilder.java:171)
        at
org.apache.xml.serializer.ToXMLSAXHandler.endDocument(ToXMLSAXHandler.java:181)
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1378)
        ... 7 more

wrote patch

diff -rNu fop-0.93/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java
fop-0.93.orig/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java
--- fop-0.93/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java   
2007-05-08 16:51:02.000000000 +0700
+++ fop-0.93.orig/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java      
2007-01-04 02:44:43.000000000 +0600
@@ -230,11 +230,10 @@
                 return pageImage;
             } else {
                 //Decorate the image with a packed sample model for encoding by
the codec
-              final SampleModel sampleModel = pageImage.getSampleModel();
-//              SinglePixelPackedSampleModel sppsm;
-//                sppsm = 
(SinglePixelPackedSampleModel)pageImage.getSampleModel();
+                SinglePixelPackedSampleModel sppsm;
+                sppsm = 
(SinglePixelPackedSampleModel)pageImage.getSampleModel();

-                int bands = sampleModel.getNumBands();
+                int bands = sppsm.getNumBands();
                 int[] off = new int[bands];
                 int w = pageImage.getWidth();
                 int h = pageImage.getHeight();

and all works.

ps. 
Product:        Fop.
 Component: - no tiff.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to