Coatings from natural macromolecules, with gas barrier properties tailored in situ, and related preparation method