private void ConvertFile() { int imageWidth = AtlasFile.Atlas.Width; int imageHeight = AtlasFile.Atlas.Height; Dictionary <string, Bitmap> nameToBitmap = new Dictionary <string, Bitmap>(); foreach (Build.Symbol symbol in BuildFile.Build.SymbolsList) { foreach (Build.Frame frame in symbol.FramesList) { string name = BuildFile.HashToName[symbol.Hash] + '_' + frame.SourceFrameNum; Console.WriteLine(name); if (nameToBitmap.ContainsKey(name)) { Console.WriteLine($"Warning: symbol {name} was defined more than once!"); continue; } int x1 = (int)(frame.X1 * imageWidth); int y1 = (int)((frame.Y1) * imageHeight); int width = (int)((frame.X2 - frame.X1) * imageWidth); int height = (int)((frame.Y2 - frame.Y1) * imageHeight); Rectangle boundingBox = new Rectangle(x1, y1, width, height); Bitmap bitmap = AtlasFile.Atlas.Clone(boundingBox, AtlasFile.Atlas.PixelFormat); nameToBitmap.Add(name, bitmap); } } texturesFile = new Textures.File(nameToBitmap); }
private void ConvertFile() { AtlasToTexturesConverter atlasToTexturesConverter = new AtlasToTexturesConverter(AtlasFile, BuildFile); texturesFile = atlasToTexturesConverter.GetTexturesFile(); XmlDocument scml = new XmlDocument(); XmlElement root = MakeRootNode(scml); XmlDeclaration xmlDeclaration = scml.CreateXmlDeclaration("1.0", "UTF-8", null); scml.AppendChild(root); scml.InsertBefore(xmlDeclaration, root); scmlFile = new Scml.File(scml); }
public TexturesToAtlasConverter(Textures.File texturesFile, Scml.File scmlFile) { TexturesFile = texturesFile; ScmlFile = scmlFile; }
public ScmlToKAnimConverter(Textures.File texturesFile, Scml.File scmlFile) { TexturesFile = texturesFile; ScmlFile = scmlFile; }