1
0
Fork 0
mirror of https://gitlab.com/sbrl/GalleryShare.git synced 2018-06-12 22:45:16 +00:00

Centre file previews in directory previews.

This commit is contained in:
Starbeamrainbowlabs 2016-08-30 10:23:18 +01:00
parent f99c31c9f6
commit 708846b76f
2 changed files with 12 additions and 0 deletions

View file

@ -13,6 +13,14 @@ namespace GalleryShare
);
}
public static PointF Add(this PointF a, PointF b)
{
return new PointF(
a.X + b.X,
a.Y + b.Y
);
}
public static Point ToIntPoint(this PointF source)
{
return new Point((int)source.X, (int)source.Y);

View file

@ -57,6 +57,10 @@ namespace GalleryShare
continue;
}
PointF drawingPos = getDirectoryImageDrawPosition(i - filesSkipped).Multiply(new PointF(resultImage.Width, resultImage.Height));
drawingPos = drawingPos.Add(new PointF(
thumbnailSize.Width / 4f - fileThumbnail.Width / 2f,
thumbnailSize.Height / 4f - fileThumbnail.Height / 2f
));
context.DrawImage(fileThumbnail, drawingPos.ToIntPoint());
}
}