Function

HarfBuzz-0.0HarfBuzzdraw_rectangleSince 14.2.0

  • Emits an axis-aligned rectangle. If stroke_width is a finite positive value, the rectangle is rendered as an outlined ring of that thickness centered on the edges; if stroke_width is NaN, the rectangle is rendered filled.

    Note: stroked rectangles produce a bounding box covering the full outer rectangle, so if the pen is a GPU fragment-shader backend, the shader runs for every interior pixel even though only the outline contributes coverage. For very thin outlines where the interior is much larger than the stroke, emitting four hb_draw_line() segments (one per edge) is considerably cheaper per frame.

    Parameters

    • dfuncs: draw_funcs_t

      draw functions

    • draw_data: null

      associated draw data passed by the caller

    • st: draw_state_t

      current draw state

    • x: number

      top-left X coordinate

    • y: number

      top-left Y coordinate

    • w: number

      width (may be negative)

    • h: number

      height (may be negative)

    • stroke_width: number

      stroke width, or NaN for a filled rectangle

    Returns void

    14.2.0