/**
  * Creates a new data sink for the specified set of pixels.
  *
  * @param pixels The pixels set the data sink is for.
  * @return See above.
  */
 public static DataSink createDataSink(PixelsData pixels) {
   if (pixels == null) throw new IllegalArgumentException("Pixels cannot be null.");
   if (singleton.pixelsSource != null && singleton.pixelsSource.isSame(pixels.getId()))
     return singleton.pixelsSource;
   registry.getCacheService().clearAllCaches();
   int size = getCacheSize();
   if (size <= 0) size = 0;
   singleton.pixelsSource = DataSink.makeNew(pixels, registry, size);
   return singleton.pixelsSource;
 }