Package org.cip4.jdflib.datatypes
Class JDFCMYKColor
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.Vector<java.lang.Object>
-
- org.cip4.jdflib.datatypes.JDFNumList
-
- org.cip4.jdflib.datatypes.JDFCMYKColor
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<java.lang.Object>,java.util.Collection<java.lang.Object>,java.util.List<java.lang.Object>,java.util.RandomAccess,JDFBaseDataTypes
public class JDFCMYKColor extends JDFNumList
This class is a representation of a CMYK color (JDFCMYKColor). It is a blank separated list of double values consisting of C the cyan color, M the magenta color, Y the yellow color and K the black color value.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.cip4.jdflib.datatypes.JDFNumList
JDFNumList.NormComparator, JDFNumList.VolumeComparator
-
Nested classes/interfaces inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
JDFBaseDataTypes.EnumFitsValue
-
-
Field Summary
-
Fields inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
EPSILON, MAX_CMYK_COLOR, MAX_LAB_COLOR, MAX_MATRIX_DIMENSION, MAX_RECTANGLE_DIMENSION, MAX_RGB_COLOR, MAX_SHAPE_DIMENSION, MAX_XY_DIMENSION
-
-
Constructor Summary
Constructors Constructor Description JDFCMYKColor()constructs a CMYK color with all values set to 0.0 DoubleJDFCMYKColor(double[] cmykArray)JDFCMYKColor(double c, double m, double y, double k)constructs a new CMYK color with the given double valuesJDFCMYKColor(java.lang.String s)constructs a CMYK color with the given StringJDFCMYKColor(java.util.Vector v)Deprecated.use typesafe constructorsJDFCMYKColor(JDFNumList nl)constructs a CMYK color with a given JDFNumberList
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JDFCMYKColorcreateCMYKColor(java.lang.String s)factory for JDFCMYKColor that silently returns null in case of illegal stringsdoublegetC()getC - returns the value C of the CMYK colordoublegetK()getK - returns the value K of the CMYK colordoublegetM()getM - returns the value M of the CMYK colorJDFRGBColorgetRGB()static double[]getRGBArray(double c, double m, double y, double k)doublegetY()getY - returns the value Y of the CMYK colorbooleanisValid()isValid - the size of the vector must be 4 and all instances are Double typesvoidsetC(double c)setC - sets the value C of the CMYK colorvoidsetK(double k)setK - sets the value K of the CMYK colorvoidsetM(double m)setM - sets the value M of the CMYK colorvoidsetNamedColor(java.lang.String name)set the cmyk value of this to a matching valuevoidsetY(double y)setY - sets the value Y of the CMYK color-
Methods inherited from class org.cip4.jdflib.datatypes.JDFNumList
abs, clone, contains, containsAll, copyNumList, doubleAt, elementAt, equals, getDouble, getDoubleList, getDoubleVector, getIntArray, getString, getString, hashCode, intAt, isValidString, matches, max, min, norm, removeElementAt, replaceElementAt, scale, scale, scaleFromCM, scaleFromCM, scaleFromMM, scaleFromMM, scaleToCM, scaleToCM, scaleToMM, scaleToMM, set, setString, setX, shift, sort, subtract, toString, unify, volume
-
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, contains, containsAll, copyInto, elements, ensureCapacity, firstElement, forEach, get, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeIf, removeRange, replaceAll, retainAll, set, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Constructor Detail
-
JDFCMYKColor
public JDFCMYKColor()
constructs a CMYK color with all values set to 0.0 Double
-
JDFCMYKColor
@Deprecated public JDFCMYKColor(java.util.Vector v) throws java.util.zip.DataFormatExceptionDeprecated.use typesafe constructorsconstructs a CMYK color with the given vector- Parameters:
v- - the given vector- Throws:
java.util.zip.DataFormatException- - if the Vector has not a valid format
-
JDFCMYKColor
public JDFCMYKColor(java.lang.String s) throws java.util.zip.DataFormatExceptionconstructs a CMYK color with the given String- Parameters:
s- - the given String- Throws:
java.util.zip.DataFormatException- - if the String has not a valid format
-
JDFCMYKColor
public JDFCMYKColor(JDFNumList nl) throws java.util.zip.DataFormatException
constructs a CMYK color with a given JDFNumberList- Parameters:
nl- - the given number list- Throws:
java.util.zip.DataFormatException- - if the String has not a valid format
-
JDFCMYKColor
public JDFCMYKColor(double c, double m, double y, double k)constructs a new CMYK color with the given double values- Parameters:
c- - the value cm- - the value my- - the value yk- - the value k
-
JDFCMYKColor
public JDFCMYKColor(double[] cmykArray)
- Parameters:
cmykArray- 4 doubles from 0 to 1 c,m,y,k
-
-
Method Detail
-
createCMYKColor
public static JDFCMYKColor createCMYKColor(java.lang.String s)
factory for JDFCMYKColor that silently returns null in case of illegal strings- Parameters:
s- the string to parse- Returns:
- the JDFCMYKColor, null if s is not compatible
-
isValid
public boolean isValid() throws java.util.zip.DataFormatExceptionisValid - the size of the vector must be 4 and all instances are Double types- Specified by:
isValidin classJDFNumList- Returns:
- boolean - true if all instances are Double or Integer types
- Throws:
java.util.zip.DataFormatException- - if the Vector has not a valid format
-
getC
public double getC()
getC - returns the value C of the CMYK color- Returns:
- double - the value C of the CMYK color
-
setC
public void setC(double c)
setC - sets the value C of the CMYK color- Parameters:
c- the value C of the CMYK color
-
getM
public double getM()
getM - returns the value M of the CMYK color- Returns:
- double - the value M of the CMYK color
-
setM
public void setM(double m)
setM - sets the value M of the CMYK color- Parameters:
m- the value M of the CMYK color
-
getY
public double getY()
getY - returns the value Y of the CMYK color- Returns:
- double - the value Y of the CMYK color
-
setY
public void setY(double y)
setY - sets the value Y of the CMYK color- Parameters:
y- the value Y of the CMYK color
-
getK
public double getK()
getK - returns the value K of the CMYK color- Returns:
- double - the value K of the CMYK color
-
setK
public void setK(double k)
setK - sets the value K of the CMYK color- Parameters:
k- the value K of the CMYK color
-
getRGB
public JDFRGBColor getRGB()
- Returns:
- the rgb color that roughly represents this
-
getRGBArray
public static double[] getRGBArray(double c, double m, double y, double k)- Parameters:
c-m-y-k-- Returns:
- the rgb color that roughly represents this
-
setNamedColor
public void setNamedColor(java.lang.String name)
set the cmyk value of this to a matching value- Parameters:
name-
-
-