mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 14:04:58 +00:00
Mac: finish Moltbot rename (paths)
This commit is contained in:
17
apps/macos/Sources/Moltbot/ScreenshotSize.swift
Normal file
17
apps/macos/Sources/Moltbot/ScreenshotSize.swift
Normal file
@@ -0,0 +1,17 @@
|
||||
import Foundation
|
||||
import ImageIO
|
||||
|
||||
enum ScreenshotSize {
|
||||
struct Size {
|
||||
let width: Int
|
||||
let height: Int
|
||||
}
|
||||
|
||||
static func readPNGSize(data: Data) -> Size? {
|
||||
guard let source = CGImageSourceCreateWithData(data as CFData, nil) else { return nil }
|
||||
guard let props = CGImageSourceCopyPropertiesAtIndex(source, 0, nil) as? [CFString: Any] else { return nil }
|
||||
guard let width = props[kCGImagePropertyPixelWidth] as? Int else { return nil }
|
||||
guard let height = props[kCGImagePropertyPixelHeight] as? Int else { return nil }
|
||||
return Size(width: width, height: height)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user