Skip to content

Commit 2f790cc

Browse files
authored
Merge pull request #53 from ShareX/feature/XIP0023-annotation-toolbar-refactor
Feature/xip0023 annotation toolbar refactor
2 parents e769b28 + 130829e commit 2f790cc

File tree

8 files changed

+1089
-31
lines changed

8 files changed

+1089
-31
lines changed

src/XerahS.Platform.Windows/Recording/MediaFoundationEncoder.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,12 @@ public void WriteFrame(FrameData frame)
239239
hr = ComFunctions.Lock(buffer, out var bufferPtr, out var maxLen, out var curLen);
240240
if (hr != 0) throw new COMException("Failed to lock buffer", hr);
241241

242-
try
243-
{
244-
CopyFrame(frame, bufferPtr, bytesPerRow);
245-
}
246-
finally
247-
{
242+
try
243+
{
244+
CopyFrame(frame, bufferPtr, bytesPerRow);
245+
}
246+
finally
247+
{
248248
ComFunctions.Unlock(buffer);
249249
}
250250

@@ -598,5 +598,3 @@ private static T Call<T>(IntPtr ptr, int index) where T : Delegate
598598

599599
#endregion
600600
}
601-
602-

src/XerahS.RegionCapture/Models/RegionSelectionResult.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,16 @@ You should have received a copy of the GNU General Public License
2323

2424
#endregion License Information (GPL v3)
2525

26+
using SkiaSharp;
27+
2628
namespace XerahS.RegionCapture.Models;
2729

2830
/// <summary>
2931
/// Represents a completed region selection with the cursor position at confirmation time.
32+
/// Optionally includes an annotation layer to be composited onto the captured image.
3033
/// </summary>
31-
public readonly record struct RegionSelectionResult(PixelRect Region, PixelPoint CursorPosition);
34+
public readonly record struct RegionSelectionResult(
35+
PixelRect Region,
36+
PixelPoint CursorPosition,
37+
SKBitmap? AnnotationLayer = null,
38+
PixelPoint MonitorOrigin = default);
Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<Window xmlns="https://github.com/avaloniaui"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:controls="clr-namespace:ShareX.Editor.Views.Controls;assembly=ShareX.Editor"
34
x:Class="XerahS.RegionCapture.UI.OverlayWindow"
45
SystemDecorations="None"
56
TransparencyLevelHint="Transparent"
@@ -10,7 +11,25 @@
1011
ExtendClientAreaToDecorationsHint="True"
1112
ExtendClientAreaChromeHints="NoChrome">
1213

13-
<Panel x:Name="RootPanel">
14-
<!-- Custom rendering control -->
15-
</Panel>
14+
<Grid>
15+
<!-- Region Capture Control Layer -->
16+
<Panel x:Name="RootPanel" IsHitTestVisible="True">
17+
<!-- Custom rendering control added in code-behind -->
18+
</Panel>
19+
20+
<!-- XIP-0023: Annotation Canvas Layer for drawing shapes -->
21+
<!-- IsHitTestVisible is set dynamically based on active tool (false for Select, true for drawing tools) -->
22+
<Canvas x:Name="AnnotationCanvas"
23+
Background="Transparent"
24+
IsHitTestVisible="False"/>
25+
26+
<!-- XIP-0023: Annotation Toolbar for Overlay mode -->
27+
<!-- Positioned below the instruction text (50px margin from top) -->
28+
<!-- Press Tab to toggle visibility, ENTER to confirm capture -->
29+
<controls:AnnotationToolbar x:Name="AnnotationToolbarControl"
30+
VerticalAlignment="Top"
31+
HorizontalAlignment="Center"
32+
Margin="0,50,0,0"
33+
IsVisible="True"/>
34+
</Grid>
1635
</Window>

0 commit comments

Comments
 (0)