mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Fixed aspect ratio of images
This commit is contained in:
parent
6a61d945a1
commit
196a45ff37
1 changed files with 12 additions and 1 deletions
|
@ -138,7 +138,18 @@ private void DrawImage(Image img, Image img2, Graphics g)
|
|||
|
||||
if (RandomSize)
|
||||
{
|
||||
width = height = MathHelpers.Random(Math.Min(RandomSizeMin, RandomSizeMax), Math.Max(RandomSizeMin, RandomSizeMax));
|
||||
int size = MathHelpers.Random(Math.Min(RandomSizeMin, RandomSizeMax), Math.Max(RandomSizeMin, RandomSizeMax));
|
||||
width = size;
|
||||
height = size;
|
||||
|
||||
if (img2.Width > img2.Height)
|
||||
{
|
||||
height = (int)(size * ((float)img2.Height / img2.Width));
|
||||
}
|
||||
else if (img2.Width < img2.Height)
|
||||
{
|
||||
width = (int)(size * ((float)img2.Width / img2.Height));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue