You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "James Burton (JIRA)" <ji...@apache.org> on 2013/10/30 01:57:25 UTC

[jira] [Commented] (FOP-2309) [PATCH] Unfinished PCL Color printing patch

    [ https://issues.apache.org/jira/browse/FOP-2309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13808636#comment-13808636 ] 

James Burton commented on FOP-2309:
-----------------------------------

Forgot to mention, I was trying to decrease the data going to the printer by converting from 24 rgb based image to palette base image (1, 2, 4 or 8 bit).  In the patch, in the large chunk of commented out code you will find color counting and then setting up a palette based image and rendering to it.   But no matter what I do, it always dithers.  I tried setting hints, but to no avail.  My awt knowledge is limited.  Any suggestions would be appreciated.  The swt version I wrote a while back works fine.  See below.

       ....if (colors<=256)
        {
            int depth=1;

            for ( ; colors>(1<<depth); )
                depth*=2;

            int max_colors=1<<depth;

            RGB[] new_rgb = new RGB[max_colors];

            int i;
            for (i=0; i<colors; i++)
                new_rgb[i]=rgb[i];
            for ( ; i<max_colors; i++)
                new_rgb[i]=new RGB(255,255,255);

            final PaletteData palette = new PaletteData(new_rgb);
            ImageData new_data = new ImageData(imageData.width, imageData.height, depth, palette);
            Image new_image = new Image(Display.getDefault(), new_data);

            Transform t = new Transform(new_image.getDevice());
            t.translate(-leftClip,  0);
            GC gc = new GC(new_image);
            gc.setTransform(t);
            gc.drawImage(image, 0,  0);
            t.dispose();
            gc.dispose();
            renderImage(new_image.getImageData(), 0, dpi);
            new_image.dispose();
        } ...


> [PATCH] Unfinished PCL Color printing patch
> -------------------------------------------
>
>                 Key: FOP-2309
>                 URL: https://issues.apache.org/jira/browse/FOP-2309
>             Project: Fop
>          Issue Type: Improvement
>          Components: pcl, svg
>    Affects Versions: 1.1
>         Environment: I'm currently testing in windows only, but should apply to all
>            Reporter: James Burton
>              Labels: patch
>             Fix For: 1.1
>
>         Attachments: ColorDuplexSVG.fop, FOP_1.1_colorPCL.patch
>
>
> This patch adds the following:
>   - Supports color printing
>   - Replaces the run-length compression routine with one that will try run-length, tagged image file format, delta row and if need be unencoded, which ever is smallest.
>   - Handles images set to the left of the printable area, it will clip the image by not sending down those bits.
> The code currently has these issues (and would love suggestions on how to do it):
>   - Need a way to specify if the printer supports color.  You will get garbage if you send color commands to an old black and white printer (although most newer black and white printers will emulate color with greyscale).  It is currently controlled in the code with this line "final boolean printerSupportsColor=true;"
>   - Color images are currently not scaled.  This is because the application I'm writing only expects FOP files with SVG.  And SVG is always rendered to a 300 dpi 24 bit color image before being sent to the PCL module.  This works for me.
>   - Should have a attribute for setting speed vs size of PCL output.



--
This message was sent by Atlassian JIRA
(v6.1#6144)