public override void DoCommand(IImageRender imageRender) { var text = PreproccessText(_args["@main_argument"]); var fontSize = int.Parse(_args["fontSize"]); var font = _serviceProvider.GetService <IFontProvider>().GetFont("PF Agora Slab Pro Medium", FontSize.FromPixels(fontSize)); var x = int.Parse(_args["x"]); var y = int.Parse(_args["y"]); var alignment = TextAlignment.Left; switch (_args["align"]) { case "left": alignment = TextAlignment.Left; break; case "center": alignment = TextAlignment.Center; break; case "right": alignment = TextAlignment.Right; break; } imageRender.DrawString(text, font, Color.Black, x, y, alignment); }
public override void DoCommand(IImageRender imageRender) { var imagePath = Path.Combine(_directory, _args["@main_argument"]); var image = Image.FromFile(imagePath); imageRender.CreateFromImage(image); }
public GroupCoverRenderer(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; _imageRender = serviceProvider.GetService <IImageRender>(); using (var background = Image.FromFile(GetBackgroundImagePath())) { _imageRender.CreateFromImage(background); } _fontProvider = serviceProvider.GetService <IFontProvider>(); }
public override void DoCommand(IImageRender imageRender) { var imagePath = Path.Combine(_directory, _args["@main_argument"]); var image = Image.FromFile(imagePath); var x = int.Parse(_args["x"]); var y = int.Parse(_args["y"]); var w = int.Parse(_args["w"]); var h = int.Parse(_args["h"]); imageRender.DrawImageScaled(image, x, y, w, h); }
public override void DoCommand(IImageRender imageRender) { var cache = _serviceProvider.GetService <ICacheableUser>(); var userAvatar = cache.GetUserAvatar(_userId, true); var x = int.Parse(_args["x"]); var y = int.Parse(_args["y"]); var w = int.Parse(_args["w"]); var h = int.Parse(_args["h"]); imageRender.DrawImageScaled(userAvatar, x, y, w, h); }
private void radioButton_zxing_Checked(object sender, RoutedEventArgs e) { imageRender = new ZXingImageRender(); }
private void radioButton_gma_Checked(object sender, RoutedEventArgs e) { imageRender = new GmaImageRender(); }
public abstract void DoCommand(IImageRender imageRender);
public MemeGenerator(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; _imageRender = serviceProvider.GetService <IImageRender>(); }