| 1 31 package org.pdfbox.pdmodel.graphics.color; 32 33 import java.awt.color.ColorSpace ; 34 import java.awt.image.ColorModel ; 35 36 import java.io.IOException ; 37 38 import org.pdfbox.cos.COSArray; 39 import org.pdfbox.cos.COSBase; 40 import org.pdfbox.cos.COSName; 41 import org.pdfbox.pdmodel.common.function.PDFunction; 42 43 49 public class PDSeparation extends PDColorSpace 50 { 51 54 public static final String NAME = "Separation"; 55 56 private COSArray array; 57 58 61 public PDSeparation() 62 { 63 array = new COSArray(); 64 array.add( COSName.getPDFName( NAME ) ); 65 array.add( COSName.getPDFName( "" ) ); 66 } 67 68 73 public PDSeparation( COSArray separation ) 74 { 75 array = separation; 76 } 77 78 84 public String getName() 85 { 86 return NAME; 87 } 88 89 96 public int getNumberOfComponents() throws IOException  97 { 98 return 1; 99 } 100 101 108 public ColorSpace createColorSpace() throws IOException  109 { 110 throw new IOException ( "Not implemented" ); 111 } 112 113 122 public ColorModel createColorModel( int bpc ) throws IOException  123 { 124 throw new IOException ( "Not implemented" ); 125 } 126 127 132 public String getColorantName() 133 { 134 COSName name = (COSName)array.getObject( 1 ); 135 return name.getName(); 136 } 137 138 143 public void setColorantName( String name ) 144 { 145 array.set( 1, COSName.getPDFName( name ) ); 146 } 147 148 155 public PDColorSpace getAlternateColorSpace() throws IOException  156 { 157 COSBase alternate = array.getObject( 2 ); 158 return PDColorSpaceFactory.createColorSpace( alternate ); 159 } 160 161 166 public void setAlternateColorSpace( PDColorSpace cs ) 167 { 168 COSBase space = null; 169 if( cs != null ) 170 { 171 space = cs.getCOSObject(); 172 } 173 array.set( 2, space ); 174 } 175 176 183 public PDFunction getTintTransform() throws IOException  184 { 185 return PDFunction.create( array.get( 3 ) ); 186 } 187 188 193 public void setTintTransform( PDFunction tint ) 194 { 195 array.set( 3, tint ); 196 } 197 } | Popular Tags |