fillStyleToState(
    fillStyle,
    state = /** @type {import('../canvas.js').FillStrokeState} */ ({}),
  ) {
    if (fillStyle) {
      const fillStyleColor = fillStyle.getColor();
      state.fillPatternScale =
        fillStyleColor &&
        typeof fillStyleColor === 'object' &&
        'src' in fillStyleColor
          ? this.pixelRatio
          : 1;
      state.fillStyle = asColorLike(
        fillStyleColor ? fillStyleColor : defaultFillStyle,
      );
    } else {
      state.fillStyle = undefined;
    }
    return state;
  }
@param {import("../../style/Fill.js").default} fillStyle Fill style.
@param {import('../canvas.js').FillStrokeState} [state] State.
@return {import('../canvas.js').FillStrokeState} State.