Bug 48167 - [PATCH] CMYK colors converted to RGB when not provided <fo:declarations> tag
Summary: [PATCH] CMYK colors converted to RGB when not provided <fo:declarations> tag
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: all
Hardware: PC Windows Vista
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks: 48185
  Show dependency tree
 
Reported: 2009-11-10 07:34 UTC by Venkat Reddy
Modified: 2012-04-01 06:36 UTC (History)
1 user (show)



Attachments
AFP output (RGB color space used for the uncalibrated CMYK) (114.29 KB, image/pjpeg)
2009-11-10 07:34 UTC, Venkat Reddy
Details
cmyk-test input fo document (1.85 KB, text/plain)
2009-11-10 07:37 UTC, Venkat Reddy
Details
Correct Input file, please ignore the previous one (1.83 KB, text/plain)
2009-11-12 02:16 UTC, Venkat Reddy
Details
CMYK Declarations patch (993 bytes, patch)
2009-11-12 06:48 UTC, Venkat Reddy
Details | Diff
patch for PtocaBuilder.java (627 bytes, patch)
2009-11-13 00:17 UTC, Harald G. Henne
Details | Diff
before/after CMYKDeclarations.001.patch.txt (83.61 KB, application/pdf)
2009-11-13 00:38 UTC, Harald G. Henne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Venkat Reddy 2009-11-10 07:34:06 UTC
Created attachment 24512 [details]
AFP output (RGB color space used for the uncalibrated CMYK)

When using uncalibrated CMYK colors in FO file without a declarations tag (no
need to provide the declaration tag for the uncalibrated CMYK colors, as the
color profile source is not a necessary) like....

<fo:block color="rgb-icc(0, 255, 0, #CMYK, 1, 0, 1, 0)">GREEN TEXT</fo:block>
<fo:block color="rgb-icc(0, 255, 255, #CMYK, 1, 0, 0, 0)">CYAN TEXT</fo:block>

When trying to generate a AFP output, and the AFP renderer is using RGB color
space instead of CMYK color space..

When declarations tag is used, it is generating AFP output with CMYK color
space.

Please find the input file and output attached to this bug.
Comment 1 Venkat Reddy 2009-11-10 07:37:11 UTC
Created attachment 24513 [details]
cmyk-test input fo document
Comment 2 Harald G. Henne 2009-11-10 09:49:12 UTC
- my trunk output just contains CMYK and no RGB
- could you please provide me your binary afp output file for futher analysis 


$ grep -A2 Color  cmyk-test.dmp
          0x81: SEC Set Extended Color [14]
                Reserved: 00 
                ColSpace: 0x04 (CMYK)
--
          0x81: SEC Set Extended Color [14]
                Reserved: 00 
                ColSpace: 0x04 (CMYK)
--
          0x81: SEC Set Extended Color [14]
                Reserved: 00 
                ColSpace: 0x04 (CMYK)
--
          0x81: SEC Set Extended Color [14]
                Reserved: 00 
                ColSpace: 0x04 (CMYK)
--
          0x81: SEC Set Extended Color [14]
                Reserved: 00 
                ColSpace: 0x04 (CMYK)
Comment 3 Venkat Reddy 2009-11-12 02:13:47 UTC
Sorry, it was my mistake attached the wrong input file. Please find the newly attached input file for the bug.


(In reply to comment #2)
> - my trunk output just contains CMYK and no RGB
> - could you please provide me your binary afp output file for futher analysis 
> $ grep -A2 Color  cmyk-test.dmp
>           0x81: SEC Set Extended Color [14]
>                 Reserved: 00 
>                 ColSpace: 0x04 (CMYK)
> --
>           0x81: SEC Set Extended Color [14]
>                 Reserved: 00 
>                 ColSpace: 0x04 (CMYK)
> --
>           0x81: SEC Set Extended Color [14]
>                 Reserved: 00 
>                 ColSpace: 0x04 (CMYK)
> --
>           0x81: SEC Set Extended Color [14]
>                 Reserved: 00 
>                 ColSpace: 0x04 (CMYK)
> --
>           0x81: SEC Set Extended Color [14]
>                 Reserved: 00 
>                 ColSpace: 0x04 (CMYK)
Comment 4 Venkat Reddy 2009-11-12 02:16:16 UTC
Created attachment 24521 [details]
Correct Input file, please ignore the previous one
Comment 5 Venkat Reddy 2009-11-12 06:48:38 UTC
Created attachment 24523 [details]
CMYK Declarations patch

This patch resolves the bug, where no declarations tag is necessary for the uncalibrated CMYK.
Comment 6 Chris Bowditch 2009-11-12 09:52:16 UTC
Hi Vincent,

please can you process this patch?

Thanks,

Chris
Comment 7 Harald G. Henne 2009-11-13 00:17:36 UTC
Created attachment 24526 [details]
patch for PtocaBuilder.java

The patch CMYKDeclarations.patch.txt is looking good for me 
but there is additional problem inside PtocaBuilder.setExtendedTextColor().

A CMYK component with value 1.0 becomes to 256 witch does not fit into one
byte. Finally 0x00 is written out at the moment, but 0xff is expected.
Comment 8 Harald G. Henne 2009-11-13 00:38:34 UTC
Created attachment 24527 [details]
before/after CMYKDeclarations.001.patch.txt

- text 'CYAN TEXT' is written out as white color '00 00 00 00' and
  not visible in any afp viewer

- input: <fo:block color="rgb-icc(0, 255, 255, #CMYK, 1, 0, 0, 0)">CYAN TEXT</fo:block>

- output with CMYKDeclarations.patch.txt but wrong color due to interger overflow
          0x81: SEC Set Extended Color [14]
                Reserved: 00 
                ColSpace: 0x04 (CMYK)
                Reserved: 00 00 00 00 
                Size1:    0x08 (8)
                Size2:    0x08 (8)
                Size3:    0x08 (8)
                Size4:    0x08 (8)
                ColValue: 00 00 00 00 
          0xF1: SCFL Set Coded Font Local [1]
                CFLid:     0x01 (1)
          0xC5: SVI Set Variable-Space Char Increment [2]
                Value:    0x000B (11)
          0xDB: TRN Transparent Data [9]
                Text:     "CYAN TEXT"

- output with CMYKDeclarations.patch.txt and CMYKDeclarations.001.patch.txt
          0x81: SEC Set Extended Color [14]
                Reserved: 00 
                ColSpace: 0x04 (CMYK)
                Reserved: 00 00 00 00 
                Size1:    0x08 (8)
                Size2:    0x08 (8)
                Size3:    0x08 (8)
                Size4:    0x08 (8)
                ColValue: FF 00 00 00 
          0xF1: SCFL Set Coded Font Local [1]
                CFLid:     0x01 (1)
          0xC5: SVI Set Variable-Space Char Increment [2]
                Value:    0x000B (11)
          0xDB: TRN Transparent Data [9]
                Text:     "CYAN TEXT"
Comment 9 Venkat Reddy 2009-11-16 04:19:46 UTC
Hi Harald G. Henne,

You are right, I have prepared two different patches( this bug relates to fo:declarations tag is not neccessary for uncalibrated CMYK colors, and the other patch for the bug 48185 will fix the problem you mentioned).

Please check the other bug for the details...

https://issues.apache.org/bugzilla/show_bug.cgi?id=48185

I have enabled the dependency attribute between these two bugs...
Comment 10 Vincent Hennebert 2009-11-23 03:48:27 UTC
Patch applied in rev. 883310:
http://svn.apache.org/viewvc?rev=883310&view=rev

Thanks!
Vincent
Comment 11 Glenn Adams 2012-04-01 06:36:50 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed