示例#1
0
        public ResizedImageInfo Resize(DpiPath dpi, string inputsFile)
        {
            var destination = GetFileDestination(dpi);

            if (Info.IsVector)
            {
                destination = Path.ChangeExtension(destination, ".png");
            }

            if (IsUpToDate(Info.Filename, destination, inputsFile, Logger))
            {
                return new ResizedImageInfo {
                           Filename = destination, Dpi = dpi
                }
            }
            ;

            if (tools == null)
            {
                tools = SkiaSharpTools.Create(Info.IsVector, Info.Filename, Info.BaseSize, Info.TintColor, Logger);
            }

            tools.Resize(dpi, destination);

            return(new ResizedImageInfo {
                Filename = destination, Dpi = dpi
            });
        }
    }
示例#2
0
        public SkiaSharpAppIconTools(SharedImageInfo info, ILogger logger)
        {
            Info   = info;
            Logger = logger;

            AppIconName = info.OutputName;

            hasForeground = File.Exists(info.ForegroundFilename);

            if (hasForeground)
            {
                foregroundTools = SkiaSharpTools.Create(info.ForegroundIsVector, info.ForegroundFilename, null, info.TintColor, logger);
            }

            backgroundTools = SkiaSharpTools.Create(info.IsVector, info.Filename, null, null, logger);

            backgroundOriginalSize = backgroundTools.GetOriginalSize();

            if (hasForeground)
            {
                foregroundOriginalSize = foregroundTools.GetOriginalSize();
            }
        }
示例#3
0
        public ResizedImageInfo Resize(DpiPath dpi, string inputsFile)
        {
            var destination = GetFileDestination(dpi);

            if (Info.IsVector)
            {
                destination = Path.ChangeExtension(destination, ".png");
            }

            if (IsUpToDate(Info.Filename, destination, inputsFile, Logger))
            {
                return new ResizedImageInfo {
                           Filename = destination, Dpi = dpi
                }
            }
            ;

            if (tools == null)
            {
                if (Info.IsVector)
                {
                    tools = new SkiaSharpSvgTools(Info, Logger);
                }
                else
                {
                    tools = new SkiaSharpBitmapTools(Info, Logger);
                }
            }

            tools.Resize(dpi, destination);

            return(new ResizedImageInfo {
                Filename = destination, Dpi = dpi
            });
        }
    }