Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
924a692f2b |
@@ -402,23 +402,19 @@ final class ScreenCapture {
|
|||||||
// Apply a rounded-corner alpha mask for window captures, matching
|
// Apply a rounded-corner alpha mask for window captures, matching
|
||||||
// macOS window chrome (≈10pt radius, scaled to image pixels).
|
// macOS window chrome (≈10pt radius, scaled to image pixels).
|
||||||
if roundedCorners {
|
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 radius = 10 * scaleX
|
||||||
let maskRect = CGRect(x: 0, y: 0, width: result.width, height: result.height)
|
guard let ctx = CGContext(
|
||||||
guard let maskCtx = CGContext(
|
|
||||||
data: nil, width: result.width, height: result.height,
|
data: nil, width: result.width, height: result.height,
|
||||||
bitsPerComponent: 8, bytesPerRow: 0,
|
bitsPerComponent: 8, bytesPerRow: 0,
|
||||||
space: CGColorSpaceCreateDeviceRGB(),
|
space: CGColorSpaceCreateDeviceRGB(),
|
||||||
bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue
|
bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue
|
||||||
) else { return result }
|
) else { return result }
|
||||||
maskCtx.setFillColor(CGColor(gray: 1, alpha: 1))
|
ctx.addPath(CGPath(roundedRect: CGRect(x: 0, y: 0, width: result.width, height: result.height), cornerWidth: radius, cornerHeight: radius, transform: nil))
|
||||||
maskCtx.fill(maskRect)
|
ctx.clip()
|
||||||
maskCtx.setBlendMode(.clear)
|
ctx.draw(result, in: CGRect(x: 0, y: 0, width: result.width, height: result.height))
|
||||||
maskCtx.setFillColor(CGColor(gray: 0, alpha: 1))
|
if let masked = ctx.makeImage() {
|
||||||
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) {
|
|
||||||
result = masked
|
result = masked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -108,9 +108,9 @@ cat > "$APP/Contents/Info.plist" <<'PLIST'
|
|||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>Icon</string>
|
<string>Icon</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.8.3</string>
|
<string>1.8.4</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>83</string>
|
<string>84</string>
|
||||||
<key>LSUIElement</key>
|
<key>LSUIElement</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHighResolutionCapable</key>
|
<key>NSHighResolutionCapable</key>
|
||||||
|
|||||||
Reference in New Issue
Block a user