Laterally-varying polarizers have found application in a variety of fields including material processing, tight focusing, polarimetry, particle trapping, particle acceleration and development of optical computers. However, with conventional polarizers, the transmission axes vary laterally in a discontinuous manner degrading the optical efficiency of the polarizer. This invention uses computer-generated space-variant subwavelength dielectric metal wire gratings for the formation of radially and azimuthally polarized light from a polarizer whose transmission axis varies laterally in a truly continuous manner. By correctly determining the direction, period and depth of the grating, any desired continuous polarization can be obtained.