本文整理汇总了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.");
}
示例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);
}
示例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");
}
示例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\".");
}
示例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\".");
}
示例6: AddTextWatermarkThrowsOnNegativePadding
public void AddTextWatermarkThrowsOnNegativePadding()
{
WebImage image = new WebImage(_JpgImageBytes);
Assert.ThrowsArgumentGreaterThanOrEqualTo(
() => image.AddTextWatermark("p9", padding: -10),
"padding",
"0");
}
示例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\".");
}
示例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\".");
}
示例9: AddTextWatermarkThrowsOnEmptyText
public void AddTextWatermarkThrowsOnEmptyText()
{
WebImage image = new WebImage(_JpgImageBytes);
Assert.ThrowsArgumentNullOrEmptyString(
() => image.AddTextWatermark(""),
"text");
}
示例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.");
}
示例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);
}
示例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);
}
示例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);
}