本文整理汇总了TypeScript中tns-core-modules/image-source.fromNativeSource函数的典型用法代码示例。如果您正苦于以下问题:TypeScript fromNativeSource函数的具体用法?TypeScript fromNativeSource怎么用?TypeScript fromNativeSource使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fromNativeSource函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test_DummyTestForSnippetOnly
export function test_DummyTestForSnippetOnly() {
// >> image-cache-request-images
var cache = new imageCacheModule.Cache();
cache.placeholder = imageSource.fromFile(fs.path.join(__dirname, "res/no-image.png"));
cache.maxRequests = 5;
// Enable download while not scrolling
cache.enableDownload();
var imgSouce: imageSource.ImageSource;
var url = "https://github.com/NativeScript.png";
// Try to read the image from the cache
var image = cache.get(url);
if (image) {
// If present -- use it.
imgSouce = imageSource.fromNativeSource(image);
}
else {
// If not present -- request its download.
cache.push({
key: url,
url: url,
completed: (image: any, key: string) => {
if (url === key) {
imgSouce = imageSource.fromNativeSource(image);
}
}
});
}
// Disable download while scrolling
cache.disableDownload();
// << image-cache-request-images
}
示例2: _processImage
private _processImage(filter): ImageSource {
const filteredImg = filter.valueForKey(kCIOutputImageKey);
const outputCGImage = this._createOutputCGImage(filteredImg);
const outputUIImage = UIImage.imageWithCGImage(outputCGImage);
const result = fromNativeSource(outputUIImage);
return result;
}
示例3: Promise
return new Promise((resolve, reject) => {
try {
if (!img) {
reject('Image is required');
}
const bmp = this._processor.doGreyScale(this._getBitmap(img));
const isrc = fromNativeSource(bmp);
resolve(isrc);
} catch (err) {
reject(err);
}
});