コード例 #1
0
ファイル: ResizetizeImages.cs プロジェクト: dimonovdd/maui
        void ProcessAppIcon(ResizeImageInfo img, ConcurrentBag <ResizedImageInfo> resizedImages)
        {
            var appIconName = img.OutputName;

            // Generate the actual bitmap app icons themselves
            var appIconDpis = DpiPath.GetAppIconDpis(PlatformType, appIconName);

            LogDebugMessage($"App Icon");

            // Apple and Android have special additional files to generate for app icons
            if (PlatformType == "android")
            {
                LogDebugMessage($"Android Adaptive Icon Generator");

                appIconName = appIconName.ToLowerInvariant();

                var adaptiveIconGen = new AndroidAdaptiveIconGenerator(img, appIconName, IntermediateOutputPath, this, AllowVectorAdaptiveIcons);
                var iconsGenerated  = adaptiveIconGen.Generate();

                foreach (var iconGenerated in iconsGenerated)
                {
                    resizedImages.Add(iconGenerated);
                }
            }
            else if (PlatformType == "ios")
            {
                LogDebugMessage($"iOS Icon Assets Generator");

                var appleAssetGen = new AppleIconAssetsGenerator(img, appIconName, IntermediateOutputPath, appIconDpis, this);

                var assetsGenerated = appleAssetGen.Generate();

                foreach (var assetGenerated in assetsGenerated)
                {
                    resizedImages.Add(assetGenerated);
                }
            }
            else if (PlatformType == "tizen")
            {
                var updator = new TizenIconManifestUpdater(appIconName, appIconDpis, this);
                updator.Update();
            }

            LogDebugMessage($"Generating App Icon Bitmaps for DPIs");

            var appTool = new SkiaSharpAppIconTools(img, this);

            LogDebugMessage($"App Icon: Intermediate Path " + IntermediateOutputPath);

            foreach (var dpi in appIconDpis)
            {
                LogDebugMessage($"App Icon: " + dpi);

                var destination = Resizer.GetFileDestination(img, dpi, IntermediateOutputPath)
                                  .Replace("{name}", appIconName);

                LogDebugMessage($"App Icon Destination: " + destination);

                appTool.Resize(dpi, Path.ChangeExtension(destination, ".png"));
            }
        }