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


TypeScript minimapCharRendererFactory.MinimapCharRendererFactory類代碼示例

本文整理匯總了TypeScript中vs/editor/test/common/view/minimapCharRendererFactory.MinimapCharRendererFactory的典型用法代碼示例。如果您正苦於以下問題:TypeScript MinimapCharRendererFactory類的具體用法?TypeScript MinimapCharRendererFactory怎麽用?TypeScript MinimapCharRendererFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了MinimapCharRendererFactory類的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,
		]);
	});
開發者ID:KTXSoftware,項目名稱:KodeStudio,代碼行數:27,代碼來源:minimapCharRenderer.test.ts

示例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,
		]);
	});
開發者ID:diarmaidm,項目名稱:vscode,代碼行數:16,代碼來源:minimapCharRenderer.test.ts


注:本文中的vs/editor/test/common/view/minimapCharRendererFactory.MinimapCharRendererFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。