Skip to content

Commit

Permalink
Merge pull request #47 from mikeclayton/feature/background-bleed
Browse files Browse the repository at this point in the history
#46 - move test-specific code
  • Loading branch information
mikeclayton authored Jul 31, 2024
2 parents bd48620 + 35f68ba commit 2b27fa5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public static IEnumerable<object[]> GetTestCases()
});
yield return new object[] { new TestCase(previewStyle, screens, activatedLocation, expectedResult) };

// rounding error check - single screen with 50% scaling,
// rounding error check - single screen with 33% scaling,
// no borders, check to make sure form scales to exactly
// fill the canvas size with no rounding errors.
//
Expand Down
5 changes: 0 additions & 5 deletions src/FancyMouse.Common/Helpers/DrawingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ public static Bitmap RenderPreview(
previewGraphics, previewLayout.PreviewStyle.ScreenStyle, screenshotBounds);
}

// prevent the background bleeding through into screen images
// (see https://github.com/mikeclayton/FancyMouse/issues/44)
previewGraphics.PixelOffsetMode = PixelOffsetMode.Half;
previewGraphics.InterpolationMode = InterpolationMode.NearestNeighbor;

var refreshRequired = false;
var placeholdersDrawn = false;
for (var i = 0; i < sourceScreens.Count; i++)
Expand Down
1 change: 0 additions & 1 deletion src/FancyMouse.Common/Helpers/LayoutHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public static PreviewLayout GetPreviewLayout(
builder.FormBounds = formBounds;

// now calculate the positions of each of the screenshot images on the preview
// scale the virtual screen to fit inside the content area
builder.ScreenshotBounds = builder.Screens
.Select(
screen => LayoutHelper.GetBoxBoundsFromOuterBounds(
Expand Down
6 changes: 6 additions & 0 deletions src/FancyMouse.Common/Imaging/StaticImageRegionCopyService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Drawing;
using System.Drawing.Drawing2D;
using FancyMouse.Common.Models.Drawing;

namespace FancyMouse.Common.Imaging;
Expand Down Expand Up @@ -28,6 +29,11 @@ public void CopyImageRegion(
RectangleInfo sourceBounds,
RectangleInfo targetBounds)
{
// prevent the background bleeding through into screen images
// (see https://github.com/mikeclayton/FancyMouse/issues/44)
targetGraphics.PixelOffsetMode = PixelOffsetMode.Half;
targetGraphics.InterpolationMode = InterpolationMode.NearestNeighbor;

targetGraphics.DrawImage(
image: this.SourceImage,
destRect: targetBounds.ToRectangle(),
Expand Down

0 comments on commit 2b27fa5

Please sign in to comment.