Absorption and emission properties of photonic crystals and metamaterials