1 31 package org.pdfbox.pdmodel.graphics.color; 32 33 import java.awt.color.ColorSpace ; 34 import java.awt.color.ICC_ColorSpace ; 35 import java.awt.color.ICC_Profile ; 36 import java.awt.image.ColorModel ; 37 38 import java.io.InputStream ; 39 import java.io.IOException ; 40 41 import org.pdfbox.util.ResourceLoader; 42 43 49 public class PDDeviceCMYK extends PDColorSpace 50 { 51 54 public static final PDDeviceCMYK INSTANCE = new PDDeviceCMYK(); 55 56 59 public static final String NAME = "DeviceCMYK"; 60 61 64 public static final String ABBREVIATED_NAME = "CMYK"; 65 66 private ColorSpace cSpace = null; 67 68 private PDDeviceCMYK() 69 { 70 71 } 72 73 78 public String getName() 79 { 80 return NAME; 81 } 82 83 90 public int getNumberOfComponents() throws IOException 91 { 92 return 4; 93 } 94 95 102 public ColorSpace createColorSpace() throws IOException 103 { 104 if( cSpace == null ) 105 { 106 InputStream profile = null; 107 try 108 { 109 profile = ResourceLoader.loadResource( "Resources/colorspace-profiles/CMYK.pf" ); 110 ICC_Profile iccProfile = ICC_Profile.getInstance( profile ); 111 cSpace = new ICC_ColorSpace ( iccProfile ); 112 } 113 finally 114 { 115 if( profile != null ) 116 { 117 profile.close(); 118 } 119 } 120 } 121 return cSpace; 122 } 123 124 133 public ColorModel createColorModel( int bpc ) throws IOException 134 { 135 throw new IOException ( "Not implemented" ); 136 } 137 } | Popular Tags |