I have loaded an image of a color wheel on to a canvas and I have a list of hue values in an array. I loop over each pixel on the canvas and remove the pixels that match the same hue values.
The code for that is:
var element = document.getElementById("wheel-canvas");
var c = element.getContext("2d");
var image = c.getImageData(0, 0, 375, 375);
var imageData = image.data;
paletteList = this.collection.pluck('hsv');
for (var i = 0, n = imageData.length; i < n; i += 4) {
var hsv = this.model.convertRGBToHSV(imageData[i], imageData[i+1], imageData[i+2]);
var hue = hsv[0];
var sat = hsv[1];
var val = hsv[2];
$.each(paletteList, function(index, value) {
if (hue === value[0])
{
imageData[i] = '0';
imageData[i+1] = '0';
imageData[i+2] = '0';
}
});
}
c.putImageData(image, 0, 0);
Now I want all pixels that DON'T match the hues to become black. I make a code change:
if (hue !== value[0])
and I get the following result:
Why doesn't it look like the inverse of the first circle?
Thank you!