Generation and measurement of complex fields using stress-engineered optics