Enhanced interoperability with other platforms.

This commit is contained in:
shogo4405
2026-02-16 00:44:28 +09:00
parent de6def6aae
commit fe04d3ec6f
6 changed files with 15 additions and 10 deletions
+2 -2
View File
@@ -1059,7 +1059,7 @@
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_ASSET_PATHS = macOS/SampleVideo_360x240_5mb.mp4;
DEVELOPMENT_ASSET_PATHS = "macOS/SampleVideo_360x240_5mb.mp4 macOS/AppIcon.png";
DEVELOPMENT_TEAM = SUEQ2SZ2L5;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
@@ -1103,7 +1103,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = macOS/SampleVideo_360x240_5mb.mp4;
DEVELOPMENT_ASSET_PATHS = "macOS/SampleVideo_360x240_5mb.mp4 macOS/AppIcon.png";
DEVELOPMENT_TEAM = SUEQ2SZ2L5;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

+4 -3
View File
@@ -112,9 +112,10 @@ final class PublishViewModel: ObservableObject {
image.horizontalAlignment = .right
image.verticalAlignment = .bottom
image.layoutMargin = .init(top: 0, left: 0, bottom: 16, right: 16)
let nsImage = await NSApplication.shared.applicationIconImage
if let cgImage = nsImage?.cgImage(forProposedRect: nil, context: nil, hints: nil) {
image.ciImage = CIImage(cgImage: cgImage)
let appIconFile = URL(fileURLWithPath: Bundle.main.path(forResource: "AppIcon", ofType: "png") ?? "")
if let nsImage = NSImage(contentsOf: appIconFile), let cgImage = nsImage.cgImage(forProposedRect: nil, context: nil, hints: nil) {
let ciImage = CIImage(cgImage: cgImage)
image.ciImage = ciImage
}
try? await mixer.screen.addChild(image)
}
+1 -1
View File
@@ -17,7 +17,7 @@ public final actor MediaMixer {
}
/// An enumeration defines the capture session mode used for video/audio input.
public enum CaptureSessionMode: Sendable {
public enum CaptureSessionMode: String, Codable, Sendable {
/// Uses a standard `AVCaptureSession`
case single
/// Uses an `AVCaptureMultiCamSession`
@@ -78,7 +78,6 @@ public final class ImageScreenObject: ScreenObject {
do {
try setSource(newValue[Keys.source])
} catch {
print(error)
logger.warn(error)
}
}
@@ -90,7 +89,11 @@ public final class ImageScreenObject: ScreenObject {
let intersection = bounds.intersection(renderer.bounds)
guard bounds != intersection else {
return ciImage
if let ciImage {
return ciImage.transformed(by: .init(scaleX: size.width / ciImage.extent.width, y: size.height / ciImage.extent.height))
} else {
return nil
}
}
// Handling when the drawing area is exceeded.
@@ -113,6 +116,7 @@ public final class ImageScreenObject: ScreenObject {
case .bottom:
y = abs(bounds.origin.y)
}
if let ciImage = ciImage?.cropped(to: .init(origin: .init(x: x, y: y), size: intersection.size)) {
return ciImage
} else {
@@ -127,7 +131,7 @@ public final class ImageScreenObject: ScreenObject {
return super.makeBounds(size == .zero ? ciImage.extent.size : size)
}
public func setSource(_ source: String?) throws {
func setSource(_ source: String?) throws {
self.source = source
let imageSource = try ImageSourceFactory.parse(URL(string: source ?? ""))
ciImage = try imageSource.toImage()
@@ -15,7 +15,7 @@ public struct ScreenObjectSnapshot: Codable, Sendable {
/// The height of the rectangle.
public let height: Int
var cgSize: CGSize {
public var cgSize: CGSize {
return CGSize(width: width, height: height)
}
}