diff --git a/Sources/Kapture/CaptureController.swift b/Sources/Kapture/CaptureController.swift
index 82f5306..1f7cccb 100644
--- a/Sources/Kapture/CaptureController.swift
+++ b/Sources/Kapture/CaptureController.swift
@@ -402,23 +402,19 @@ final class ScreenCapture {
// Apply a rounded-corner alpha mask for window captures, matching
// macOS window chrome (≈10pt radius, scaled to image pixels).
if roundedCorners {
+ // Clip to a rounded rect and redraw — deterministic corner alpha
+ // (masking() can fail depending on the source pixel format).
let radius = 10 * scaleX
- let maskRect = CGRect(x: 0, y: 0, width: result.width, height: result.height)
- guard let maskCtx = CGContext(
+ guard let ctx = CGContext(
data: nil, width: result.width, height: result.height,
bitsPerComponent: 8, bytesPerRow: 0,
space: CGColorSpaceCreateDeviceRGB(),
bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue
) else { return result }
- maskCtx.setFillColor(CGColor(gray: 1, alpha: 1))
- maskCtx.fill(maskRect)
- maskCtx.setBlendMode(.clear)
- maskCtx.setFillColor(CGColor(gray: 0, alpha: 1))
- maskCtx.addPath(CGPath(roundedRect: maskRect, cornerWidth: radius, cornerHeight: radius, transform: nil))
- maskCtx.fillPath()
- maskCtx.setBlendMode(.normal)
- if let mask = maskCtx.makeImage(),
- let masked = result.masking(mask) {
+ ctx.addPath(CGPath(roundedRect: CGRect(x: 0, y: 0, width: result.width, height: result.height), cornerWidth: radius, cornerHeight: radius, transform: nil))
+ ctx.clip()
+ ctx.draw(result, in: CGRect(x: 0, y: 0, width: result.width, height: result.height))
+ if let masked = ctx.makeImage() {
result = masked
}
}
diff --git a/build-app.sh b/build-app.sh
index 0062a73..e895133 100755
--- a/build-app.sh
+++ b/build-app.sh
@@ -108,9 +108,9 @@ cat > "$APP/Contents/Info.plist" <<'PLIST'
CFBundleIconFile
Icon
CFBundleShortVersionString
- 1.8.3
+ 1.8.4
CFBundleVersion
- 83
+ 84
LSUIElement
NSHighResolutionCapable