function get(image, cacheKey, crossOrigin, imageState, color, pattern) {
  let iconImage =
    cacheKey === undefined
      ? undefined
      : iconImageCache.get(cacheKey, crossOrigin, color);
  if (!iconImage) {
    iconImage = new IconImage(
      image,
      image && 'src' in image ? image.src || undefined : cacheKey,
      crossOrigin,
      imageState,
      color,
    );
    iconImageCache.set(cacheKey, crossOrigin, color, iconImage, pattern);
  }
  if (
    pattern &&
    iconImage &&
    !iconImageCache.getPattern(cacheKey, crossOrigin, color)
  ) {
    iconImageCache.set(cacheKey, crossOrigin, color, iconImage, pattern);
  }
  return iconImage;
}
@param {HTMLImageElement|HTMLCanvasElement|ImageBitmap|null} image Image.
@param {string|undefined} cacheKey Src.
@param {?string} crossOrigin Cross origin.
@param {import("../ImageState.js").default|undefined} imageState Image state.
@param {import("../color.js").Color|string|null} color Color.
@param {boolean} [pattern] Also cache a `repeat` pattern with the icon image.
@return {IconImage} Icon image.