예제 #1
0
        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);
        }
예제 #2
0
        public override void DoCommand(IImageRender imageRender)
        {
            var imagePath = Path.Combine(_directory, _args["@main_argument"]);
            var image     = Image.FromFile(imagePath);

            imageRender.CreateFromImage(image);
        }
예제 #3
0
 public GroupCoverRenderer(IServiceProvider serviceProvider)
 {
     _serviceProvider = serviceProvider;
     _imageRender     = serviceProvider.GetService <IImageRender>();
     using (var background = Image.FromFile(GetBackgroundImagePath()))
     {
         _imageRender.CreateFromImage(background);
     }
     _fontProvider = serviceProvider.GetService <IFontProvider>();
 }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
 private void radioButton_zxing_Checked(object sender, RoutedEventArgs e)
 {
     imageRender = new ZXingImageRender();
 }
예제 #7
0
 private void radioButton_gma_Checked(object sender, RoutedEventArgs e)
 {
     imageRender = new GmaImageRender();
 }
예제 #8
0
 public abstract void DoCommand(IImageRender imageRender);
예제 #9
0
 public MemeGenerator(IServiceProvider serviceProvider)
 {
     _serviceProvider = serviceProvider;
     _imageRender     = serviceProvider.GetService <IImageRender>();
 }