Scattering of emitted radiation from inhomogeneous and nonisothermal layers