Removed random position option from image watermark because random images effect can be used for same purpose

This commit is contained in:
Jaex 2019-12-08 16:52:45 +03:00
parent 9bcd554c43
commit bbbbbc3ccb

View file

@ -43,9 +43,6 @@ public class DrawImage : ImageEffect
[DefaultValue(typeof(Point), "5, 5")]
public Point Offset { get; set; }
[DefaultValue(false)]
public bool RandomPosition { get; set; }
[DefaultValue(DrawImageSizeMode.DontResize), Description("How the image watermark should be rescaled, if at all.")]
public DrawImageSizeMode SizeMode { get; set; }
@ -87,27 +84,7 @@ public override Image Apply(Image img)
}
// Place the image
Point imagePosition;
if (RandomPosition)
{
int x = 0;
if (img.Width - imageSize.Width > 0)
{
x = MathHelpers.Random(0, img.Width - imageSize.Width);
}
int y = 0;
if (img.Height - imageSize.Height > 0)
{
y = MathHelpers.Random(0, img.Height - imageSize.Height);
}
imagePosition = new Point(x, y);
}
else
{
imagePosition = Helpers.GetPosition(Placement, Offset, img.Size, imageSize);
}
Point imagePosition = Helpers.GetPosition(Placement, Offset, img.Size, imageSize);
Rectangle imageRectangle = new Rectangle(imagePosition, imageSize);