Example #1
0
        public TexturePacker(string rootDir, Settings settings)
        {
            _settings = settings;

            if (_settings.PowerOfTwo) {
                if (_settings.MaxWidth != MathUtils.NextPowerOfTwo(_settings.MaxWidth))
                    throw new Exception("If PowerOfTwo is true, MaxWidth must be a power of two: " + _settings.MaxWidth);
                if (_settings.MaxHeight != MathUtils.NextPowerOfTwo(_settings.MaxHeight))
                    throw new Exception("If PowerOfTwo is true, MaxHeight must be a power of two: " + _settings.MaxHeight);
            }

            _maxRectsPacker = new MaxRectsPacker(settings);
            _imageProcessor = new ImageProcessor(rootDir, settings);
        }