git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1771002 13f79535-47bb-0310-9956-ffa450edef68pull/57/head
public static PDFICCStream setupsRGBColorProfile(PDFDocument pdfDoc) { | public static PDFICCStream setupsRGBColorProfile(PDFDocument pdfDoc) { | ||||
ICC_Profile profile; | ICC_Profile profile; | ||||
PDFICCStream sRGBProfile = pdfDoc.getFactory().makePDFICCStream(); | PDFICCStream sRGBProfile = pdfDoc.getFactory().makePDFICCStream(); | ||||
InputStream in = PDFDocument.class.getResourceAsStream("sRGB Color Space Profile.icm"); | |||||
InputStream in = PDFDocument.class.getResourceAsStream("sRGB.icc"); | |||||
if (in != null) { | if (in != null) { | ||||
try { | try { | ||||
profile = ColorProfileUtil.getICC_Profile(in); | profile = ColorProfileUtil.getICC_Profile(in); |
Obtained from: http://www.srgb.com/usingsrgb.html | |||||
The file "sRGB Color Space Profile.icm" is: | |||||
Copyright (c) 1998 Hewlett-Packard Company | |||||
To anyone who acknowledges that the file "sRGB Color Space Profile.icm" | |||||
is provided "AS IS" WITH NO EXPRESS OR IMPLIED WARRANTY: | |||||
permission to use, copy and distribute this file for any purpose is hereby | |||||
granted without fee, provided that the file is not changed including the HP | |||||
copyright notice tag, and that the name of Hewlett-Packard Company not be | |||||
used in advertising or publicity pertaining to distribution of the software | |||||
without specific, written prior permission. Hewlett-Packard Company makes | |||||
no representations about the suitability of this software for any purpose. | |||||
The profiles in the base directory are provided according to different licenses. | |||||
Group A | |||||
sRGB, LCMSLAB.ICM, LCMSXYZ.ICM, the compatibleWithAdobeRGB.icc and the | |||||
Gray.icc, CineonLog_M*.icc, CineLogCurve.icc profiles are all zlib licensed. | |||||
Even though it is highly recommended to rename them before editing. | |||||
Group B | |||||
The eciRGB*.icc profiles come with their license in license.rtf. | |||||
Group C | |||||
PhotoGamutRGB_avg6c.icc is licensed to be distributed freely. Modifications | |||||
are not allowed. | |||||
Additionally all profiles come with the following disclaimer. The provided | |||||
ICC Profiles in the package are called DATA in the folling statement. | |||||
NO WARRANTY | |||||
BECAUSE THE DATA IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | |||||
FOR THE DATA, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN | |||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES | |||||
PROVIDE THE DATA "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED | |||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS | |||||
TO THE QUALITY AND PERFORMANCE OF THE DATA IS WITH YOU. SHOULD THE | |||||
DATA PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, | |||||
REPAIR OR CORRECTION. | |||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | |||||
REDISTRIBUTE THE DATA AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, | |||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING | |||||
OUT OF THE USE OR INABILITY TO USE THE DATA (INCLUDING BUT NOT LIMITED | |||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY | |||||
YOU OR THIRD PARTIES OR A FAILURE OF THE DATA TO OPERATE WITH ANY OTHER | |||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE | |||||
POSSIBILITY OF SUCH DAMAGES. | |||||
The zlib/libpng License | |||||
Copyright (c) 2008 Kai-Uwe Behrmann | |||||
This software is provided 'as-is', without any express or implied | |||||
warranty. In no event will the authors be held liable for any damages | |||||
arising from the use of this software. | |||||
Permission is granted to anyone to use this software for any purpose, | |||||
including commercial applications, and to alter it and redistribute it | |||||
freely, subject to the following restrictions: | |||||
1. The origin of this software must not be misrepresented; you must not | |||||
claim that you wrote the original software. If you use this software | |||||
in a product, an acknowledgment in the product documentation would be | |||||
appreciated but is not required. | |||||
2. Altered source versions must be plainly marked as such, and must not be | |||||
misrepresented as being the original software. | |||||
3. This notice may not be removed or altered from any source | |||||
distribution. | |||||
Included are profiles created by Marti Maria (littleCMS) <http://www.littlecms.com>: | |||||
# CIE*Lab | |||||
# CIE*XYZ | |||||
# sRGB | |||||
Various contributors: | |||||
# LStar-RGB from ColorSolutions <http://hwww.basICColor.com> | |||||
# Photogamut-RGB from the Photogamut workgroup <http://www.photogamut.org> | |||||
# Cineon and Gray from Kai-Uwe Behrmann <http://www.behrmann.name> | |||||
# compatibleWithAdobeRGB1998 from Graeme Gill <http://www.argyllcms.com> |
public void testRGBICC() throws Exception { | public void testRGBICC() throws Exception { | ||||
FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); | FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); | ||||
// [TBD] FIXME - use getResource() to access profile [GA] | // [TBD] FIXME - use getResource() to access profile [GA] | ||||
URI sRGBLoc = new URI("../fop-core/src/main/resources/org/apache/fop/pdf/sRGB%20Color%20Space%20Profile.icm"); | |||||
URI sRGBLoc = new URI("../fop-core/src/main/resources/org/apache/fop/pdf/sRGB.icc"); | |||||
ColorSpace cs = fopFactory.getColorSpaceCache().get( | ColorSpace cs = fopFactory.getColorSpaceCache().get( | ||||
"sRGBAlt", sRGBLoc.toASCIIString(), RenderingIntent.AUTO); | "sRGBAlt", sRGBLoc.toASCIIString(), RenderingIntent.AUTO); | ||||
assertNotNull("Color profile not found", cs); | assertNotNull("Color profile not found", cs); |
</fo:simple-page-master> | </fo:simple-page-master> | ||||
</fo:layout-master-set> | </fo:layout-master-set> | ||||
<fo:declarations> | <fo:declarations> | ||||
<fo:color-profile src="../../../fop-core/src/main/resources/org/apache/fop/pdf/sRGB Color Space Profile.icm" color-profile-name="sRGB"/> | |||||
<fo:color-profile src="../../../fop-core/src/main/resources/org/apache/fop/pdf/sRGB.icc" color-profile-name="sRGB"/> | |||||
<fo:color-profile src="nonexistent.icc" color-profile-name="unknown"/> | <fo:color-profile src="nonexistent.icc" color-profile-name="unknown"/> | ||||
</fo:declarations> | </fo:declarations> | ||||
<fo:page-sequence master-reference="normal" white-space-collapse="true"> | <fo:page-sequence master-reference="normal" white-space-collapse="true"> | ||||
<eval expected="#ff0000" xpath="//block[1]//text/@color"/> | <eval expected="#ff0000" xpath="//block[1]//text/@color"/> | ||||
<eval expected="#ff8000" xpath="//block[2]//text/@color"/> | <eval expected="#ff8000" xpath="//block[2]//text/@color"/> | ||||
<eval expected="#ff8000" xpath="//block[3]//text/@color"/> | <eval expected="#ff8000" xpath="//block[3]//text/@color"/> | ||||
<eval expected="fop-rgb-icc(1.0,0.5,0.0,sRGB,"../../../fop-core/src/main/resources/org/apache/fop/pdf/sRGB Color Space Profile.icm",1.0,0.5,0.0)" xpath="//block[4]//text/@color"/> | |||||
<eval expected="fop-rgb-icc(1.0,0.5,0.0,sRGB,"../../../fop-core/src/main/resources/org/apache/fop/pdf/sRGB.icc",1.0,0.5,0.0)" xpath="//block[4]//text/@color"/> | |||||
<eval expected="#00ff00" xpath="//block[5]//text/@color"/> | <eval expected="#00ff00" xpath="//block[5]//text/@color"/> | ||||
<eval expected="fop-rgb-icc(0.6,0.6,0.48000002,#CMYK,,0.0,0.0,0.2,0.4)" xpath="//block[6]//text/@color"/> | <eval expected="fop-rgb-icc(0.6,0.6,0.48000002,#CMYK,,0.0,0.0,0.2,0.4)" xpath="//block[6]//text/@color"/> | ||||
<eval expected="fop-rgb-icc(0.6,0.6,0.4,#CMYK,,0.0,0.0,0.2,0.4)" xpath="//block[7]//text/@color"/> | <eval expected="fop-rgb-icc(0.6,0.6,0.4,#CMYK,,0.0,0.0,0.2,0.4)" xpath="//block[7]//text/@color"/> |