Graphic

From Bennu Wiki
Jump to navigation Jump to search


Definition

A graphic (graph or map) is a bitmap with certain properties, like width, height, depth and of course the pixel data. It is used to give the program a graphical look. One can load graphics from files with for example load_png() or use Image.DLL. They can also be obtained from within FPG's or FGC's files, which are graphic collection files. To create one on the fly, the function new_map() can be used. Here's a list of functions related to graphics and maps.

Displaying a Graphic

To display a graphic on the screen, there are two main ways of doing this:

  • Using drawing operations listed here.
  • Using processes and assigning graphics to their graph variable.

Combinations can also be used naturally.

Drawing Operations

Graphics can be drawn onto each other, by the use of various map functions. The functions use blitting as the method for drawing, which is a reasonably fast way, as Bennu makes use of MMX capabilities. A function like put() will draw a picture on the background, displaying it on the screen (if restore_type is not NO_RESTORE).

Process Graphs

Graphics can be assigned to processes, which also have coordinate and transformation data. This is done by the use of the local variables graph, which holds the GraphID of a graph. The graphic is displayed, according to a few local variables influencing the graphic, like x, y, z, angle, etc.