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:
parent
f99c31c9f6
commit
708846b76f
2 changed files with 12 additions and 0 deletions
|
@ -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)
|
public static Point ToIntPoint(this PointF source)
|
||||||
{
|
{
|
||||||
return new Point((int)source.X, (int)source.Y);
|
return new Point((int)source.X, (int)source.Y);
|
||||||
|
|
|
@ -57,6 +57,10 @@ namespace GalleryShare
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PointF drawingPos = getDirectoryImageDrawPosition(i - filesSkipped).Multiply(new PointF(resultImage.Width, resultImage.Height));
|
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());
|
context.DrawImage(fileThumbnail, drawingPos.ToIntPoint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue