当前位置: 首页>>代码示例>>C#>>正文


C# WebImage.AddTextWatermark方法代码示例

本文整理汇总了C#中WebImage.AddTextWatermark方法的典型用法代码示例。如果您正苦于以下问题:C# WebImage.AddTextWatermark方法的具体用法?C# WebImage.AddTextWatermark怎么用?C# WebImage.AddTextWatermark使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebImage的用法示例。


在下文中一共展示了WebImage.AddTextWatermark方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddTextWatermarkThrowsOnIncorrectFontFamily

        public void AddTextWatermarkThrowsOnIncorrectFontFamily()
        {
            WebImage image = new WebImage(_JpgImageBytes);

            Assert.Throws<ArgumentException>(
                () => image.AddTextWatermark("p9", fontFamily: "something"),
                "The \"fontFamily\" value is invalid. Valid values are font family names like: \"Arial\", \"Times New Roman\", etc. Make sure that the font family you are trying to use is installed on the server.");
        }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:8,代码来源:WebImageTest.cs

示例2: CanAddTextAndImageWatermarks

        public void CanAddTextAndImageWatermarks()
        {
            WebImage watermark = new WebImage(_BmpImageBytes);
            WebImage image = new WebImage(_JpgImageBytes);
            image.AddImageWatermark(watermark, horizontalAlign: "LEFT", verticalAlign: "top", opacity: 30, padding: 10);
            image.AddTextWatermark("plan9");

            Assert.Equal(634, image.Width);
            Assert.Equal(489, image.Height);
        }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:10,代码来源:WebImageTest.cs

示例3: AddTextWatermarkThrowsOnIncorrectFontSize

        public void AddTextWatermarkThrowsOnIncorrectFontSize()
        {
            WebImage image = new WebImage(_JpgImageBytes);
            Assert.ThrowsArgumentGreaterThan(
                () => image.AddTextWatermark("p9", fontSize: -10),
                "fontSize",
                "0");

            Assert.ThrowsArgumentGreaterThan(
                () => image.AddTextWatermark("p9", fontSize: 0),
                "fontSize",
                "0");
        }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:13,代码来源:WebImageTest.cs

示例4: AddTextWatermarkThrowsOnIncorrectFontStyle

        public void AddTextWatermarkThrowsOnIncorrectFontStyle()
        {
            WebImage image = new WebImage(_JpgImageBytes);

            Assert.Throws<ArgumentException>(
                () => image.AddTextWatermark("p9", fontStyle: "something"),
                "The \"fontStyle\" value is invalid. Valid values are: \"Regular\", \"Bold\", \"Italic\", \"Underline\", and \"Strikeout\".");
        }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:8,代码来源:WebImageTest.cs

示例5: AddTextWatermarkThrowsOnIncorrectVerticalAlignment

 public void AddTextWatermarkThrowsOnIncorrectVerticalAlignment()
 {
     WebImage image = new WebImage(_JpgImageBytes);
     Assert.Throws<ArgumentException>(
         () => image.AddTextWatermark("p9", verticalAlign: "NotSet"),
         "The \"verticalAlign\" value is invalid. Valid values are: \"Top\", \"Bottom\", and \"Middle\".");
 }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:7,代码来源:WebImageTest.cs

示例6: AddTextWatermarkThrowsOnNegativePadding

 public void AddTextWatermarkThrowsOnNegativePadding()
 {
     WebImage image = new WebImage(_JpgImageBytes);
     Assert.ThrowsArgumentGreaterThanOrEqualTo(
         () => image.AddTextWatermark("p9", padding: -10),
         "padding",
         "0");
 }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:8,代码来源:WebImageTest.cs

示例7: AddTextWatermarkThrowsOnIncorrectHexColorLength

 public void AddTextWatermarkThrowsOnIncorrectHexColorLength()
 {
     WebImage image = new WebImage(_JpgImageBytes);
     Assert.Throws<ArgumentException>(
         () => image.AddTextWatermark("p9", fontColor: "#F000"),
         "The \"fontColor\" value is invalid. Valid values are names like \"White\", \"Black\", or \"DarkBlue\", or hexadecimal values in the form \"#RRGGBB\" or \"#RGB\".");
 }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:7,代码来源:WebImageTest.cs

示例8: AddTextWatermarkThrowsOnIncorrectHorizontalAlignment

 public void AddTextWatermarkThrowsOnIncorrectHorizontalAlignment()
 {
     WebImage image = new WebImage(_JpgImageBytes);
     Assert.Throws<ArgumentException>(
         () => image.AddTextWatermark("p9", horizontalAlign: "Justify"),
         "The \"horizontalAlign\" value is invalid. Valid values are: \"Right\", \"Left\", and \"Center\".");
 }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:7,代码来源:WebImageTest.cs

示例9: AddTextWatermarkThrowsOnEmptyText

 public void AddTextWatermarkThrowsOnEmptyText()
 {
     WebImage image = new WebImage(_JpgImageBytes);
     Assert.ThrowsArgumentNullOrEmptyString(
         () => image.AddTextWatermark(""),
         "text");
 }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:7,代码来源:WebImageTest.cs

示例10: AddTextWatermarkThrowsOnTooBigOpacity

        public void AddTextWatermarkThrowsOnTooBigOpacity()
        {
            WebImage image = new WebImage(_JpgImageBytes);

            Assert.ThrowsArgumentOutOfRange(() => image.AddTextWatermark("Plan9", opacity: 155), "opacity", "Value must be between 0 and 100.");
        }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:6,代码来源:WebImageTest.cs

示例11: AddTextWatermarkDoesNotChangeImageIfPaddingIsTooBig

        public void AddTextWatermarkDoesNotChangeImageIfPaddingIsTooBig()
        {
            WebImage image = new WebImage(_JpgImageBytes);
            image.AddTextWatermark("Plan9", padding: 1000);

            Assert.Equal(634, image.Width);
            Assert.Equal(489, image.Height);
        }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:8,代码来源:WebImageTest.cs

示例12: AddTextWatermarkParsesShortHexColorCorrectly

        public void AddTextWatermarkParsesShortHexColorCorrectly()
        {
            WebImage image = new WebImage(_JpgImageBytes);
            image.AddTextWatermark("Plan9", fontSize: 16, fontColor: "#F00", horizontalAlign: "Center", verticalAlign: "Middle");

            Assert.Equal(634, image.Width);
            Assert.Equal(489, image.Height);
        }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:8,代码来源:WebImageTest.cs

示例13: AddTextWatermarkPreservesImageDimension

        public void AddTextWatermarkPreservesImageDimension()
        {
            WebImage image = new WebImage(_JpgImageBytes);
            image.AddTextWatermark("Plan9", fontSize: 16, horizontalAlign: "Left", verticalAlign: "Bottom", opacity: 50);

            Assert.Equal(634, image.Width);
            Assert.Equal(489, image.Height);
        }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:8,代码来源:WebImageTest.cs


注:本文中的WebImage.AddTextWatermark方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。