I need to rewrite a short utility library, to get it working with the Brave browser (My actual question isn't about brave per se.)

canvas-color-tracker - example of it being used and src/index.js is short

The HTML canvas is used for mouse over and clicks to determine what object is under the cursor.

To use it with circles, you register your circle to get a color, then draw the circle in that color. Then to determine what is under the cursor, you get the color with getImageData.

The trouble is what to do about anti-aliasing, the browser doesn't allow that to be turned off, and I want to be able to return nothing rather than collide with another uninvolved circle when it's edges blend into another color)

Assuming the anti-aliasing blends linearly How to create an ordering of points in 8bit RGB space, such that the minimum number of points are colinear without knowing the final total number of points? What is a reasonable heuristic for this?

Addendum, I am doing this because Brave will choose a color channel at random and randomly vary the lowest bit of it - bit fiddling as a privacy feature prevent fingerprinting.

I figure that if I improve on the algorithm as well as drop the lowest bits for Brave, the maintainer will be happy to use my version (or I will just use my fork anyway)



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.