Skip to content

Commit bfa31f7

Browse files
rodrigobasilio2022finetjul
authored andcommitted
fix(Colors): fix UInt8Clamped array color definition
1 parent 3b712c4 commit bfa31f7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Sources/Common/Core/DataArray/Constants.js

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const VtkDataTypes = {
1515
CHAR: 'Int8Array',
1616
SIGNED_CHAR: 'Int8Array',
1717
UNSIGNED_CHAR: 'Uint8Array',
18+
UNSIGNED_CHAR_CLAMPED: 'Uint8ClampedArray', // should be used for VTK.js internal purpose only
1819
SHORT: 'Int16Array',
1920
UNSIGNED_SHORT: 'Uint16Array',
2021
INT: 'Int32Array',

Sources/Common/Core/ScalarsToColors/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ function vtkScalarsToColors(publicAPI, model) {
206206
// map scalars through lookup table only if needed
207207
if (
208208
(colorMode === ColorMode.DEFAULT &&
209-
scalars.getDataType() === VtkDataTypes.UNSIGNED_CHAR) ||
209+
(scalars.getDataType() === VtkDataTypes.UNSIGNED_CHAR ||
210+
scalars.getDataType() === VtkDataTypes.UNSIGNED_CHAR_CLAMPED)) ||
210211
(colorMode === ColorMode.DIRECT_SCALARS && scalars)
211212
) {
212213
newColors = publicAPI.convertToRGBA(

0 commit comments

Comments
 (0)