本文整理汇总了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
}
开发者ID:NathanWalker,项目名称:NativeScript,代码行数:34,代码来源:image-cache-tests.ts
示例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;
}
开发者ID:bradmartin,项目名称:nativescript-image-filters,代码行数:7,代码来源:imagefilters.ios.ts
示例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);
}
});
开发者ID:bradmartin,项目名称:nativescript-image-filters,代码行数:13,代码来源:imagefilters.android.ts
注:本文中的tns-core-modules/image-source.fromNativeSource函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论