private async void GeneratePreview()
 {
     using (var image = await _textImageService.GenerateCaptionAsync(ProcessWheelSetting))
     {
         var imgPath = Path.Combine(_settings.HypermintSettings.ExportPath, "preview.png");
         image.Write(imgPath);
         _eventAgg.GetEvent <GenerateWheelEvent>().Publish(imgPath);
     }
 }
예제 #2
0
        private async void GeneratePreview()
        {
            Gravity grav = (Gravity)Enum.Parse(typeof(Gravity), CurrentWheelSetting.Gravity);

            using (var image = await _textImageService.GenerateCaptionAsync(CurrentWheelSetting))
            {
                var imgPath = _settingsRepo.HypermintSettings.ExportPath + "\\preview.png";
                image.Write(imgPath);
                _eventAgg.GetEvent <GenerateWheelEvent>().Publish(imgPath);
            }


            //using (MagickImage img = new MagickImage())
            //{
            //    img.Settings.Font = @"I:\RocketLauncher\Media\Fonts\amstrad_cpc464.ttf";
            //    img.Settings.FontStyle = FontStyleType.Italic;
            //    img.Settings.FontWeight = FontWeight.Bold;
            //    img.Settings.FillColor = new MagickColor("purple");
            //    img.Settings.TextGravity = Gravity.Center;
            //    img.Read("label:Magick.NET \nis chined", 400, 175);
            //    img.Trim();
            //    var imagePath = "preview.png";
            //    img.Write(imagePath);
            //    _eventAgg.GetEvent<GenerateWheelEvent>().Publish(imagePath);
            //}
        }
        private async Task ProcessWheel(ITextImageService srv, WheelNames wheel, string imagePath)
        {
            if (_selectedService.CurrentSystem.ToLower().Contains("main menu"))
            {
                ProcessWheelSetting.PreviewText = wheel.RomName;
            }
            else
            {
                ProcessWheelSetting.PreviewText = wheel.Description;
            }

            using (var image = await srv.GenerateCaptionAsync(ProcessWheelSetting))
            {
                image.Write(imagePath);

                if (PreviewCreated)
                {
                    _eventAgg.GetEvent <GenerateWheelEvent>().Publish(imagePath);
                }
            }
        }