本文整理匯總了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);
}
});