本文整理汇总了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,
]);
});