本文整理匯總了TypeScript中tns-core-modules/image-source.fromBase64函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript fromBase64函數的具體用法?TypeScript fromBase64怎麽用?TypeScript fromBase64使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了fromBase64函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: testLoadFromBase64Encode_PNG
export function testLoadFromBase64Encode_PNG() {
let img: imageSource.ImageSource;
if (app.android) {
img = imageSource.fromBase64(fullAndroidPng);
} else if (app.ios) {
img = imageSource.fromBase64(fullIosPng);
}
TKUnit.assert(img !== null, "Actual: " + img);
TKUnit.assertEqual(img.width, 4, "img.width");
TKUnit.assertEqual(img.height, 4, "img.height");
}
示例2: testLoadFromBase64Encode_JPEG
export function testLoadFromBase64Encode_JPEG() {
let img: imageSource.ImageSource;
img = imageSource.fromBase64(fullJpegImage);
TKUnit.assert(img !== null, "Actual: " + img);
TKUnit.assertEqual(img.width, 4, "img.width");
TKUnit.assertEqual(img.height, 4, "img.height");
}
示例3: testLoadFromBase64Encode_PNG
export function testLoadFromBase64Encode_PNG() {
var img: imageSource.ImageSource;
if (app.android) {
img = imageSource.fromBase64(expectedAndroidPng);
} else if (app.ios) {
if (platform.device.osVersion[0] === '7') {
img = imageSource.fromBase64(expectedIos7Png);
}
else {
img = imageSource.fromBase64(expectedIos8Png);
}
}
TKUnit.assert(img !== null, "Actual: " + img);
TKUnit.assertEqual(img.width, 4, "img.width");
TKUnit.assertEqual(img.height, 4, "img.height");
}
示例4: testLoadFromBase64Encode_JPEG
export function testLoadFromBase64Encode_JPEG() {
// >> imagesource-from-base-string
let img: imageSource.ImageSource;
img = imageSource.fromBase64(jpgImageAsBase64String);
// << imagesource-from-base-string
TKUnit.assert(img !== null, "Actual: " + img);
TKUnit.assertEqual(img.width, 4, "img.width");
TKUnit.assertEqual(img.height, 4, "img.height");
}