Skip to content

Commit

Permalink
keep RGBAtoInt as internal
Browse files Browse the repository at this point in the history
  • Loading branch information
AjayThorve committed Mar 1, 2022
1 parent 1f3192f commit 096b4e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion modules/deck.gl/src/utils/series-color-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function RGBASeriestoIntSeries(r: Series<IndexType>|number,
* @param rgba array of rgba value (a value is optional, default is 255)
* @returns rgba 32 bit signed integer value
*/
export function RGBAtoInt(rgba: number[]): number {
function RGBAtoInt(rgba: number[]): number {
rgba.forEach((value) => {
if (value < 0 || value > 255) { throw new RangeError('rgba values expected within [0,255]'); }
});
Expand Down
9 changes: 1 addition & 8 deletions modules/deck.gl/test/deckgl-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,9 @@
// limitations under the License.

import {Series, Uint32, Uint8} from '@rapidsai/cudf';
import {mapValuesToColorSeries, RGBASeriestoIntSeries, RGBAtoInt} from '@rapidsai/deck.gl';
import {mapValuesToColorSeries, RGBASeriestoIntSeries} from '@rapidsai/deck.gl';

describe('DeckGL-color-utils', () => {
test('test RGBAtoInt', () => {
expect(RGBAtoInt([255, 255, 255, 255])).toEqual(4294967295);
expect(RGBAtoInt([167, 0, 125, 0])).toEqual(2801827072);
expect(RGBAtoInt([123, 123, 123, 125])).toEqual(2071690109);
expect(() => {RGBAtoInt([123, 123, 256, 125])}).toThrow(RangeError);
});

test('test RGBASeriesToIntSeries', () => {
const r = Series.new({type: new Uint32, data: [255, 167, 123]});
const g = Series.new({type: new Uint32, data: [255, 0, 123]});
Expand Down

0 comments on commit 096b4e1

Please sign in to comment.