Skip to content

Commit fb391cd

Browse files
committed
refactor: move screenshot var in readme
1 parent dc8c936 commit fb391cd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,14 @@ using var media = new MediaSource("Video", "video.mp4").SetLooping(true);
129129
```csharp
130130
// Full source screenshot (returns BGRA pixels, width, height — or null)
131131
var screenshot = source.TakeScreenshot();
132+
// Cropped screenshot (only transfers the crop region from GPU)
133+
var cropped = source.TakeScreenshot(cropX: 960, cropY: 200, cropWidth: 640, cropHeight: 160);
132134
if (screenshot != null)
133135
{
134136
using var bmp = new Bitmap((int)screenshot.Width, (int)screenshot.Height, (int)(screenshot.Width * 4),
135137
PixelFormat.Format32bppArgb, Marshal.UnsafeAddrOfPinnedArrayElement(screenshot.Pixels, 0));
136138
bmp.Save("screenshot.jpg", ImageFormat.Jpeg);
137139
}
138-
139-
// Cropped screenshot — only transfers the crop region from GPU
140-
var cropped = source.TakeScreenshot(cropX: 960, cropY: 200, cropWidth: 640, cropHeight: 160);
141140
```
142141

143142
## Encoders

0 commit comments

Comments
 (0)