INNER CODE UNIT · TypeScript

v

margelo/react-native-blurhash · src/utils.ts:19

	const v = value / 255;
	if (v <= 0.04045) return v / 12.92;
	else return Math.pow((v + 0.055) / 1.055, 2.4);
}

export function decodeDC(value: number): RGB {
	const intR = value >> 16;
	const intG = (value >> 8) & 255;
	const intB = value & 255;
	return { r: sRGBToLinear(intR) * 255, g: sRGBToLinear(intG) * 255, b: sRGBToLinear(intB) * 255 };
}

export function decode83(str: string): number {
	let value = 0;
	for (let i = 0; i < str.length; i++) {
		const c = str[i];
		const digit = digitCharacters.indexOf(c);
		value = value * 83 + digit;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…