Skip to documentation
DocumentationAll documentsEnglish

FBLINE(1)

NAME

fbline - draw a colored line on a framebuffer

On this page

SYNOPSIS

fbline [-c] [-F framebuffer] [-s squaresize] [-w width] [-n height]
       [-r red] [-g green] [-b blue] x1 y1 x2 y2

DESCRIPTION

fbline draws a single line on the currently selected framebuffer between the points (x1, y1) and (x2, y2) using a Bresenham line algorithm. Endpoints that fall outside the framebuffer are clamped to the screen edges. Coordinates are given in framebuffer pixels with the origin at the lower-left corner.

The environment variable FB_FILE specifies the framebuffer to use; see brlcad(1). The framebuffer may instead be named explicitly with the -F option. By default the requested framebuffer size is 512x512 pixels and the line color is white (255, 255, 255).

Use fbpoint(1) to interactively determine endpoint coordinates.

OPTIONS

-c

Clear the framebuffer before drawing. By default the line is drawn over the existing image.

-F framebuffer

Explicitly specify the framebuffer device.

-s squaresize

Set both the width and height of the framebuffer to squaresize pixels. Also available as -S.

-w width

Set the framebuffer width in pixels. Also available as -W.

-n height

Set the framebuffer height in pixels. Also available as -N.

-r red

Red component [0..255] of the line color (default 255).

-g green

Green component [0..255] of the line color (default 255).

-b blue

Blue component [0..255] of the line color (default 255).

-h

Print a usage message and exit. Also available as -?.

EXAMPLES

Example 1. Draw crosshairs over an image on the framebuffer
pix-fb -s 512 image.pix
fbline -r 255 -g 0 -b 0 256 0 256 511
fbline -r 255 -g 0 -b 0 0 256 511 256

Display a 512x512 image with pix-fb(1), then overlay a red vertical and a red horizontal line through the center to mark the image center. Because fbline draws over the existing image without clearing it, successive invocations accumulate on the same framebuffer.

SEE ALSO

brlcad(1), fblabel(1), fbpoint(1), pix-fb(1), plot3-fb(1), pix(5)

AUTHOR

BRL-CAD Team

This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org