Energy loss by resonance line photons in an absorbing medium