void WriteSymbolHeader() { OcadSymbolHeader symheader = map.OcadSymbolHeaderStructure; int i; if (symheader == null) { symheader = new OcadSymbolHeader(); symheader.BlackAng = 450; symheader.BlackFreq = 1500; symheader.CyanAng = 150; symheader.CyanFreq = 1500; symheader.MagentaAng = 750; symheader.MagentaFreq = 1500; symheader.YellowAng = 0; symheader.YellowFreq = 1500; OcadColorSep emptyColorSep = new OcadColorSep(); for (i = 0; i < symheader.aColorSep.Length; ++i) symheader.aColorSep[i] = emptyColorSep; } ICollection<SymColor> colors = map.AllColors; symheader.nColors = (short) colors.Count; i = colors.Count - 1; foreach (SymColor color in colors) { OcadColorInfo colorInfo = new OcadColorInfo(); colorInfo.ColorNum = color.OcadId; colorInfo.ColorName = color.Name; float cyan, magenta, yellow, black; color.GetCMYK(out cyan, out magenta, out yellow, out black); colorInfo.Color.cyan = (byte) Math.Round(200.0F * cyan); colorInfo.Color.magenta = (byte) Math.Round(200.0F * magenta); colorInfo.Color.yellow = (byte) Math.Round(200.0F * yellow); colorInfo.Color.black = (byte) Math.Round(200.0F * black); for (int j = 0; j < colorInfo.SepPercentage.Length; ++j) colorInfo.SepPercentage[j] = 255; symheader.aColorInfo[i--] = colorInfo; } // Fill in the rest of the array with empty colors. OcadColorInfo emptyColor = new OcadColorInfo(); i = colors.Count; while (i < symheader.aColorInfo.Length) { symheader.aColorInfo[i++] = emptyColor; } symheader.Write(writer); }
public void Read(BinaryReader reader) { nColors = reader.ReadInt16(); nColorSep = reader.ReadInt16(); CyanFreq = reader.ReadInt16(); CyanAng = reader.ReadInt16(); MagentaFreq = reader.ReadInt16(); MagentaAng = reader.ReadInt16(); YellowFreq = reader.ReadInt16(); YellowAng = reader.ReadInt16(); BlackFreq = reader.ReadInt16(); BlackAng = reader.ReadInt16(); Res1 = reader.ReadInt16(); Res2 = reader.ReadInt16(); for (int i = 0; i < aColorInfo.Length; ++i) { aColorInfo[i] = new OcadColorInfo(); aColorInfo[i].Read(reader); } for (int i = 0; i < aColorSep.Length; ++i) { aColorSep[i] = new OcadColorSep(); aColorSep[i].Read(reader); } }