mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-02 21:20:28 +12:00
Use dark background on editor mode and only draw checkers behind image
This commit is contained in:
parent
b2b3e9de1a
commit
b3af07a951
|
@ -95,7 +95,7 @@ protected override void OnPaint(PaintEventArgs pevent)
|
|||
|
||||
if (Color.A < 255)
|
||||
{
|
||||
using (Image checker = ImageHelpers.CreateCheckers(boxSize, boxSize, Color.LightGray, Color.White))
|
||||
using (Image checker = ImageHelpers.CreateCheckerPattern(boxSize, boxSize))
|
||||
{
|
||||
g.DrawImage(checker, boxRectangle);
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@ private void UpdateCheckers()
|
|||
if (pbMain.BackgroundImage == null || pbMain.BackgroundImage.Size != pbMain.ClientSize)
|
||||
{
|
||||
if (pbMain.BackgroundImage != null) pbMain.BackgroundImage.Dispose();
|
||||
pbMain.BackgroundImage = ImageHelpers.CreateCheckers();
|
||||
pbMain.BackgroundImage = ImageHelpers.CreateCheckerPattern();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -604,7 +604,7 @@ public static Bitmap FillBackground(Image img, Brush brush)
|
|||
|
||||
public static Image DrawCheckers(Image img)
|
||||
{
|
||||
return DrawCheckers(img, 10, Color.LightGray, Color.White);
|
||||
return DrawCheckers(img, 10, Color.FromArgb(230, 230, 230), Color.White);
|
||||
}
|
||||
|
||||
public static Image DrawCheckers(Image img, int size, Color color1, Color color2)
|
||||
|
@ -612,7 +612,7 @@ public static Image DrawCheckers(Image img, int size, Color color1, Color color2
|
|||
Bitmap bmp = img.CreateEmptyBitmap();
|
||||
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
using (Image checker = CreateCheckers(size, color1, color2))
|
||||
using (Image checker = CreateCheckerPattern(size, size, color1, color2))
|
||||
using (Brush checkerBrush = new TextureBrush(checker, WrapMode.Tile))
|
||||
using (img)
|
||||
{
|
||||
|
@ -629,7 +629,7 @@ public static Image DrawCheckers(int width, int height)
|
|||
Bitmap bmp = new Bitmap(width, height);
|
||||
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
using (Image checker = CreateCheckers())
|
||||
using (Image checker = CreateCheckerPattern())
|
||||
using (Brush checkerBrush = new TextureBrush(checker, WrapMode.Tile))
|
||||
{
|
||||
g.FillRectangle(checkerBrush, new Rectangle(0, 0, bmp.Width, bmp.Height));
|
||||
|
@ -638,17 +638,17 @@ public static Image DrawCheckers(int width, int height)
|
|||
return bmp;
|
||||
}
|
||||
|
||||
public static Image CreateCheckers()
|
||||
public static Image CreateCheckerPattern()
|
||||
{
|
||||
return CreateCheckers(10, Color.LightGray, Color.White);
|
||||
return CreateCheckerPattern(10, 10);
|
||||
}
|
||||
|
||||
public static Image CreateCheckers(int size, Color color1, Color color2)
|
||||
public static Image CreateCheckerPattern(int width, int height)
|
||||
{
|
||||
return CreateCheckers(size, size, color1, color2);
|
||||
return CreateCheckerPattern(width, height, Color.FromArgb(230, 230, 230), Color.White);
|
||||
}
|
||||
|
||||
public static Image CreateCheckers(int width, int height, Color color1, Color color2)
|
||||
private static Image CreateCheckerPattern(int width, int height, Color color1, Color color2)
|
||||
{
|
||||
Bitmap bmp = new Bitmap(width * 2, height * 2);
|
||||
|
||||
|
@ -1561,7 +1561,7 @@ public static void DrawColorPickerIcon(Graphics g, Color color, Rectangle rect,
|
|||
{
|
||||
if (color.A < 255)
|
||||
{
|
||||
using (Image checker = CreateCheckers(rect.Width / 2, rect.Height / 2, Color.LightGray, Color.White))
|
||||
using (Image checker = CreateCheckerPattern(rect.Width / 2, rect.Height / 2))
|
||||
{
|
||||
g.DrawImage(checker, rect);
|
||||
}
|
||||
|
|
|
@ -168,9 +168,16 @@ public void Prepare(Image img)
|
|||
|
||||
ImageRectangle = new Rectangle(rect.X + rect.Width / 2 - Image.Width / 2, rect.Y + rect.Height / 2 - Image.Height / 2, Image.Width, Image.Height);
|
||||
|
||||
using (Image background = ImageHelpers.DrawCheckers(ScreenRectangle0Based.Width, ScreenRectangle0Based.Height))
|
||||
using (Bitmap background = new Bitmap(ScreenRectangle0Based.Width, ScreenRectangle0Based.Height))
|
||||
using (Graphics g = Graphics.FromImage(background))
|
||||
{
|
||||
g.Clear(Color.FromArgb(14, 14, 14));
|
||||
|
||||
using (Image checkers = ImageHelpers.DrawCheckers(ImageRectangle.Width, ImageRectangle.Height))
|
||||
{
|
||||
g.DrawImage(checkers, ImageRectangle);
|
||||
}
|
||||
|
||||
g.DrawImage(Image, ImageRectangle);
|
||||
|
||||
backgroundBrush = new TextureBrush(background) { WrapMode = WrapMode.Clamp };
|
||||
|
|
Loading…
Reference in a new issue