react-native-fast-image 8.6.5 → 8.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -77,12 +77,34 @@
|
|
|
77
77
|
return image;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
UIImage*
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
UIImage* templateImage = [image imageWithRenderingMode: UIImageRenderingModeAlwaysTemplate];
|
|
81
|
+
CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height);
|
|
82
|
+
UIImage* newImage;
|
|
83
|
+
if (@available(iOS 10.0, tvOS 10.0, *)) {
|
|
84
|
+
// UIGraphicsBeginImageContextWithOptions is deprecated since iOS 17.
|
|
85
|
+
// Keep the source image's scale and a standard-range (8-bit) bitmap,
|
|
86
|
+
// matching what it produced.
|
|
87
|
+
UIGraphicsImageRendererFormat* format = [[UIGraphicsImageRendererFormat alloc] init];
|
|
88
|
+
format.scale = image.scale;
|
|
89
|
+
format.opaque = NO;
|
|
90
|
+
if (@available(iOS 12.0, tvOS 12.0, *)) {
|
|
91
|
+
format.preferredRange = UIGraphicsImageRendererFormatRangeStandard;
|
|
92
|
+
} else {
|
|
93
|
+
format.prefersExtendedRange = NO;
|
|
94
|
+
}
|
|
95
|
+
UIGraphicsImageRenderer* renderer = [[UIGraphicsImageRenderer alloc] initWithSize: image.size format: format];
|
|
96
|
+
newImage = [renderer imageWithActions: ^(UIGraphicsImageRendererContext* context) {
|
|
97
|
+
[color set];
|
|
98
|
+
[templateImage drawInRect: rect];
|
|
99
|
+
}];
|
|
100
|
+
} else {
|
|
101
|
+
// iOS/tvOS 9. Remove this branch once the minimum is iOS 10+.
|
|
102
|
+
UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale);
|
|
103
|
+
[color set];
|
|
104
|
+
[templateImage drawInRect: rect];
|
|
105
|
+
newImage = UIGraphicsGetImageFromCurrentImageContext();
|
|
106
|
+
UIGraphicsEndImageContext();
|
|
107
|
+
}
|
|
86
108
|
return newImage;
|
|
87
109
|
}
|
|
88
110
|
|