public void AddASymbol() { Map map = new Map(); var resolver = map.Write(); Glyph glyph = new Glyph(); resolver.Dispose(); }
// Verifies a test file. Returns true on success, false on failure. In the failure case, // a difference bitmap is written out. static bool VerifyTestFile(string filename, bool testLightenedColor, bool roundtripToOcadFile, int minOcadVersion, int maxOcadVersion) { string pngFileName; string mapFileName; string geodeFileName; string ocadFileName; string directoryName; string newBitmapName; RectangleF mapArea; int bmWidth, bmHeight; // Read the test file, and get the other file names and the area. using (StreamReader reader = new StreamReader(filename)) { mapFileName = reader.ReadLine(); pngFileName = reader.ReadLine(); float left, right, top, bottom; string area = reader.ReadLine(); string[] coords = area.Split(','); left = float.Parse(coords[0]); bottom = float.Parse(coords[1]); right = float.Parse(coords[2]); top = float.Parse(coords[3]); mapArea = new RectangleF(left, top, right - left, bottom - top); string sizeLine = reader.ReadLine(); coords = sizeLine.Split(','); bmWidth = int.Parse(coords[0]); bmHeight = int.Parse(coords[1]); } // Convert to absolute paths. directoryName = Path.GetDirectoryName(filename); mapFileName = Path.Combine(directoryName, mapFileName); pngFileName = Path.Combine(directoryName, pngFileName); geodeFileName = Path.Combine(directoryName, Path.GetFileNameWithoutExtension(mapFileName) + "_temp.geode"); ocadFileName = Path.Combine(directoryName, Path.GetFileNameWithoutExtension(mapFileName) + "_temp.ocd"); newBitmapName = Path.Combine(directoryName, Path.GetFileNameWithoutExtension(pngFileName) + "_new.png"); File.Delete(geodeFileName); File.Delete(ocadFileName); File.Delete(newBitmapName); // Create and open the map file. Map map = new Map(); InputOutput.ReadFile(mapFileName, map); // Draw into a new bitmap. BitmapSource bitmapNew = RenderBitmap(map, bmWidth, bmHeight, mapArea); WritePng(bitmapNew, newBitmapName); TestUtil.CompareBitmapBaseline(newBitmapName, pngFileName); if (testLightenedColor) { using (map.Write()) { ColorMatrix colorMatrix = new ColorMatrix(new float[][] { new float[] {0.4F, 0, 0, 0, 0}, new float[] {0, 0.4F, 0, 0, 0}, new float[] {0, 0, 0.4F, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {0.6F, 0.6F, 0.6F, 0, 1} }); map.ColorMatrix = colorMatrix; } string lightenedPngFileName = Path.Combine(Path.GetDirectoryName(pngFileName), Path.GetFileNameWithoutExtension(pngFileName) + "_light.png"); BitmapSource bitmapLight = RenderBitmap(map, bmWidth, bmHeight, mapArea); WritePng(bitmapLight, newBitmapName); TestUtil.CompareBitmapBaseline(newBitmapName, lightenedPngFileName); } if (roundtripToOcadFile) { for (int version = minOcadVersion; version <= maxOcadVersion; ++version) { // Save and load to a temp file name. InputOutput.WriteFile(ocadFileName, map, version); // Create and open the map file. map = new Map(); InputOutput.ReadFile(ocadFileName, map); // Draw into a new bitmap. bitmapNew = RenderBitmap(map, bmWidth, bmHeight, mapArea); WritePng(bitmapNew, newBitmapName); TestUtil.CompareBitmapBaseline(newBitmapName, pngFileName); File.Delete(ocadFileName); } } return true; }