This commit is contained in:
neon443 committed 2026-05-03 16:28:52 +01:00
1 parent 9f60f1a316
commit ba09d82aec
1 file changed
-37
-37
View File
@@ -38,41 +38,4 @@ class GifManager {
} }
return result return result
} }
static func dataFrom(frames: [(frame: CGImage, showFor: Double)]) -> Data? {
var data = NSMutableData()
let fileProperties = [
kCGImagePropertyGIFDictionary: [
kCGImagePropertyGIFLoopCount: 0
]
]
guard let destination = CGImageDestinationCreateWithData(
data,
UTType.gif.identifier as CFString,
frames.count,
nil
) else { fatalError() }
CGImageDestinationSetProperties(destination, fileProperties as NSDictionary)
for frame in frames {
autoreleasepool {
let frameProperties = [
kCGImagePropertyGIFDictionary: [
kCGImagePropertyGIFDelayTime: frame.showFor
]
]
CGImageDestinationAddImage(
destination,
frame.frame,
frameProperties as CFDictionary
)
}
}
guard CGImageDestinationFinalize(destination) else { fatalError() }
return data as Data
}
} }
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.