|
|
@@ -28,6 +28,12 @@ static CGImageSourceRef (*SDCGImageGetImageSource)(CGImageRef);
|
|
|
|
|
|
// Specify File Size for lossy format encoding, like JPEG
|
|
|
static NSString * kSDCGImageDestinationRequestedFileSize = @"kCGImageDestinationRequestedFileSize";
|
|
|
+// Support Xcode 15 SDK, use raw value instead of symbol
|
|
|
+static NSString * kSDCGImageDestinationEncodeRequest = @"kCGImageDestinationEncodeRequest";
|
|
|
+static NSString * kSDCGImageDestinationEncodeToSDR = @"kCGImageDestinationEncodeToSDR";
|
|
|
+static NSString * kSDCGImageDestinationEncodeToISOHDR = @"kCGImageDestinationEncodeToISOHDR";
|
|
|
+static NSString * kSDCGImageDestinationEncodeToISOGainmap = @"kCGImageDestinationEncodeToISOGainmap";
|
|
|
+
|
|
|
|
|
|
// This strip the un-wanted CGImageProperty, like the internal CGImageSourceRef in iOS 15+
|
|
|
// However, CGImageCreateCopy still keep those CGImageProperty, not suit for our use case
|
|
|
@@ -282,6 +288,18 @@ static BOOL SDImageIOPNGPluginBuggyNeedWorkaround(void) {
|
|
|
BOOL _decodeToHDR;
|
|
|
}
|
|
|
|
|
|
+#if SD_IMAGEIO_HDR_ENCODING
|
|
|
++ (void)initialize {
|
|
|
+ if (@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)) {
|
|
|
+ // Use SDK instead of raw value
|
|
|
+ kSDCGImageDestinationEncodeRequest = (__bridge NSString *)kCGImageDestinationEncodeRequest;
|
|
|
+ kSDCGImageDestinationEncodeToSDR = (__bridge NSString *)kCGImageDestinationEncodeToSDR;
|
|
|
+ kSDCGImageDestinationEncodeToISOHDR = (__bridge NSString *)kCGImageDestinationEncodeToISOHDR;
|
|
|
+ kSDCGImageDestinationEncodeToISOGainmap = (__bridge NSString *)kCGImageDestinationEncodeToISOGainmap;
|
|
|
+ }
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
- (void)dealloc
|
|
|
{
|
|
|
if (_imageSource) {
|
|
|
@@ -902,11 +920,11 @@ static BOOL SDImageIOPNGPluginBuggyNeedWorkaround(void) {
|
|
|
}
|
|
|
if (@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)) {
|
|
|
if (encodeToHDR == 1) {
|
|
|
- properties[(__bridge NSString *)kCGImageDestinationEncodeRequest] = (__bridge NSString *)kCGImageDestinationEncodeToISOHDR;
|
|
|
+ properties[kSDCGImageDestinationEncodeRequest] = kSDCGImageDestinationEncodeToISOHDR;
|
|
|
} else if (encodeToHDR == 2) {
|
|
|
- properties[(__bridge NSString *)kCGImageDestinationEncodeRequest] = (__bridge NSString *)kCGImageDestinationEncodeToISOGainmap;
|
|
|
+ properties[kSDCGImageDestinationEncodeRequest] = kSDCGImageDestinationEncodeToISOGainmap;
|
|
|
} else {
|
|
|
- properties[(__bridge NSString *)kCGImageDestinationEncodeRequest] = (__bridge NSString *)kCGImageDestinationEncodeToSDR;
|
|
|
+ properties[kSDCGImageDestinationEncodeRequest] = kSDCGImageDestinationEncodeToSDR;
|
|
|
}
|
|
|
}
|
|
|
|