A High-Resolution CMOS Single-Photon-Counting Spectrographic X-Ray Imager