Skip to content

Commit

Permalink
Skyline: Fixed CleanupBorder10 for floating windows
Browse files Browse the repository at this point in the history
- improved commenting in CleanupBorder11
  • Loading branch information
brendanx67 committed Dec 26, 2024
1 parent 601e1f0 commit 4e50b59
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pwiz_tools/Skyline/TestUtil/ScreenshotProcessingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ private static Bitmap CleanupBorder10(this Bitmap bmp, Color color, Rectangle re
{
using var g = Graphics.FromImage(bmp);
using var pen = new Pen(color);
g.DrawRectangle(pen, 0, 0, bmp.Width - 1, bmp.Height - 1);
if (rect.Height == 1)
g.DrawLine(pen, rect.Location, new Point(rect.Right, rect.Top));
else
g.DrawRectangle(pen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
return bmp;
}

Expand Down Expand Up @@ -123,11 +126,11 @@ private static Bitmap CleanupBorder11(this Bitmap bmp, Color color, Rectangle re
// Draw the image within the curved shape just drawn
using var pathClipping = new GraphicsPath();
rect.Inflate(-1, -1);
AddRoundedRectangle(pathClipping, rect, cornerRadius + cornerRadius/2); // Corners are very tricky with transparency
// Corner transparency is very tricky. So, it is necessary to clip the corner
// areas slightly further in then their true edges.
AddRoundedRectangle(pathClipping, rect, cornerRadius + cornerRadius/2);
g.SmoothingMode = SmoothingMode.None;
g.SetClip(pathClipping);
// using var foregroundBrush = new SolidBrush(Color.Red);
// g.FillRectangle(foregroundBrush, 0, 0, bmp.Width, bmp.Height);
g.DrawImage(bmp, new Point(0, 0));

return result;
Expand Down

0 comments on commit 4e50b59

Please sign in to comment.