Home Contents | # gfx.new | Graphics | Core4 Lua Commands

## SYNOPSIS

gcx = gfx.new(width, height, bpp)

## DESCRIPTION

Creates a new graphics buffer of width x height pixels. Each pixel uses bpp bits. Possible values for bpp are 1, 2, 4, 8, 16, 24 and 32.

## RETURN VALUE

A graphics context handle.

## NOTES

When working with a display framebuffer, it is better to use gcx:pixmap() instead of gfx.new(). gcx:pixmap() uses an internal storage format that matches the parent pixmap and can therefore use faster, more efficient algorithms.

gfx.new() on the other hand is useful when working with other graphics devices, like when preparing an image for a printer.

## EXAMPLE

>
gcx = gfx.new(320, 240, 24)

## SEE ALSO

gcx:close, gcx:load, gcx:pixmap, gcx:window, gfx.open