Home  Contents

Introduction

Graphics Core4 Lua Commands

DESCRIPTION

The gfx library deals with the framebuffer and bitmap graphics. Graphics are handled with a graphics context, that stores the actual bitmap, colors and an associated font. Animations can be played with an animation player instance.

Colors

All color values are specified as ARGB, a 32 bit value with the top 8 bits specifying an alpha channel, the next 8 bits giving the red, then the green and the lowest eight bits the blue value (0xAARRGGBB):

31 .. 24 23 .. 16 15 .. 8 7 .. 0
Alpha Red Green Blue

When updating a pixel, Alpha = 0 means fully opaque, the RGB value written as is, Alpha = 255 means transparent, the pixel is not changed.

Note: Alpha channel support is not yet complete or fully performant. Blitting can do alpha blending, but this is currently a naive implementation iterating over all pixels if alpha is neither 0 nor 255.

Image files

Currently, the file formats BMP, PNG and GIF can be loaded. There is no support for writing a graphics file. The alpha channel of a PNG file is properly handled on load. GIF animations are supported.

(For sake of compatibility, the old Teratronik proprietary format TTI used by ticket printers can also be read.)

Fonts

Fonts are loaded from files using the Core4 specific .lfn bitmap format. A converter and design software for Windows and Linux is available from Teratronik. Methods working on font instances as returned by gfx.font.

SEE ALSO