xref: /freebsd/stand/lua/gfx.lua.8 (revision a8f8c53761c4b0436c9d546ebe046003f1b3d88f)
1*a8f8c537SWarner Losh.\"
2*a8f8c537SWarner Losh.\" Copyright (c) 2024 Netflix, Inc.
3*a8f8c537SWarner Losh.\"
4*a8f8c537SWarner Losh.\" SPDX-License-Identifier: BSD-2-Clause
5*a8f8c537SWarner Losh.\"
6*a8f8c537SWarner Losh.Dd February 6, 2024
7*a8f8c537SWarner Losh.Dt GFX.LUA 8
8*a8f8c537SWarner Losh.Os
9*a8f8c537SWarner Losh.Sh NAME
10*a8f8c537SWarner Losh.Nm gfx.lua
11*a8f8c537SWarner Losh.Nd Fx Lua gfx module
12*a8f8c537SWarner Losh.Sh DESCRIPTION
13*a8f8c537SWarner LoshThe built-in graphics related Lua bindings for the
14*a8f8c537SWarner Losh.Fx
15*a8f8c537SWarner Loshboot loaders using the Lua interpreter are available via the
16*a8f8c537SWarner Losh.Ic gfx
17*a8f8c537SWarner Loshtable.
18*a8f8c537SWarner Losh.Ss Exported Functions
19*a8f8c537SWarner LoshThe following functions are exported in the
20*a8f8c537SWarner Losh.Nm loader
21*a8f8c537SWarner Loshtable.
22*a8f8c537SWarner Losh.Bl -tag -width term_putimage
23*a8f8c537SWarner Losh.It Fn fb_bezier x0 y0 x1 y1 x2 y2 width
24*a8f8c537SWarner LoshDraw a bezier curve through the points
25*a8f8c537SWarner Losh.Pq Va x0 , Va y0 ,
26*a8f8c537SWarner Losh.Pq Va x1 , Va y1 ,
27*a8f8c537SWarner Loshand
28*a8f8c537SWarner Losh.Pq Va x2 , Va y2
29*a8f8c537SWarner Loshof width
30*a8f8c537SWarner Losh.Va width .
31*a8f8c537SWarner LoshThe units are in pixels and have an origin of
32*a8f8c537SWarner Losh.Pq 0 , 0 .
33*a8f8c537SWarner Losh.It Fn fb_drawrect x0 y0 x1 y1 fill
34*a8f8c537SWarner LoshFill in a rectangle with the pixel
35*a8f8c537SWarner Losh.Va fill
36*a8f8c537SWarner Loshwith the corners
37*a8f8c537SWarner Losh.Pq Va x0 , Va y0
38*a8f8c537SWarner Loshand
39*a8f8c537SWarner Losh.Pq Va x1 , Va y1 .
40*a8f8c537SWarner LoshThe units are in pixels and have an origin of
41*a8f8c537SWarner Losh.Pq 0 , 0 .
42*a8f8c537SWarner Losh.It Fn fb_line x0 y0 x1 y1 width
43*a8f8c537SWarner LoshDraw a line from
44*a8f8c537SWarner Losh.Pq Va x0 , Va y0
45*a8f8c537SWarner Loshto
46*a8f8c537SWarner Losh.Pq Va x1 , Va y1
47*a8f8c537SWarner Loshwith a width of
48*a8f8c537SWarner Losh.Va width .
49*a8f8c537SWarner LoshThe units are in pixels and have an origin of
50*a8f8c537SWarner Losh.Pq 0 , 0 .
51*a8f8c537SWarner Losh.It Fn fb_putimage name x0 y0 x1 y1 f
52*a8f8c537SWarner LoshLoad the PNG file
53*a8f8c537SWarner Losh.Va name
54*a8f8c537SWarner Loshand place it in the rectangle
55*a8f8c537SWarner Loshwith the corners
56*a8f8c537SWarner Losh.Pq Va x0 , Va y0
57*a8f8c537SWarner Loshand
58*a8f8c537SWarner Losh.Pq Va x1 , Va y1
59*a8f8c537SWarner Loshand fill with pixel
60*a8f8c537SWarner Losh.Va f .
61*a8f8c537SWarner LoshThe units are in pixels and have an origin of
62*a8f8c537SWarner Losh.Pq 0 , 0 .
63*a8f8c537SWarner Losh.It Fn fb_set_pixel x y
64*a8f8c537SWarner LoshSets the pixel at
65*a8f8c537SWarner Losh.Pq Va x , Va y .
66*a8f8c537SWarner LoshThe units are in pixels and have an origin of
67*a8f8c537SWarner Losh.Pq 0 , 0 .
68*a8f8c537SWarner Losh.It Fn term_drawrect x0 y0 x1 y1
69*a8f8c537SWarner LoshDraw the outline of a rectangle with the text coordinate corners of
70*a8f8c537SWarner Losh.Pq Va x0 , Va y0
71*a8f8c537SWarner Loshand
72*a8f8c537SWarner Losh.Pq Va x1 , Va y1 .
73*a8f8c537SWarner LoshThe units are in character cells and have an origin of
74*a8f8c537SWarner Losh.Pq 1 , 1 .
75*a8f8c537SWarner Losh.It Fn term_putimage name x0 y0 x1 y1 f
76*a8f8c537SWarner LoshLoad the PNG file
77*a8f8c537SWarner Losh.Va name
78*a8f8c537SWarner Loshand place it in the rectangle
79*a8f8c537SWarner Loshwith the text coordinate corners
80*a8f8c537SWarner Losh.Pq Va x0 , Va y0
81*a8f8c537SWarner Loshand
82*a8f8c537SWarner Losh.Pq Va x1 , Va y1
83*a8f8c537SWarner Loshand fill with pixel
84*a8f8c537SWarner Losh.Va f .
85*a8f8c537SWarner LoshThe units are in character cells and have an origin of
86*a8f8c537SWarner Losh.Pq 1 , 1 .
87*a8f8c537SWarner Losh.El
88*a8f8c537SWarner Losh.Pp
89*a8f8c537SWarner LoshThis table is optional and should only be used if it is non-nil and if
90*a8f8c537SWarner Losh.Fn core.isFramebufferConsole
91*a8f8c537SWarner Loshis true.
92*a8f8c537SWarner Losh.Ss Compatibility
93*a8f8c537SWarner LoshAll the interfaces described above are also available via the
94*a8f8c537SWarner Losh.Ic loader
95*a8f8c537SWarner Loshtable through at last FreeBSD 15.0.
96*a8f8c537SWarner Losh.Sh SEE ALSO
97*a8f8c537SWarner Losh.Xr loader.conf 5 ,
98*a8f8c537SWarner Losh.Xr core.lua 8 ,
99*a8f8c537SWarner Losh.Xr loader 8 ,
100*a8f8c537SWarner Losh.Xr loader.lua 8
101*a8f8c537SWarner Losh.Sh AUTHORS
102*a8f8c537SWarner LoshThe
103*a8f8c537SWarner Losh.Nm
104*a8f8c537SWarner Loshman page was written by
105*a8f8c537SWarner Losh.An Warner Losh Aq Mt imp@FreeBSD.org .
106*a8f8c537SWarner Losh
107