(source: string)
| 202 | return uiImage ? new ImageSource(uiImage) : null; |
| 203 | } |
| 204 | static fromBase64(source: string): Promise<ImageSource> { |
| 205 | return new Promise<ImageSource>((resolve, reject) => { |
| 206 | try { |
| 207 | const data = NSData.alloc().initWithBase64EncodedStringOptions(source, NSDataBase64DecodingOptions.IgnoreUnknownCharacters); |
| 208 | const main_queue = dispatch_get_current_queue(); |
| 209 | const background_queue = dispatch_get_global_queue(qos_class_t.QOS_CLASS_DEFAULT, 0); |
| 210 | dispatch_async(background_queue, () => { |
| 211 | const uiImage = UIImage.imageWithData(data); |
| 212 | dispatch_async(main_queue, () => { |
| 213 | resolve(new ImageSource(uiImage)); |
| 214 | }); |
| 215 | }); |
| 216 | } catch (ex) { |
| 217 | reject(ex); |
| 218 | } |
| 219 | }); |
| 220 | } |
| 221 | |
| 222 | static fromFontIconCodeSync(source: string, font: Font, color: Color): ImageSource { |
| 223 | font = font || Font.default; |
no test coverage detected