@octane-xplat/nativescript-mason-core 0.0.1 → 1.0.0-beta.0

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.
Files changed (187) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +113 -2
  3. package/artifact-inventory.json +746 -0
  4. package/box-shadow.d.ts +10 -0
  5. package/box-shadow.js +48 -0
  6. package/common.d.ts +482 -0
  7. package/common.js +2645 -0
  8. package/css-colors.d.ts +17 -0
  9. package/css-colors.js +54 -0
  10. package/css-filter.d.ts +17 -0
  11. package/css-filter.js +140 -0
  12. package/css-keyframes.d.ts +41 -0
  13. package/css-keyframes.js +437 -0
  14. package/css-math.d.ts +34 -0
  15. package/css-math.js +300 -0
  16. package/css-shorthands.d.ts +65 -0
  17. package/css-shorthands.js +673 -0
  18. package/css-transform.d.ts +6 -0
  19. package/css-transform.js +100 -0
  20. package/diagnostics.d.ts +51 -0
  21. package/diagnostics.js +52 -0
  22. package/display-density.d.ts +9 -0
  23. package/display-density.js +20 -0
  24. package/fonts.d.ts +20 -0
  25. package/fonts.js +88 -0
  26. package/foreign-layout.d.ts +6 -0
  27. package/foreign-layout.js +149 -0
  28. package/gradient-stops.d.ts +25 -0
  29. package/gradient-stops.js +112 -0
  30. package/index.android.d.ts +9 -0
  31. package/index.android.js +8 -0
  32. package/index.d.ts +10 -0
  33. package/index.ios.d.ts +9 -0
  34. package/index.ios.js +8 -0
  35. package/ios-host-README.md +124 -0
  36. package/layout-types.d.ts +192 -0
  37. package/mask.d.ts +54 -0
  38. package/mask.js +26 -0
  39. package/native-types-README.md +51 -0
  40. package/package.json +44 -6
  41. package/panel-helpers.d.ts +3 -0
  42. package/panel-helpers.js +8 -0
  43. package/platforms/android/MasonCore.aar +0 -0
  44. package/platforms/android/include.gradle +6 -0
  45. package/platforms/android/manifest.json +73 -0
  46. package/platforms/ios/FontManager.LICENSE +201 -0
  47. package/platforms/ios/MasonCore.xcframework/Info.plist +43 -0
  48. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/Mason.h +25 -0
  49. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/MasonCore-Swift.h +1739 -0
  50. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/mason_native.h +601 -0
  51. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Info.plist +0 -0
  52. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/MasonCore +0 -0
  53. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  54. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.abi.json +100095 -0
  55. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.private.swiftinterface +3174 -0
  56. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  57. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.swiftinterface +3174 -0
  58. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/module.modulemap +9 -0
  59. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/SDWebImage_SDWebImage.bundle/Info.plist +0 -0
  60. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/SDWebImage_SDWebImage.bundle/PrivacyInfo.xcprivacy +23 -0
  61. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/Mason.h +25 -0
  62. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/MasonCore-Swift.h +1739 -0
  63. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/mason_native.h +601 -0
  64. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Info.plist +0 -0
  65. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/MasonCore +0 -0
  66. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  67. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.abi.json +100095 -0
  68. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3174 -0
  69. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  70. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3174 -0
  71. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/module.modulemap +9 -0
  72. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/SDWebImage_SDWebImage.bundle/Info.plist +0 -0
  73. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/SDWebImage_SDWebImage.bundle/PrivacyInfo.xcprivacy +23 -0
  74. package/platforms/ios/Package.resolved +24 -0
  75. package/platforms/ios/SDWebImage.LICENSE +20 -0
  76. package/platforms/ios/build.xcconfig +4 -0
  77. package/platforms/ios/device-manifest.json +213 -0
  78. package/platforms/ios/include/FontManager/NSCFontDescriptors.h +36 -0
  79. package/platforms/ios/include/FontManager/NSCFontFace.h +98 -0
  80. package/platforms/ios/include/FontManager/NSCFontFaceSet.h +73 -0
  81. package/platforms/ios/include/FontManager/NSCFontManagerUmbrella.h +7 -0
  82. package/platforms/ios/include/FontManager/NSCFontParser.h +22 -0
  83. package/platforms/ios/include/FontManager/NSCFontRegex.h +4 -0
  84. package/platforms/ios/include/FontManager/NSCFontResolver.h +43 -0
  85. package/platforms/ios/include/FontManager/NSCFontStyle.h +27 -0
  86. package/platforms/ios/include/FontManager/NSCFontTypes.h +41 -0
  87. package/platforms/ios/include/SDWebImage/NSButton+WebCache.h +340 -0
  88. package/platforms/ios/include/SDWebImage/NSData+ImageContentType.h +63 -0
  89. package/platforms/ios/include/SDWebImage/NSImage+Compatibility.h +67 -0
  90. package/platforms/ios/include/SDWebImage/SDAnimatedImage.h +136 -0
  91. package/platforms/ios/include/SDWebImage/SDAnimatedImagePlayer.h +113 -0
  92. package/platforms/ios/include/SDWebImage/SDAnimatedImageRep.h +33 -0
  93. package/platforms/ios/include/SDWebImage/SDAnimatedImageView+WebCache.h +168 -0
  94. package/platforms/ios/include/SDWebImage/SDAnimatedImageView.h +125 -0
  95. package/platforms/ios/include/SDWebImage/SDCallbackQueue.h +59 -0
  96. package/platforms/ios/include/SDWebImage/SDDiskCache.h +146 -0
  97. package/platforms/ios/include/SDWebImage/SDGraphicsImageRenderer.h +84 -0
  98. package/platforms/ios/include/SDWebImage/SDImageAPNGCoder.h +19 -0
  99. package/platforms/ios/include/SDWebImage/SDImageAWebPCoder.h +23 -0
  100. package/platforms/ios/include/SDWebImage/SDImageCache.h +482 -0
  101. package/platforms/ios/include/SDWebImage/SDImageCacheConfig.h +153 -0
  102. package/platforms/ios/include/SDWebImage/SDImageCacheDefine.h +179 -0
  103. package/platforms/ios/include/SDWebImage/SDImageCachesManager.h +81 -0
  104. package/platforms/ios/include/SDWebImage/SDImageCoder.h +347 -0
  105. package/platforms/ios/include/SDWebImage/SDImageCoderHelper.h +251 -0
  106. package/platforms/ios/include/SDWebImage/SDImageCodersManager.h +58 -0
  107. package/platforms/ios/include/SDWebImage/SDImageFrame.h +44 -0
  108. package/platforms/ios/include/SDWebImage/SDImageGIFCoder.h +22 -0
  109. package/platforms/ios/include/SDWebImage/SDImageGraphics.h +28 -0
  110. package/platforms/ios/include/SDWebImage/SDImageHEICCoder.h +25 -0
  111. package/platforms/ios/include/SDWebImage/SDImageIOAnimatedCoder.h +65 -0
  112. package/platforms/ios/include/SDWebImage/SDImageIOCoder.h +30 -0
  113. package/platforms/ios/include/SDWebImage/SDImageLoader.h +146 -0
  114. package/platforms/ios/include/SDWebImage/SDImageLoadersManager.h +40 -0
  115. package/platforms/ios/include/SDWebImage/SDImageTransformer.h +283 -0
  116. package/platforms/ios/include/SDWebImage/SDMemoryCache.h +78 -0
  117. package/platforms/ios/include/SDWebImage/SDWebImage.h +91 -0
  118. package/platforms/ios/include/SDWebImage/SDWebImageCacheKeyFilter.h +35 -0
  119. package/platforms/ios/include/SDWebImage/SDWebImageCacheSerializer.h +39 -0
  120. package/platforms/ios/include/SDWebImage/SDWebImageCompat.h +102 -0
  121. package/platforms/ios/include/SDWebImage/SDWebImageDefine.h +420 -0
  122. package/platforms/ios/include/SDWebImage/SDWebImageDownloader.h +320 -0
  123. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderConfig.h +113 -0
  124. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderDecryptor.h +52 -0
  125. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderOperation.h +191 -0
  126. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderRequestModifier.h +72 -0
  127. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderResponseModifier.h +72 -0
  128. package/platforms/ios/include/SDWebImage/SDWebImageError.h +33 -0
  129. package/platforms/ios/include/SDWebImage/SDWebImageIndicator.h +119 -0
  130. package/platforms/ios/include/SDWebImage/SDWebImageManager.h +290 -0
  131. package/platforms/ios/include/SDWebImage/SDWebImageOperation.h +27 -0
  132. package/platforms/ios/include/SDWebImage/SDWebImageOptionsProcessor.h +78 -0
  133. package/platforms/ios/include/SDWebImage/SDWebImagePrefetcher.h +168 -0
  134. package/platforms/ios/include/SDWebImage/SDWebImageTransition.h +131 -0
  135. package/platforms/ios/include/SDWebImage/UIButton+WebCache.h +402 -0
  136. package/platforms/ios/include/SDWebImage/UIImage+ExtendedCacheData.h +24 -0
  137. package/platforms/ios/include/SDWebImage/UIImage+ForceDecode.h +52 -0
  138. package/platforms/ios/include/SDWebImage/UIImage+GIF.h +26 -0
  139. package/platforms/ios/include/SDWebImage/UIImage+MemoryCacheCost.h +27 -0
  140. package/platforms/ios/include/SDWebImage/UIImage+Metadata.h +104 -0
  141. package/platforms/ios/include/SDWebImage/UIImage+MultiFormat.h +81 -0
  142. package/platforms/ios/include/SDWebImage/UIImage+Transform.h +164 -0
  143. package/platforms/ios/include/SDWebImage/UIImageView+HighlightedWebCache.h +142 -0
  144. package/platforms/ios/include/SDWebImage/UIImageView+WebCache.h +209 -0
  145. package/platforms/ios/include/SDWebImage/UIView+WebCache.h +131 -0
  146. package/platforms/ios/include/SDWebImage/UIView+WebCacheOperation.h +52 -0
  147. package/platforms/ios/include/SDWebImage/UIView+WebCacheState.h +63 -0
  148. package/platforms/ios/include/module.modulemap +2 -0
  149. package/platforms/ios/manifest.json +132 -0
  150. package/platforms/ios/simulator-manifest.json +213 -0
  151. package/plugin-README.md +197 -0
  152. package/properties.d.ts +154 -0
  153. package/properties.js +2454 -0
  154. package/pseudo.d.ts +9 -0
  155. package/pseudo.js +57 -0
  156. package/scroll/index.android.d.ts +15 -0
  157. package/scroll/index.android.js +72 -0
  158. package/scroll/index.d.ts +5 -0
  159. package/scroll/index.ios.d.ts +18 -0
  160. package/scroll/index.ios.js +106 -0
  161. package/style.d.ts +768 -0
  162. package/style.js +7151 -0
  163. package/symbols.d.ts +25 -0
  164. package/symbols.js +41 -0
  165. package/tree/index.android.d.ts +11 -0
  166. package/tree/index.android.js +42 -0
  167. package/tree/index.d.ts +15 -0
  168. package/tree/index.ios.d.ts +26 -0
  169. package/tree/index.ios.js +53 -0
  170. package/typings/android-declarations.d.ts +4 -0
  171. package/typings/android.d.ts +9730 -0
  172. package/typings/manifest.json +45 -0
  173. package/typings/native.d.ts +5 -0
  174. package/typings/objc!FontManager.d.ts +389 -0
  175. package/typings/objc!MasonCore.d.ts +2472 -0
  176. package/typings/objc!SDWebImage.d.ts +3378 -0
  177. package/units.d.ts +29 -0
  178. package/units.js +44 -0
  179. package/utils/index.android.d.ts +211 -0
  180. package/utils/index.android.js +595 -0
  181. package/utils/index.ios.d.ts +222 -0
  182. package/utils/index.ios.js +790 -0
  183. package/view/index.android.d.ts +13 -0
  184. package/view/index.android.js +74 -0
  185. package/view/index.d.ts +2 -0
  186. package/view/index.ios.d.ts +24 -0
  187. package/view/index.ios.js +157 -0
@@ -0,0 +1,340 @@
1
+ /*
2
+ * This file is part of the SDWebImage package.
3
+ * (c) Olivier Poitrey <rs@dailymotion.com>
4
+ *
5
+ * For the full copyright and license information, please view the LICENSE
6
+ * file that was distributed with this source code.
7
+ */
8
+
9
+ #import "SDWebImageCompat.h"
10
+
11
+ #if SD_MAC
12
+
13
+ #import "SDWebImageManager.h"
14
+
15
+ /**
16
+ * Integrates SDWebImage async downloading and caching of remote images with NSButton.
17
+ */
18
+ @interface NSButton (WebCache)
19
+
20
+ #pragma mark - Image
21
+
22
+ /**
23
+ * Get the current image URL.
24
+ */
25
+ @property (nonatomic, strong, readonly, nullable) NSURL *sd_currentImageURL;
26
+
27
+ /**
28
+ * Set the button `image` with an `url`.
29
+ *
30
+ * The download is asynchronous and cached.
31
+ *
32
+ * @param url The url for the image.
33
+ */
34
+ - (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT;
35
+
36
+ /**
37
+ * Set the button `image` with an `url` and a placeholder.
38
+ *
39
+ * The download is asynchronous and cached.
40
+ *
41
+ * @param url The url for the image.
42
+ * @param placeholder The image to be set initially, until the image request finishes.
43
+ * @see sd_setImageWithURL:placeholderImage:options:
44
+ */
45
+ - (void)sd_setImageWithURL:(nullable NSURL *)url
46
+ placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT;
47
+
48
+ /**
49
+ * Set the button `image` with an `url`, placeholder and custom options.
50
+ *
51
+ * The download is asynchronous and cached.
52
+ *
53
+ * @param url The url for the image.
54
+ * @param placeholder The image to be set initially, until the image request finishes.
55
+ * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
56
+ */
57
+ - (void)sd_setImageWithURL:(nullable NSURL *)url
58
+ placeholderImage:(nullable UIImage *)placeholder
59
+ options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;
60
+
61
+ /**
62
+ * Set the button `image` with an `url`, placeholder and custom options.
63
+ *
64
+ * The download is asynchronous and cached.
65
+ *
66
+ * @param url The url for the image.
67
+ * @param placeholder The image to be set initially, until the image request finishes.
68
+ * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
69
+ * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
70
+ */
71
+ - (void)sd_setImageWithURL:(nullable NSURL *)url
72
+ placeholderImage:(nullable UIImage *)placeholder
73
+ options:(SDWebImageOptions)options
74
+ context:(nullable SDWebImageContext *)context;
75
+
76
+ /**
77
+ * Set the button `image` with an `url`.
78
+ *
79
+ * The download is asynchronous and cached.
80
+ *
81
+ * @param url The url for the image.
82
+ * @param completedBlock A block called when operation has been completed. This block has no return value
83
+ * and takes the requested UIImage as first parameter. In case of error the image parameter
84
+ * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
85
+ * indicating if the image was retrieved from the local cache or from the network.
86
+ * The fourth parameter is the original image url.
87
+ */
88
+ - (void)sd_setImageWithURL:(nullable NSURL *)url
89
+ completed:(nullable SDExternalCompletionBlock)completedBlock;
90
+
91
+ /**
92
+ * Set the button `image` with an `url`, placeholder.
93
+ *
94
+ * The download is asynchronous and cached.
95
+ *
96
+ * @param url The url for the image.
97
+ * @param placeholder The image to be set initially, until the image request finishes.
98
+ * @param completedBlock A block called when operation has been completed. This block has no return value
99
+ * and takes the requested UIImage as first parameter. In case of error the image parameter
100
+ * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
101
+ * indicating if the image was retrieved from the local cache or from the network.
102
+ * The fourth parameter is the original image url.
103
+ */
104
+ - (void)sd_setImageWithURL:(nullable NSURL *)url
105
+ placeholderImage:(nullable UIImage *)placeholder
106
+ completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;
107
+
108
+ /**
109
+ * Set the button `image` with an `url`, placeholder and custom options.
110
+ *
111
+ * The download is asynchronous and cached.
112
+ *
113
+ * @param url The url for the image.
114
+ * @param placeholder The image to be set initially, until the image request finishes.
115
+ * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
116
+ * @param completedBlock A block called when operation has been completed. This block has no return value
117
+ * and takes the requested UIImage as first parameter. In case of error the image parameter
118
+ * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
119
+ * indicating if the image was retrieved from the local cache or from the network.
120
+ * The fourth parameter is the original image url.
121
+ */
122
+ - (void)sd_setImageWithURL:(nullable NSURL *)url
123
+ placeholderImage:(nullable UIImage *)placeholder
124
+ options:(SDWebImageOptions)options
125
+ completed:(nullable SDExternalCompletionBlock)completedBlock;
126
+
127
+ /**
128
+ * Set the button `image` with an `url`, placeholder and custom options.
129
+ *
130
+ * The download is asynchronous and cached.
131
+ *
132
+ * @param url The url for the image.
133
+ * @param placeholder The image to be set initially, until the image request finishes.
134
+ * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
135
+ * @param progressBlock A block called while image is downloading
136
+ * @note the progress block is executed on a background queue
137
+ * @param completedBlock A block called when operation has been completed. This block has no return value
138
+ * and takes the requested UIImage as first parameter. In case of error the image parameter
139
+ * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
140
+ * indicating if the image was retrieved from the local cache or from the network.
141
+ * The fourth parameter is the original image url.
142
+ */
143
+ - (void)sd_setImageWithURL:(nullable NSURL *)url
144
+ placeholderImage:(nullable UIImage *)placeholder
145
+ options:(SDWebImageOptions)options
146
+ progress:(nullable SDImageLoaderProgressBlock)progressBlock
147
+ completed:(nullable SDExternalCompletionBlock)completedBlock;
148
+
149
+ /**
150
+ * Set the button `image` with an `url`, placeholder and custom options.
151
+ *
152
+ * The download is asynchronous and cached.
153
+ *
154
+ * @param url The url for the image.
155
+ * @param placeholder The image to be set initially, until the image request finishes.
156
+ * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
157
+ * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
158
+ * @param progressBlock A block called while image is downloading
159
+ * @note the progress block is executed on a background queue
160
+ * @param completedBlock A block called when operation has been completed. This block has no return value
161
+ * and takes the requested UIImage as first parameter. In case of error the image parameter
162
+ * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
163
+ * indicating if the image was retrieved from the local cache or from the network.
164
+ * The fourth parameter is the original image url.
165
+ */
166
+ - (void)sd_setImageWithURL:(nullable NSURL *)url
167
+ placeholderImage:(nullable UIImage *)placeholder
168
+ options:(SDWebImageOptions)options
169
+ context:(nullable SDWebImageContext *)context
170
+ progress:(nullable SDImageLoaderProgressBlock)progressBlock
171
+ completed:(nullable SDExternalCompletionBlock)completedBlock;
172
+
173
+ #pragma mark - Alternate Image
174
+
175
+ /**
176
+ * Get the current alternateImage URL.
177
+ */
178
+ @property (nonatomic, strong, readonly, nullable) NSURL *sd_currentAlternateImageURL;
179
+
180
+ /**
181
+ * Set the button `alternateImage` with an `url`.
182
+ *
183
+ * The download is asynchronous and cached.
184
+ *
185
+ * @param url The url for the alternateImage.
186
+ */
187
+ - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT;
188
+
189
+ /**
190
+ * Set the button `alternateImage` with an `url` and a placeholder.
191
+ *
192
+ * The download is asynchronous and cached.
193
+ *
194
+ * @param url The url for the alternateImage.
195
+ * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes.
196
+ * @see sd_setAlternateImageWithURL:placeholderImage:options:
197
+ */
198
+ - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url
199
+ placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT;
200
+
201
+ /**
202
+ * Set the button `alternateImage` with an `url`, placeholder and custom options.
203
+ *
204
+ * The download is asynchronous and cached.
205
+ *
206
+ * @param url The url for the alternateImage.
207
+ * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes.
208
+ * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values.
209
+ */
210
+ - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url
211
+ placeholderImage:(nullable UIImage *)placeholder
212
+ options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;
213
+
214
+ /**
215
+ * Set the button `alternateImage` with an `url`, placeholder, custom options and context.
216
+ *
217
+ * The download is asynchronous and cached.
218
+ *
219
+ * @param url The url for the alternateImage.
220
+ * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes.
221
+ * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values.
222
+ * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
223
+ */
224
+ - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url
225
+ placeholderImage:(nullable UIImage *)placeholder
226
+ options:(SDWebImageOptions)options
227
+ context:(nullable SDWebImageContext *)context;
228
+
229
+ /**
230
+ * Set the button `alternateImage` with an `url`.
231
+ *
232
+ * The download is asynchronous and cached.
233
+ *
234
+ * @param url The url for the alternateImage.
235
+ * @param completedBlock A block called when operation has been completed. This block has no return value
236
+ * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter
237
+ * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
238
+ * indicating if the alternateImage was retrieved from the local cache or from the network.
239
+ * The fourth parameter is the original alternateImage url.
240
+ */
241
+ - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url
242
+ completed:(nullable SDExternalCompletionBlock)completedBlock;
243
+
244
+ /**
245
+ * Set the button `alternateImage` with an `url`, placeholder.
246
+ *
247
+ * The download is asynchronous and cached.
248
+ *
249
+ * @param url The url for the alternateImage.
250
+ * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes.
251
+ * @param completedBlock A block called when operation has been completed. This block has no return value
252
+ * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter
253
+ * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
254
+ * indicating if the alternateImage was retrieved from the local cache or from the network.
255
+ * The fourth parameter is the original alternateImage url.
256
+ */
257
+ - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url
258
+ placeholderImage:(nullable UIImage *)placeholder
259
+ completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;
260
+
261
+ /**
262
+ * Set the button `alternateImage` with an `url`, placeholder and custom options.
263
+ *
264
+ * The download is asynchronous and cached.
265
+ *
266
+ * @param url The url for the alternateImage.
267
+ * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes.
268
+ * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values.
269
+ * @param completedBlock A block called when operation has been completed. This block has no return value
270
+ * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter
271
+ * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
272
+ * indicating if the alternateImage was retrieved from the local cache or from the network.
273
+ * The fourth parameter is the original alternateImage url.
274
+ */
275
+ - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url
276
+ placeholderImage:(nullable UIImage *)placeholder
277
+ options:(SDWebImageOptions)options
278
+ completed:(nullable SDExternalCompletionBlock)completedBlock;
279
+
280
+ /**
281
+ * Set the button `alternateImage` with an `url`, placeholder and custom options.
282
+ *
283
+ * The download is asynchronous and cached.
284
+ *
285
+ * @param url The url for the alternateImage.
286
+ * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes.
287
+ * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values.
288
+ * @param progressBlock A block called while alternateImage is downloading
289
+ * @note the progress block is executed on a background queue
290
+ * @param completedBlock A block called when operation has been completed. This block has no return value
291
+ * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter
292
+ * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
293
+ * indicating if the alternateImage was retrieved from the local cache or from the network.
294
+ * The fourth parameter is the original alternateImage url.
295
+ */
296
+ - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url
297
+ placeholderImage:(nullable UIImage *)placeholder
298
+ options:(SDWebImageOptions)options
299
+ progress:(nullable SDImageLoaderProgressBlock)progressBlock
300
+ completed:(nullable SDExternalCompletionBlock)completedBlock;
301
+
302
+ /**
303
+ * Set the button `alternateImage` with an `url`, placeholder, custom options and context.
304
+ *
305
+ * The download is asynchronous and cached.
306
+ *
307
+ * @param url The url for the alternateImage.
308
+ * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes.
309
+ * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values.
310
+ * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
311
+ * @param progressBlock A block called while alternateImage is downloading
312
+ * @note the progress block is executed on a background queue
313
+ * @param completedBlock A block called when operation has been completed. This block has no return value
314
+ * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter
315
+ * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
316
+ * indicating if the alternateImage was retrieved from the local cache or from the network.
317
+ * The fourth parameter is the original alternateImage url.
318
+ */
319
+ - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url
320
+ placeholderImage:(nullable UIImage *)placeholder
321
+ options:(SDWebImageOptions)options
322
+ context:(nullable SDWebImageContext *)context
323
+ progress:(nullable SDImageLoaderProgressBlock)progressBlock
324
+ completed:(nullable SDExternalCompletionBlock)completedBlock;
325
+
326
+ #pragma mark - Cancel
327
+
328
+ /**
329
+ * Cancel the current image download
330
+ */
331
+ - (void)sd_cancelCurrentImageLoad;
332
+
333
+ /**
334
+ * Cancel the current alternateImage download
335
+ */
336
+ - (void)sd_cancelCurrentAlternateImageLoad;
337
+
338
+ @end
339
+
340
+ #endif
@@ -0,0 +1,63 @@
1
+ /*
2
+ * This file is part of the SDWebImage package.
3
+ * (c) Olivier Poitrey <rs@dailymotion.com>
4
+ * (c) Fabrice Aneche
5
+ *
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+
10
+ #import <Foundation/Foundation.h>
11
+ #import "SDWebImageCompat.h"
12
+
13
+ /**
14
+ You can use switch case like normal enum. It's also recommended to add a default case. You should not assume anything about the raw value.
15
+ For custom coder plugin, it can also extern the enum for supported format. See `SDImageCoder` for more detailed information.
16
+ */
17
+ typedef NSInteger SDImageFormat NS_TYPED_EXTENSIBLE_ENUM;
18
+ static const SDImageFormat SDImageFormatUndefined = -1;
19
+ static const SDImageFormat SDImageFormatJPEG = 0;
20
+ static const SDImageFormat SDImageFormatPNG = 1;
21
+ static const SDImageFormat SDImageFormatGIF = 2;
22
+ static const SDImageFormat SDImageFormatTIFF = 3;
23
+ static const SDImageFormat SDImageFormatWebP = 4;
24
+ static const SDImageFormat SDImageFormatHEIC = 5;
25
+ static const SDImageFormat SDImageFormatHEIF = 6;
26
+ static const SDImageFormat SDImageFormatPDF = 7;
27
+ static const SDImageFormat SDImageFormatSVG = 8;
28
+ static const SDImageFormat SDImageFormatBMP = 9;
29
+ static const SDImageFormat SDImageFormatRAW = 10;
30
+
31
+ /**
32
+ NSData category about the image content type and UTI.
33
+ */
34
+ @interface NSData (ImageContentType)
35
+
36
+ /**
37
+ * Return image format
38
+ *
39
+ * @param data the input image data
40
+ *
41
+ * @return the image format as `SDImageFormat` (enum)
42
+ */
43
+ + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data;
44
+
45
+ /**
46
+ * Convert SDImageFormat to UTType
47
+ *
48
+ * @param format Format as SDImageFormat
49
+ * @return The UTType as CFStringRef
50
+ * @note For unknown format, `kSDUTTypeImage` abstract type will return
51
+ */
52
+ + (nonnull CFStringRef)sd_UTTypeFromImageFormat:(SDImageFormat)format CF_RETURNS_NOT_RETAINED NS_SWIFT_NAME(sd_UTType(from:));
53
+
54
+ /**
55
+ * Convert UTType to SDImageFormat
56
+ *
57
+ * @param uttype The UTType as CFStringRef
58
+ * @return The Format as SDImageFormat
59
+ * @note For unknown type, `SDImageFormatUndefined` will return
60
+ */
61
+ + (SDImageFormat)sd_imageFormatFromUTType:(nonnull CFStringRef)uttype;
62
+
63
+ @end
@@ -0,0 +1,67 @@
1
+ /*
2
+ * This file is part of the SDWebImage package.
3
+ * (c) Olivier Poitrey <rs@dailymotion.com>
4
+ *
5
+ * For the full copyright and license information, please view the LICENSE
6
+ * file that was distributed with this source code.
7
+ */
8
+
9
+ #import "SDWebImageCompat.h"
10
+
11
+ #if SD_MAC
12
+
13
+ /**
14
+ This category is provided to easily write cross-platform(AppKit/UIKit) code. For common usage, see `UIImage+Metadata.h`.
15
+ */
16
+ @interface NSImage (Compatibility)
17
+
18
+ /**
19
+ The underlying Core Graphics image object. This will actually use `CGImageForProposedRect` with the image size.
20
+ */
21
+ @property (nonatomic, readonly, nullable) CGImageRef CGImage;
22
+ /**
23
+ The underlying Core Image data. This will actually use `bestRepresentationForRect` with the image size to find the `NSCIImageRep`.
24
+ */
25
+ @property (nonatomic, readonly, nullable) CIImage *CIImage;
26
+ /**
27
+ The scale factor of the image. This wil actually use `bestRepresentationForRect` with image size and pixel size to calculate the scale factor. If failed, use the default value 1.0. Should be greater than or equal to 1.0.
28
+ */
29
+ @property (nonatomic, readonly) CGFloat scale;
30
+
31
+ // These are convenience methods to make AppKit's `NSImage` match UIKit's `UIImage` behavior. The scale factor should be greater than or equal to 1.0.
32
+
33
+ /**
34
+ Returns an image object with the scale factor and orientation. The representation is created from the Core Graphics image object.
35
+ @note The difference between this and `initWithCGImage:size` is that `initWithCGImage:size` will actually create a `NSCGImageSnapshotRep` representation and always use `backingScaleFactor` as scale factor. So we should avoid it and use `NSBitmapImageRep` with `initWithCGImage:` instead.
36
+ @note The difference between this and UIKit's `UIImage` equivalent method is the way to process orientation. If the provided image orientation is not equal to Up orientation, this method will firstly rotate the CGImage to the correct orientation to work compatible with `NSImageView`. However, UIKit will not actually rotate CGImage and just store it as `imageOrientation` property.
37
+
38
+ @param cgImage A Core Graphics image object
39
+ @param scale The image scale factor
40
+ @param orientation The orientation of the image data
41
+ @return The image object
42
+ */
43
+ - (nonnull instancetype)initWithCGImage:(nonnull CGImageRef)cgImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation;
44
+
45
+ /**
46
+ Initializes and returns an image object with the specified Core Image object. The representation is `NSCIImageRep`.
47
+
48
+ @param ciImage A Core Image image object
49
+ @param scale The image scale factor
50
+ @param orientation The orientation of the image data
51
+ @return The image object
52
+ */
53
+ - (nonnull instancetype)initWithCIImage:(nonnull CIImage *)ciImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation;
54
+
55
+ /**
56
+ Returns an image object with the scale factor. The representation is created from the image data.
57
+ @note The difference between these this and `initWithData:` is that `initWithData:` will always use `backingScaleFactor` as scale factor.
58
+
59
+ @param data The image data
60
+ @param scale The image scale factor
61
+ @return The image object
62
+ */
63
+ - (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale;
64
+
65
+ @end
66
+
67
+ #endif
@@ -0,0 +1,136 @@
1
+ /*
2
+ * This file is part of the SDWebImage package.
3
+ * (c) Olivier Poitrey <rs@dailymotion.com>
4
+ *
5
+ * For the full copyright and license information, please view the LICENSE
6
+ * file that was distributed with this source code.
7
+ */
8
+
9
+ #import "SDWebImageCompat.h"
10
+ #import "SDImageCoder.h"
11
+
12
+
13
+ /**
14
+ This is the protocol for SDAnimatedImage class only but not for SDAnimatedImageCoder. If you want to provide a custom animated image class with full advanced function, you can conform to this instead of the base protocol.
15
+ */
16
+ @protocol SDAnimatedImage <SDAnimatedImageProvider>
17
+
18
+ @required
19
+ /**
20
+ Initializes and returns the image object with the specified data, scale factor and possible animation decoding options.
21
+ @note We use this to create animated image instance for normal animation decoding.
22
+
23
+ @param data The data object containing the image data.
24
+ @param scale The scale factor to assume when interpreting the image data. Applying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the `size` property.
25
+ @param options A dictionary containing any animation decoding options.
26
+ @return An initialized object
27
+ */
28
+ - (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale options:(nullable SDImageCoderOptions *)options;
29
+
30
+ /**
31
+ Initializes the image with an animated coder. You can use the coder to decode the image frame later.
32
+ @note We use this with animated coder which conforms to `SDProgressiveImageCoder` for progressive animation decoding.
33
+
34
+ @param animatedCoder An animated coder which conform `SDAnimatedImageCoder` protocol
35
+ @param scale The scale factor to assume when interpreting the image data. Applying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the `size` property.
36
+ @return An initialized object
37
+ */
38
+ - (nullable instancetype)initWithAnimatedCoder:(nonnull id<SDAnimatedImageCoder>)animatedCoder scale:(CGFloat)scale;
39
+
40
+ @optional
41
+ // These methods are used for optional advanced feature, like image frame preloading.
42
+ /**
43
+ Pre-load all animated image frame into memory. Then later frame image request can directly return the frame for index without decoding.
44
+ This method may be called on background thread.
45
+
46
+ @note If one image instance is shared by lots of imageViews, the CPU performance for large animated image will drop down because the request frame index will be random (not in order) and the decoder should take extra effort to keep it re-entrant. You can use this to reduce CPU usage if need. Attention this will consume more memory usage.
47
+ */
48
+ - (void)preloadAllFrames;
49
+
50
+ /**
51
+ Unload all animated image frame from memory if are already pre-loaded. Then later frame image request need decoding. You can use this to free up the memory usage if need.
52
+ */
53
+ - (void)unloadAllFrames;
54
+
55
+ /**
56
+ Returns a Boolean value indicating whether all animated image frames are already pre-loaded into memory.
57
+ */
58
+ @property (nonatomic, assign, readonly, getter=isAllFramesLoaded) BOOL allFramesLoaded;
59
+
60
+ /**
61
+ Return the animated image coder if the image is created with `initWithAnimatedCoder:scale:` method.
62
+ @note We use this with animated coder which conforms to `SDProgressiveImageCoder` for progressive animation decoding.
63
+ */
64
+ @property (nonatomic, strong, readonly, nullable) id<SDAnimatedImageCoder> animatedCoder;
65
+
66
+ @end
67
+
68
+ /**
69
+ The image class which supports animating on `SDAnimatedImageView`. You can also use it on normal UIImageView/NSImageView.
70
+ */
71
+ NS_SWIFT_NONISOLATED
72
+ @interface SDAnimatedImage : UIImage <SDAnimatedImage>
73
+
74
+ // This class override these methods from UIImage(NSImage), and it supports NSSecureCoding.
75
+ // You should use these methods to create a new animated image. Use other methods just call super instead.
76
+ // @note Before 5.19, these initializer will return nil for static image (when all candidate SDAnimatedImageCoder returns nil instance), like JPEG data. After 5.19, these initializer will retry for static image as well, so JPEG data will return non-nil instance. For vector image(PDF/SVG), always return nil.
77
+ // @note When the animated image frame count <= 1, all the `SDAnimatedImageProvider` protocol methods will return nil or 0 value, you'd better check the frame count before usage and keep fallback.
78
+ + (nullable instancetype)imageNamed:(nonnull NSString *)name; // Cache in memory, no Asset Catalog support
79
+ #if __has_include(<UIKit/UITraitCollection.h>) && !SD_WATCH
80
+ + (nullable instancetype)imageNamed:(nonnull NSString *)name inBundle:(nullable NSBundle *)bundle compatibleWithTraitCollection:(nullable UITraitCollection *)traitCollection; // Cache in memory, no Asset Catalog support
81
+ #else
82
+ + (nullable instancetype)imageNamed:(nonnull NSString *)name inBundle:(nullable NSBundle *)bundle; // Cache in memory, no Asset Catalog support
83
+ #endif
84
+ + (nullable instancetype)imageWithContentsOfFile:(nonnull NSString *)path;
85
+ + (nullable instancetype)imageWithData:(nonnull NSData *)data;
86
+ + (nullable instancetype)imageWithData:(nonnull NSData *)data scale:(CGFloat)scale;
87
+ - (nullable instancetype)initWithContentsOfFile:(nonnull NSString *)path;
88
+ - (nullable instancetype)initWithData:(nonnull NSData *)data;
89
+ - (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale;
90
+
91
+ /**
92
+ Current animated image format.
93
+ @note This format is only valid when `animatedImageData` not nil.
94
+ @note This actually just call `[NSData sd_imageFormatForImageData:self.animatedImageData]`
95
+ */
96
+ @property (nonatomic, assign, readonly) SDImageFormat animatedImageFormat;
97
+
98
+ /**
99
+ Current animated image data, you can use this to grab the compressed format data and create another animated image instance.
100
+ If this image instance is an animated image created by using animated image coder (which means using the API listed above or using `initWithAnimatedCoder:scale:`), this property is non-nil.
101
+ */
102
+ @property (nonatomic, copy, readonly, nullable) NSData *animatedImageData;
103
+
104
+ /**
105
+ The scale factor of the image.
106
+
107
+ @note For UIKit, this just call super instead.
108
+ @note For AppKit, `NSImage` can contains multiple image representations with different scales. However, this class does not do that from the design. We process the scale like UIKit. This will actually be calculated from image size and pixel size.
109
+ */
110
+ @property (nonatomic, readonly) CGFloat scale;
111
+
112
+ // By default, animated image frames are returned by decoding just in time without keeping into memory. But you can choose to preload them into memory as well, See the description in `SDAnimatedImage` protocol.
113
+ // After preloaded, there is no huge difference on performance between this and UIImage's `animatedImageWithImages:duration:`. But UIImage's animation have some issues such like blanking and pausing during segue when using in `UIImageView`. It's recommend to use only if need.
114
+ /**
115
+ Pre-load all animated image frame into memory. Then later frame image request can directly return the frame for index without decoding.
116
+ This method may be called on background thread.
117
+
118
+ @note If one image instance is shared by lots of imageViews, the CPU performance for large animated image will drop down because the request frame index will be random (not in order) and the decoder should take extra effort to keep it re-entrant. You can use this to reduce CPU usage if need. Attention this will consume more memory usage.
119
+ */
120
+ - (void)preloadAllFrames;
121
+
122
+ /**
123
+ Unload all animated image frame from memory if are already pre-loaded. Then later frame image request need decoding. You can use this to free up the memory usage if need.
124
+ */
125
+ - (void)unloadAllFrames;
126
+ /**
127
+ Returns a Boolean value indicating whether all animated image frames are already pre-loaded into memory.
128
+ */
129
+ @property (nonatomic, assign, readonly, getter=isAllFramesLoaded) BOOL allFramesLoaded;
130
+ /**
131
+ Return the animated image coder if the image is created with `initWithAnimatedCoder:scale:` method.
132
+ @note We use this with animated coder which conforms to `SDProgressiveImageCoder` for progressive animation decoding.
133
+ */
134
+ @property (nonatomic, strong, readonly, nullable) id<SDAnimatedImageCoder> animatedCoder;
135
+
136
+ @end