Package de.rototor.pdfbox.graphics2d
Class RGBtoCMYKColorMapper
java.lang.Object
de.rototor.pdfbox.graphics2d.PdfBoxGraphics2DColorMapper
de.rototor.pdfbox.graphics2d.RGBtoCMYKColorMapper
- All Implemented Interfaces:
IPdfBoxGraphics2DColorMapper
Usage:
PdfBoxGraphics2D pdfBoxGraphics2D = new PdfBoxGraphics2D(this.doc, (int) (width), (int) (height)); PdfBoxGraphics2DColorMapper colorMapper = new RGBtoCMYKColorMapper(icc_profile); pdfBoxGraphics2D.setColorMapper(colorMapper);
Where ICC_Profile is an instance of java.awt.color.ICC_Profile that supports a CMYK colorspace. For testing purposes, we're using ISOcoated_v2_300_bas.icc which ships with PDFBox.
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.rototor.pdfbox.graphics2d.IPdfBoxGraphics2DColorMapper
IPdfBoxGraphics2DColorMapper.IColorMapperEnv
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ICC_ColorSpace
private final org.apache.pdfbox.pdmodel.graphics.color.PDICCBased
-
Constructor Summary
ConstructorsConstructorDescriptionRGBtoCMYKColorMapper
(ICC_Profile icc_profile, org.apache.pdfbox.pdmodel.PDDocument document) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.pdfbox.pdmodel.graphics.color.PDColor
mapColor
(Color rgbColor, IPdfBoxGraphics2DColorMapper.IColorMapperEnv env) Map the given Color to a PDColorprivate static float[]
rgbIntToFloat
(int[] rgbInts)
-
Field Details
-
icc_colorspace
-
pdProfile
private final org.apache.pdfbox.pdmodel.graphics.color.PDICCBased pdProfile
-
-
Constructor Details
-
RGBtoCMYKColorMapper
public RGBtoCMYKColorMapper(ICC_Profile icc_profile, org.apache.pdfbox.pdmodel.PDDocument document) throws IOException - Throws:
IOException
-
-
Method Details
-
mapColor
public org.apache.pdfbox.pdmodel.graphics.color.PDColor mapColor(Color rgbColor, IPdfBoxGraphics2DColorMapper.IColorMapperEnv env) Description copied from interface:IPdfBoxGraphics2DColorMapper
Map the given Color to a PDColor- Specified by:
mapColor
in interfaceIPdfBoxGraphics2DColorMapper
- Overrides:
mapColor
in classPdfBoxGraphics2DColorMapper
- Parameters:
rgbColor
- the color to mapenv
- the environment which allow getting the content stream, resources etc.- Returns:
- the mapped color
-
rgbIntToFloat
private static float[] rgbIntToFloat(int[] rgbInts)
-