コード例 #1
0
        public void LoadTIXIntoVRAM(string tixPath)
        {
            Log.Information($"Loading TIX from {tixPath} into virtual VRAM");

            using (BinaryReader br = new BinaryReader(File.Open(tixPath, FileMode.Open)))
            {
                Tix = new TIX(br);
            }

            Log.Information("Successfully loaded TIX");

            if (VRAM != null)
            {
                disposeOldVRAM();
            }

            VRAM = LibLSDUtil.TIXToTexture2D(Tix, headless: true, flip: false);

            VRAMLoaded = true;
        }
コード例 #2
0
        /// <summary>
        /// Export the TIM files in a TIX to common image formats.
        /// </summary>
        /// <param name="tix">The TIX file.</param>
        /// <param name="filePath">The file path to export to.</param>
        /// <param name="separate">Whether or not to separate images in the output.</param>
        /// <param name="format">The image format to export to.</param>
        public void ExportImages(TIX tix, string filePath, bool separate, ImageFormat format)
        {
            if (separate)
            {
                Log.Information($"Exporting images ({format}) in TIX to: {filePath}");

                var allTims = tix.AllTIMs;
                for (int i = 0; i < allTims.Count; i++)
                {
                    var fileName = Path.GetFileNameWithoutExtension(filePath);
                    var ext      = Path.GetExtension(filePath);
                    var dir      = Path.GetDirectoryName(filePath);
                    ExportImage(allTims[i], 0, Path.Combine(dir, $"{fileName}-{i}{ext}"), format);
                }
            }
            else
            {
                ITexture2D tixTex = LibLSDUtil.TIXToTexture2D(tix, headless: true, flip: false);
                ExportTexture(tixTex, filePath, format);
            }
        }