mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Draw logo to center of preview image
This commit is contained in:
parent
5037f6df7e
commit
ae731113c0
1 changed files with 20 additions and 11 deletions
|
@ -278,22 +278,31 @@ private void GeneratePreviewImage(int padding)
|
|||
verticalPadding = 0;
|
||||
}
|
||||
|
||||
using (Bitmap bmp = new Bitmap(pbResult.ClientSize.Width - (horizontalPadding * 2), pbResult.ClientSize.Height - (verticalPadding * 2)))
|
||||
if (PreviewImage != null) PreviewImage.Dispose();
|
||||
PreviewImage = new Bitmap(pbResult.ClientSize.Width - (horizontalPadding * 2), pbResult.ClientSize.Height - (verticalPadding * 2));
|
||||
|
||||
Color backgroundColor;
|
||||
|
||||
if (ShareXResources.UseDarkTheme)
|
||||
{
|
||||
if (PreviewImage != null) PreviewImage.Dispose();
|
||||
backgroundColor = ShareXResources.Theme.BackgroundColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
backgroundColor = Color.DarkGray;
|
||||
}
|
||||
|
||||
Color backgroundColor;
|
||||
using (Graphics g = Graphics.FromImage(PreviewImage))
|
||||
{
|
||||
g.Clear(backgroundColor);
|
||||
|
||||
if (ShareXResources.UseDarkTheme)
|
||||
if (PreviewImage.Width > 260 && PreviewImage.Height > 260)
|
||||
{
|
||||
backgroundColor = ShareXResources.Theme.BackgroundColor;
|
||||
using (Image logo = ShareXResources.Logo)
|
||||
{
|
||||
g.DrawImage(logo, (PreviewImage.Width / 2) - (logo.Width / 2), (PreviewImage.Height / 2) - (logo.Height / 2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
backgroundColor = Color.DarkGray;
|
||||
}
|
||||
|
||||
PreviewImage = ImageHelpers.FillBackground(bmp, backgroundColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue