Exemple #1
0
        public static Image Overlay(Image source, Image img, string overType, int opacity)
        {
            string text = overType.ToLower();
            int    x;
            int    y;

            switch (text)
            {
            case "left":
                x = 0;
                y = (source.Height - img.Height) / 2;
                goto IL_1B6;

            case "right":
                x = source.Width - img.Width;
                y = (source.Height - img.Height) / 2;
                goto IL_1B6;

            case "top":
                x = (source.Width - img.Width) / 2;
                y = 0;
                goto IL_1B6;

            case "down":
                x = (source.Width - img.Width) / 2;
                y = source.Height - img.Height;
                goto IL_1B6;

            case "lefttop":
                x = 0;
                y = 0;
                goto IL_1B6;

            case "leftdown":
                x = 0;
                y = source.Height - img.Height;
                goto IL_1B6;

            case "righttop":
                x = source.Width - img.Width;
                y = 0;
                goto IL_1B6;

            case "rightdown":
                x = source.Width - img.Width;
                y = source.Height - img.Height;
                goto IL_1B6;
            }
            x = (source.Width - img.Width) / 2;
            y = (source.Height - img.Height) / 2;
IL_1B6:
            return(ImageTo.Overlay(source, img, x, y, opacity));
        }
Exemple #2
0
        public static Image Overlay(Image source, string text, string overType, int opacity, int size, string font, string color)
        {
            Image img = ImageTo.FromString(text, size, font, color);

            return(ImageTo.Overlay(source, img, overType, opacity));
        }
Exemple #3
0
        public static Image Overlay(Image source, string text, string overType, int opacity)
        {
            Image img = ImageTo.FromString(text, 12, "宋体", "#ff0000");

            return(ImageTo.Overlay(source, img, overType, opacity));
        }
Exemple #4
0
 public static Image Overlay(Image source, Image img, int x, int y, int opacity)
 {
     img = ImageTo.Transparent(img, opacity);
     return(ImageTo.Overlay(source, img, x, y));
 }