public void testSeparationList() { JDFDoc doc = new JDFDoc("JDF"); JDFNode root = doc.getJDFRoot(); JDFResourcePool resPool = root.getCreateResourcePool(); KElement kElem = resPool.appendResource(ElementName.COLORANTCONTROL, null, null); Assert.IsTrue(kElem is JDFColorantControl); JDFColorantControl cc = ((JDFColorantControl)kElem); JDFSeparationList co = cc.appendColorantOrder(); VString seps = new VString(StringUtil.tokenize("Cyan Magenta Yellow Black", " ", false)); co.setSeparations(seps); CollectionAssert.AreEqual(co.getSeparations(), seps); VElement vSepSpec = co.getChildElementVector(ElementName.SEPARATIONSPEC, null, null, true, 0, true); Assert.AreEqual(seps.Count, vSepSpec.Count); for (int i = 0; i < vSepSpec.Count; i++) { Assert.IsFalse(vSepSpec.item(i).hasAttribute(AttributeName.CLASS)); Assert.IsFalse(vSepSpec.item(i) is JDFResource); } Assert.AreEqual("Cyan", co.getSeparation(0)); co.removeSeparation("Magenta"); Assert.AreEqual("Cyan", co.getSeparation(0)); Assert.AreEqual("Yellow", co.getSeparation(1)); Assert.AreEqual("Black", co.getSeparation(2)); Assert.IsNull(co.getSeparation(3)); }
/// /// <summary> * returns the number of colors defined inColorsUsed /// * /// * @return </summary> /// public virtual int getNumColors() { JDFSeparationList sl = getColorsUsed(); if (sl == null) { return(0); } return(sl.getSeparations().Count); }
public override void setUp() { base.setUp(); JDFElement.setLongID(false); d = new JDFDoc(ElementName.JDF); elem = d.getJDFRoot(); JDFResourcePool rpool = elem.appendResourcePool(); colControl = (JDFColorantControl)rpool.appendResource(ElementName.COLORANTCONTROL, EnumResourceClass.Parameter, null); colControl.setProcessColorModel("DeviceCMYK"); colControl.setResStatus(EnumResStatus.Available, true); colParams = colControl.appendColorantParams(); colPool = colControl.appendColorPool(); colPool.makeRootResource(null, null, true); }
/// /// <summary> * get the list of separations that this colorantcontrol describes adds the /// * separations that are implied by ProcessColorModel /// * </summary> /// * <returns> VString the complete list of process and spot colors </returns> /// public virtual VString getSeparations() { VString vName = new VString(); string model = getProcessColorModel(); if ("DeviceCMY".Equals(model)) { vName.Add("Cyan"); vName.Add("Magenta"); vName.Add("Yellow"); } else if ("DeviceCMYK".Equals(model)) { vName.Add("Cyan"); vName.Add("Magenta"); vName.Add("Yellow"); vName.Add("Black"); } else if ("DeviceGray".Equals(model)) { vName.Add("Black"); } else if ("DeviceRGB".Equals(model)) { vName.Add("Red"); vName.Add("Green"); vName.Add("Blue"); } else if ("DeviceN".Equals(model)) { vName = getDeviceNSpace(0).getSeparations(); } JDFSeparationList colpar = getColorantParams(); if (colpar != null) { vName.appendUnique(colpar.getSeparations()); } vName.unify(); return(vName); }
/// /// * <param name="icsLevel"> </param> /// protected internal virtual void initColorantControl() { JDFResourceLink ccLink = null; if (thePreviousNode != null) { ccLink = theNode.linkResource(thePreviousNode.getResource(ElementName.COLORANTCONTROL, EnumUsage.Input, 0), EnumUsage.Input, null); } if (ccLink == null && theParentNode != null) { ccLink = theNode.linkResource(theParentNode.getResource(ElementName.COLORANTCONTROL, EnumUsage.Input, 0), EnumUsage.Input, null); } JDFColorantControl cc = (JDFColorantControl)(ccLink == null ? (JDFColorantControl)theNode.getCreateResource(ElementName.COLORANTCONTROL, EnumUsage.Input, 0) : ccLink.getTarget()); cc.setResStatus(EnumResStatus.Available, false); JDFColorPool cp = (JDFColorPool)theNode.getJDFRoot().getChildByTagName(ElementName.COLORPOOL, null, 0, null, false, false); if (cp == null) { cp = (JDFColorPool)theNode.getCreateResource(ElementName.COLORPOOL, EnumUsage.Input, 0); if (theParentNode != null) { theParentNode.getCreateResourcePool().moveElement(cp, null); } } cc.refColorPool(cp); for (int i = 4; i < getNCols(); i++) { cc.getCreateColorantParams().appendSeparation(cols.stringAt(i)); } for (int i = 0; i < getNCols(); i++) { string name = cols.stringAt(i); JDFColor c = cp.getCreateColorWithName(name, null); if (i == 0) { c.setCMYK(new JDFCMYKColor(1, 0, 0, 0)); } if (i == 1) { c.setCMYK(new JDFCMYKColor(0, 1, 0, 0)); } if (i == 2) { c.setCMYK(new JDFCMYKColor(0, 0, 1, 0)); } if (i == 3) { c.setCMYK(new JDFCMYKColor(0, 0, 0, 1)); } } cc.setProcessColorModel("DeviceCMYK"); if (nCols[0] != nCols[1]) { for (int ii = 0; ii < 2; ii++) { JDFColorantControl ccP = (JDFColorantControl)cc.addPartition(EnumPartIDKey.Side, ii == 0 ? "Front" : "Back"); VString colsP = new VString(); for (int iii = 0; iii < nCols[ii]; iii++) { colsP.Add(cols.stringAt(iii)); } JDFSeparationList co = ccP.getCreateColorantOrder(); co.setSeparations(colsP); } } else { JDFSeparationList co = cc.getCreateColorantOrder(); co.setSeparations(cols); } }