docs: public static int registerImage(RenderedImage img) {
      synchronized(images) {
        int key = counter;
        counter++;
        assert (images.get(key) == null);
        images.put(key, new SoftReference<>(img));
        // Reorganize map, purge old entries
        if(counter % 50 == 49) {
          for(Iterator<SoftReference<RenderedImage>> iter = images.values().iterator(); iter.hasNext();) {
            SoftReference<RenderedImage> ref = iter.next();
            if(ref == null || ref.get() == null) {
              iter.remove();
            }
          }
        }
        if(LOG.isDebuggingFiner()) {
          LOG.debugFiner("Registered image: " + key);
        }
        return key;
      }
    }