function colorRangeToFlatArray(colorRange, ArrayType, defaultValue) {
  if (Number.isFinite(colorRange[0])) {
    // its already a flat array.
    return colorRange;
  }
  const flatArray = new ArrayType(colorRange.length * 4);
  colorRange.forEach((color, index) => {
    const flatArrayIdnex = index * 4;
    flatArray[flatArrayIdnex] = color[0];
    flatArray[flatArrayIdnex + 1] = color[1];
    flatArray[flatArrayIdnex + 2] = color[2];
    flatArray[flatArrayIdnex + 3] = Number.isFinite(color[3]) ? color[3] : defaultValue;
  });
  return flatArray;
}
// Converts a colorRange array to a flat array with 4 components per color
Converts a colorRange array to a flat array with 4 components per color
Converts a colorRange array to a flat array with 4 components per color
function colorRangeToFlatArray(colorRange, ArrayType, defaultValue) {
  if (Number.isFinite(colorRange[0])) {
    return colorRange;
  }
  const flatArray = new ArrayType(colorRange.length * 4);
  colorRange.forEach((color, index) => {
    const flatArrayIdnex = index * 4;
    flatArray[flatArrayIdnex] = color[0];
    flatArray[flatArrayIdnex + 1] = color[1];
    flatArray[flatArrayIdnex + 2] = color[2];
    flatArray[flatArrayIdnex + 3] = Number.isFinite(color[3]) ? color[3] : defaultValue;
  });
  return flatArray;
}
function colorRangeToFlatArray ( colorRange , ArrayType , defaultValue ) { if ( Number . isFinite ( colorRange [ 0 ] ) ) { return colorRange ; } const flatArray = new ArrayType ( colorRange . length * 4 ) ; colorRange . forEach ( ( color , index ) => { const flatArrayIdnex = index * 4 ; flatArray [ flatArrayIdnex ] = color [ 0 ] ; flatArray [ flatArrayIdnex + 1 ] = color [ 1 ] ; flatArray [ flatArrayIdnex + 2 ] = color [ 2 ] ; flatArray [ flatArrayIdnex + 3 ] = Number . isFinite ( color [ 3 ] ) ? color [ 3 ] : defaultValue ; } ) ; return flatArray ; }
Converts a colorRange array to a flat array with 4 components per color
Converts a colorRange array to a flat array with 4 components per color
// its already a flat array.