public void Dispose() { exporter.Dispose(); engine = null; spriteChip = null; imageExporter = null; exporter = null; }
// TODO this should be a step in the exporter public virtual void ConfigurePixelData() { var width = spriteChip.textureWidth; var height = spriteChip.textureHeight; var pixelData = new int[width * height]; spriteChip.texture.CopyPixels(ref pixelData, 0, 0, width, height); exporter = new PixelDataExporter(fullFileName, pixelData, width, height, colors, imageExporter, engine.ColorChip.maskColor); }
// TODO this should be a step in the exporter public override void ConfigurePixelData() { // var spriteChip = engine.fontChip; var width = 96; //spriteChip.textureWidth; var height = 64; //spriteChip.textureHeight; var textureData = new TextureData(width, height); // var pixelData = new int[width * height]; // Go through all of the sprites in the font // TODO get font sprites var total = 96; var maxCol = width / spriteChip.width; var tmpPixelData = new int[spriteChip.width * spriteChip.height]; for (var i = 0; i < total; i++) { var pos = engine.GameChip.CalculatePosition(i, maxCol); spriteChip.ReadSpriteAt(i, ref tmpPixelData); textureData.SetPixels(pos.X * spriteChip.width, pos.Y * spriteChip.height, spriteChip.width, spriteChip.height, tmpPixelData); } // var convertedColors = ColorUtils.ConvertColors(engine.ColorChip.hexColors, engine.ColorChip.maskColor, true); // var colors = !(engine.GetChip(ColorMapParser.chipName, false) is ColorChip colorMapChip) // ? engine.ColorChip.colors // : colorMapChip.colors; var imageExporter = new PNGWriter(); // TODO use the colors from the sprite parser this class extends? exporter = new PixelDataExporter(fullFileName, textureData.pixels, width, height, colors, imageExporter, engine.ColorChip.maskColor); }
public void CalculateSteps() { var currentDebugMode = colorChip.debugMode; // Force the color chip to not replace empty colors with background value colorChip.debugMode = true; ConfigureColors(); // Restore the color chip debug value colorChip.debugMode = currentDebugMode; BuildPixelData(); // Create Pixel Data Exporter exporter = new PixelDataExporter(fullFileName, pixels, width, height, colors, imageExporter, colorChip.maskColor); // calculate steps for exporter exporter.CalculateSteps(); }
public void Dispose() { exporter.Dispose(); colorChip = null; exporter = null; }