I am very new to this colour space conversion stuff,
and I dont even know if I have the right approach.
Your approach is fine and correct. You're doing a simple mistake of scaling down (the r/g/b values) but then later you don't scale them up for usage in the imgOut
part.
Using (r/255)
scales it down (or will "normalize" it) from being a value in 0 to 255 range, into now being a value in a 0 to 1 range.
Re-scale it up, into being within 0-255 range like this:
imgOut.pixels[index + 0] = ( 255 * computedC );
imgOut.pixels[index + 1] = ( 255 * computedM );
imgOut.pixels[index + 2] = ( 255 * computedY );
imgOut.pixels[index + 3] = 125;
If the new imgOut
colours are not exact:
Then try something like: Math.round( 255 * computedC );
Round down using: imgOut.pixels[index + 0] = Math.floor( 255 * computedC );
Round up using :imgOut.pixels[index + 0] = Math.ceil( 255 * computedC );
Now do you see multiple colours instead of just black?