Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 20x 20x 20x 20x 7808000x 7808000x 7808000x 7808000x 20x | import type { Types } from '@cornerstonejs/core'; /** * Removes the A from RGBA to return RGB buffer, this is used when the * decoding happens with browser API which results in RGBA, but if useRGBA flag * is set to false, we want to return RGB * * @param pixelData - decoded image in RGBA * @param targetBuffer - target buffer to write to */ function removeAFromRGBA( pixelData: Types.PixelDataTypedArray, targetBuffer: Uint8ClampedArray | Uint8Array ) { const numPixels = pixelData.length / 4; let rgbIndex = 0; let bufferIndex = 0; for (let i = 0; i < numPixels; i++) { targetBuffer[bufferIndex++] = pixelData[rgbIndex++]; // red targetBuffer[bufferIndex++] = pixelData[rgbIndex++]; // green targetBuffer[bufferIndex++] = pixelData[rgbIndex++]; // blue rgbIndex++; // skip alpha } return targetBuffer; } export default removeAFromRGBA; |