Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
with:
dotnet-version: '8.0.x'
dotnet-version: '10.0.x'

- name: Extract version from project file
id: get_version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
with:
dotnet-version: '8.0.x'
dotnet-version: '10.0.x'

- name: Extract version from project file
id: get_version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
with:
dotnet-version: '8.0.x'
dotnet-version: '10.0.x'

- name: Extract version from project file
id: get_version
Expand Down
318 changes: 318 additions & 0 deletions LINUX_PORT.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion MoneyShot.Tests/MoneyShot.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
Expand Down
12 changes: 10 additions & 2 deletions MoneyShot/Editor/CanvasRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,23 @@ internal static class CanvasRenderer

/// <summary>
/// Renders the editor canvas to a bitmap matching the underlying image's pixel dimensions.
/// Temporarily disables the zoom transform so the saved image is at native resolution.
/// Temporarily disables the zoom and pan transforms so the saved image captures the full
/// frame at native resolution, regardless of how the user has panned/zoomed the editor view.
/// Both transforms are restored afterwards so the user doesn't see their viewport jump.
/// </summary>
public static BitmapSource CaptureCanvasAsImage(FrameworkElement imageCanvas, BitmapSource originalImage, ScaleTransform zoomTransform)
public static BitmapSource CaptureCanvasAsImage(FrameworkElement imageCanvas, BitmapSource originalImage, ScaleTransform zoomTransform, TranslateTransform panTransform)
{
var imageWidth = originalImage.PixelWidth;
var imageHeight = originalImage.PixelHeight;

var originalScaleX = zoomTransform.ScaleX;
var originalScaleY = zoomTransform.ScaleY;
var originalPanX = panTransform.X;
var originalPanY = panTransform.Y;
zoomTransform.ScaleX = 1;
zoomTransform.ScaleY = 1;
panTransform.X = 0;
panTransform.Y = 0;

imageCanvas.Measure(new Size(imageWidth, imageHeight));
imageCanvas.Arrange(new Rect(0, 0, imageWidth, imageHeight));
Expand All @@ -38,6 +44,8 @@ public static BitmapSource CaptureCanvasAsImage(FrameworkElement imageCanvas, Bi

zoomTransform.ScaleX = originalScaleX;
zoomTransform.ScaleY = originalScaleY;
panTransform.X = originalPanX;
panTransform.Y = originalPanY;
imageCanvas.UpdateLayout();

return renderBitmap;
Expand Down
33 changes: 32 additions & 1 deletion MoneyShot/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,44 @@ private void OpenEditor(System.Windows.Media.Imaging.BitmapSource screenshot, st
catch (Exception ex)
{
MoneyShot.Services.Logger.Error("Error opening editor", ex);
System.Windows.MessageBox.Show($"Failed to open image editor: {ex.Message}", "Editor Error",
System.Windows.MessageBox.Show($"Failed to open image editor: {ex.Message}", "Editor Error",
MessageBoxButton.OK, MessageBoxImage.Error);
// Show main window when error occurs so user knows something went wrong
ShowMainWindow();
}
finally
{
// The editor's BitmapSource backings, RenderTargetBitmaps and pixelate brushes live in
// both managed and native heaps. Without forcing a collection plus a working-set trim,
// the process sits at several hundred MB until the next major GC — undesirable for a
// tray app that should hover near 80MB while idle.
ReleaseEditorMemory();
}
}

private static void ReleaseEditorMemory()
{
try
{
System.Runtime.GCSettings.LargeObjectHeapCompactionMode =
System.Runtime.GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect(GC.MaxGeneration, GCCollectionMode.Aggressive, blocking: true, compacting: true);
GC.WaitForPendingFinalizers();
GC.Collect();

// Ask Windows to trim the working set. -1, -1 is the documented "trim now" sentinel.
using var process = System.Diagnostics.Process.GetCurrentProcess();
SetProcessWorkingSetSize(process.Handle, new IntPtr(-1), new IntPtr(-1));
}
catch (Exception ex)
{
MoneyShot.Services.Logger.Warn("Could not release editor memory", ex);
}
}

[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
private static extern bool SetProcessWorkingSetSize(IntPtr proc, IntPtr min, IntPtr max);

private void ShowSettings()
{
var settings = new SettingsWindow();
Expand Down
6 changes: 1 addition & 5 deletions MoneyShot/MoneyShot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
Expand All @@ -19,10 +19,6 @@
<Copyright>Copyright © 2026 Daolyap &amp; iSaluki</Copyright>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="10.0.7" />
</ItemGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" />
</ItemGroup>
Expand Down
12 changes: 10 additions & 2 deletions MoneyShot/Views/EditorWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@
<ToolTip Content="Undo (Ctrl+Z)"/>
</Button.ToolTip>
</Button>
<Button Content="🔢 Reset numbering" Click="ResetNumbering_Click" Style="{StaticResource GlassButton}">
<Button.ToolTip>
<ToolTip Content="Restart number labels at 1"/>
</Button.ToolTip>
</Button>
<Button Content="🔍+ Zoom" Click="ZoomIn_Click" Style="{StaticResource GlassButton}">
<Button.ToolTip>
<ToolTip Content="Zoom In (Ctrl++)"/>
Expand Down Expand Up @@ -444,7 +449,7 @@
</Border>

<!-- Main Canvas Area -->
<ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<ScrollViewer Grid.Row="2" Name="EditorScrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<ScrollViewer.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1" Opacity="0.3">
<GradientStop Color="#0a0a0a" Offset="0"/>
Expand All @@ -453,7 +458,10 @@
</ScrollViewer.Background>
<Grid Name="ImageCanvas" HorizontalAlignment="Center" VerticalAlignment="Center" UseLayoutRounding="True" SnapsToDevicePixels="True">
<Grid.RenderTransform>
<ScaleTransform x:Name="ZoomTransform" ScaleX="1" ScaleY="1" CenterX="0" CenterY="0"/>
<TransformGroup>
<ScaleTransform x:Name="ZoomTransform" ScaleX="1" ScaleY="1" CenterX="0" CenterY="0"/>
<TranslateTransform x:Name="PanTransform" X="0" Y="0"/>
</TransformGroup>
</Grid.RenderTransform>
<Image Name="ImageDisplay" />
<Canvas Name="DrawingCanvas"
Expand Down
Loading
Loading