specific carplay ui
This commit is contained in:
1 parent
9d8aef4039
commit
069d5cf1c3
8 files changed
+306
-6
No files matched your search
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// CPBitmapHandler.swift
|
||||
// Pocket Poster
|
||||
//
|
||||
// Created by lemin on 6/16/25.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Dynamic
|
||||
|
||||
class CPBitmapHandler {
|
||||
static func resizeAndSave(image: UIImage, to url: URL, size: CGSize) throws {
|
||||
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
|
||||
image.draw(in: CGRect(origin: CGPoint.zero, size: size))
|
||||
let resizedImage = UIGraphicsGetImageFromCurrentImageContext()!
|
||||
UIGraphicsEndImageContext()
|
||||
|
||||
try? FileManager.default.removeItem(at: url)
|
||||
|
||||
resizedImage.writeToCPBitmapFile(to: url.path() as NSString)
|
||||
}
|
||||
}
|
||||
|
||||
extension UIImage {
|
||||
func writeToCPBitmapFile(to path: NSString) {
|
||||
Dynamic(self).writeToCPBitmapFile(path, flags: 1)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user