Fill in the rest of the pixel selection logic.