OcadSymbolHeader ReadSymbolHeader() { OcadSymbolHeader sh = new OcadSymbolHeader(); sh.Read(reader); return sh; }
// Create the SymColor objects in the map, and also cache them in the colors array. void CreateColors(OcadSymbolHeader symheader) { for (int i = symheader.nColors - 1; i >= 0 ; --i) { OcadColorInfo ocadColorInfo = symheader.aColorInfo[i]; SymColor color; color = map.AddColor(ocadColorInfo.ColorName, ocadColorInfo.ColorNum, (float)(ocadColorInfo.Color.cyan)/200.0F, (float)(ocadColorInfo.Color.magenta)/200.0F, (float)(ocadColorInfo.Color.yellow)/200.0F, (float)(ocadColorInfo.Color.black)/200.0F); mapOcadIdToSymColor[ocadColorInfo.ColorNum] = color; } }
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); }