本文整理匯總了TypeScript中vs/editor/test/common/view/minimapCharRendererFactory.MinimapCharRendererFactory.create方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript MinimapCharRendererFactory.create方法的具體用法?TypeScript MinimapCharRendererFactory.create怎麽用?TypeScript MinimapCharRendererFactory.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/editor/test/common/view/minimapCharRendererFactory.MinimapCharRendererFactory
的用法示例。
在下文中一共展示了MinimapCharRendererFactory.create方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test('letter d @ 2x', () => {
setSampleData('d'.charCodeAt(0), sampleD);
let renderer = MinimapCharRendererFactory.create(sampleData);
let background = new RGBA8(0, 0, 0, 255);
let color = new RGBA8(255, 255, 255, 255);
let imageData = createFakeImageData(Constants.x2_CHAR_WIDTH, Constants.x2_CHAR_HEIGHT);
// set the background color
for (let i = 0, len = imageData.data.length / 4; i < len; i++) {
imageData.data[4 * i + 0] = background.r;
imageData.data[4 * i + 1] = background.g;
imageData.data[4 * i + 2] = background.b;
imageData.data[4 * i + 3] = 255;
}
renderer.x2RenderChar(imageData, 0, 0, 'd'.charCodeAt(0), color, background, false);
let actual: number[] = [];
for (let i = 0; i < imageData.data.length; i++) {
actual[i] = imageData.data[i];
}
assert.deepEqual(actual, [
0x00, 0x00, 0x00, 0xff, 0x6d, 0x6d, 0x6d, 0xff,
0xbb, 0xbb, 0xbb, 0xff, 0xbe, 0xbe, 0xbe, 0xff,
0x94, 0x94, 0x94, 0xff, 0x7e, 0x7e, 0x7e, 0xff,
0xb1, 0xb1, 0xb1, 0xff, 0xbb, 0xbb, 0xbb, 0xff,
]);
});
示例2: test
test('letter d @ 1x', () => {
setSampleData('d'.charCodeAt(0), sampleD);
let renderer = MinimapCharRendererFactory.create(sampleData);
let dest = new Uint8ClampedArray(Constants.x1_CHAR_HEIGHT * Constants.x1_CHAR_WIDTH * Constants.RGBA_CHANNELS_CNT);
renderer.x1RenderChar(dest, 1, 0, 0, 'd'.charCodeAt(0));
let actual: number[] = [];
for (let i = 0; i < dest.length; i++) {
actual[i] = dest[i];
}
assert.deepEqual(actual, [
0xad, 0xad, 0xad, 0x7d,
0xeb, 0xeb, 0xeb, 0x9f,
]);
});