---
name: "gfx.lua"
section: "8"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/gfx.lua"
---

# gfx.lua(8)

bootloader graphics module

## NAME

**gfx.lua** – bootloader graphics module

## DESCRIPTION

The built-in graphics related Lua bindings for the FreeBSD boot loaders using the Lua interpreter are available via the **gfx** table.

### Exported Functions

The following functions are exported in the **loader** table.

- **fb\_bezier**(*x0*, *y0*, *x1*, *y1*, *x2*, *y2*, *width*)

  Draw a bezier curve through the points (*x0*, *y0*), (*x1*, *y1*), and (*x2*, *y2*) of width *width*. The units are in pixels and have an origin of (0, 0).

- **fb\_drawrect**(*x0*, *y0*, *x1*, *y1*, *fill*)

  Fill in a rectangle with the pixel *fill* with the corners (*x0*, *y0*) and (*x1*, *y1*). The units are in pixels and have an origin of (0, 0).

- **fb\_line**(*x0*, *y0*, *x1*, *y1*, *width*)

  Draw a line from (*x0*, *y0*) to (*x1*, *y1*) with a width of *width*. The units are in pixels and have an origin of (0, 0).

- **fb\_putimage**(*name*, *x0*, *y0*, *x1*, *y1*, *f*)

  Load the PNG file *name* and place it in the rectangle with the corners (*x0*, *y0*) and (*x1*, *y1*) and fill with pixel *f*. The units are in pixels and have an origin of (0, 0).

- **fb\_set\_pixel**(*x*, *y*)

  Sets the pixel at (*x*, *y*). The units are in pixels and have an origin of (0, 0).

- **term\_drawrect**(*x0*, *y0*, *x1*, *y1*)

  Draw the outline of a rectangle with the text coordinate corners of (*x0*, *y0*) and (*x1*, *y1*). The units are in character cells and have an origin of (1, 1).

- **term\_putimage**(*name*, *x0*, *y0*, *x1*, *y1*, *f*)

  Load the PNG file *name* and place it in the rectangle with the text coordinate corners (*x0*, *y0*) and (*x1*, *y1*) and fill with pixel *f*. The units are in character cells and have an origin of (1, 1).

This table is optional and should only be used if it is non-nil and if **core.isFramebufferConsole**() is true.

### Compatibility

All the interfaces described above are also available via the **loader** table through at last FreeBSD 15.0.

## SEE ALSO

[loader.conf(5)](/loader.conf/5.md), [core.lua(8)](/core.lua/8.md), [loader(8)](/loader/8.md), [loader.lua(8)](/loader.lua/8.md)

## AUTHORS

The **gfx.lua** man page was written by Warner Losh ⟨*imp@FreeBSD.org*⟩.
