當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript image-source.fromNativeSource函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。