replayImageOrLabel_(
    context,
    scaledCanvasSize,
    imageOrLabel,
    dimensions,
    opacity,
    fillInstruction,
    strokeInstruction,
  ) {
    const fillStroke = !!(fillInstruction || strokeInstruction);

    const box = dimensions.declutterBox;
    const strokePadding = strokeInstruction
      ? (strokeInstruction[2] * dimensions.scale[0]) / 2
      : 0;
    const intersects =
      box.minX - strokePadding <= scaledCanvasSize[0] &&
      box.maxX + strokePadding >= 0 &&
      box.minY - strokePadding <= scaledCanvasSize[1] &&
      box.maxY + strokePadding >= 0;

    if (intersects) {
      if (fillStroke) {
        this.replayTextBackground_(
          context,
          p1,
          p2,
          p3,
          p4,
          /** @type {Array<*>} */ (fillInstruction),
          /** @type {Array<*>} */ (strokeInstruction),
        );
      }
      drawImageOrLabel(
        context,
        dimensions.canvasTransform,
        opacity,
        imageOrLabel,
        dimensions.originX,
        dimensions.originY,
        dimensions.drawImageW,
        dimensions.drawImageH,
        dimensions.drawImageX,
        dimensions.drawImageY,
        dimensions.scale,
      );
    }
    return true;
  }
@private
@param {CanvasRenderingContext2D} context Context.
@param {import('../../size.js').Size} scaledCanvasSize Scaled canvas size.
@param {import("../canvas.js").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} imageOrLabel Image.
@param {ImageOrLabelDimensions} dimensions Dimensions.
@param {number} opacity Opacity.
@param {Array<*>} fillInstruction Fill instruction.
@param {Array<*>} strokeInstruction Stroke instruction.
@return {boolean} The image or label was rendered.