I would like to change the pixels of an HTML5 canvas value to hsl . It can be any hsl value chosen by the user.
I can get canvas imageData using var imageData = canvas.getImageData(0, 0, 200, 200);
But the imageData.data array contains the values ββin rgba . In fact, every value in the array is a byte, so -
data[0] = r, data[1] = b, data[2] = g, data[3] = a, data[4] = r, data[5] = b, data[6] = g, data[7] = a etc.
Is there an api that can be used to control imageData? api , which would abstract the raw data so that - data[0] = rgba, data[1] = rgba , etc.?
And this can have methods such as - data[0].setValueHSL(60, 100%, 50%);
If this api does not exist, is there a class that can create / represent the hsl value and which can convert the value to rgb?
source share