canvas how to know the state of a pixel