code: public void paintShading(PdfShading shading) {
          writer.addSimpleShading(shading);
          PageResources prs = getPageResources();
          PdfName name = prs.addShading(shading.getShadingName(), shading.getShadingReference());
          content.append(name.getBytes()).append(" sh").append_i(separator);
          ColorDetails details = shading.getColorDetails();
          if (details != null)
              prs.addColor(details.getColorName(), details.getIndirectReference());
      }
docs: Paints using a shading object.
  @param shading the shading object