REBOL/View Graphic System Reference
Describes lower-level graphical compositing and event handling system.
This is a low level technical document for programmers, developers, and engineers. It does not describe higher level user interface methods such as VID (visual interface dialect), but many parts of this document apply equally to the components used within VID.
These concepts are useful to both experts and beginners who require a deeper understanding of REBOL user interfaces of all kinds. It is recommended that you read this document carefully if you plan to build more sophisticated types of user interfaces in REBOL.
The REBOL/View engine was designed to be powerful yet minimal. Rather than build a user interface system based on static interface elements (buttons, fields, and other "widgets"), we decided to design a system for building interface systems. We engineered the system to be:
We wanted the ability to implement not only desktop user interfaces, but also rich interfaces like those used for consumer catalogs or kiosks, presentation systems such as those used for lectures or televisions programs, and even a wide variety of games.
We wanted any and all graphical objects to be able to move, resize, or modify any of their attributes at any time. This allows users to create not only standard, static, computer-style user interfaces, but also dynamic, animated, interfaces.
- Easy to use
The View graphics system adheres to the REBOL principle that simple things should be simple to do, that complex results should be possible, and that there should be a relatively smooth ramp between the two. You can create a functional user interface with almost no knowledge of the system, and you can use many parts of the graphics system without the need to understand it in its entirety.
- Minimal implementation
At the lower levels, we wanted to reduce the number of required functions and objects to an absolute minimum; and we succeeded. The primary system is implemented with only two native functions (show and hide) and a single object definition (face).
- Minimize memory
To help reduce memory consumption, we decided to recompute (regenerate) the bitmaps for all objects on the fly, as required for display. The system does not store intermediate bitmap images (unless specified by the program).
- Built-in filters
We wanted to include a broad set of built in image processing filters for creating rich, good-looking applications. These are implemented as face effects within the system, and are very easy to use.
The View graphics system is a two dimensional compositing engine. It takes a hierarchy of graphical objects and combines them in layers to create displays and interfaces.
REBOL uses a single face object for all graphics. A face can be used to show images, create buttons, generate text, detect mouse events, or group multiple faces together within a single pane. User interfaces consist of multiple faces arranged in panes. A typical application may be hundreds of faces that create its final display.
Each face object handles its own image, text, alignment, clipping, edges (borders), special effects, and event processing. In addition, a face can contain sub-faces and act as its own coordinate system.
How VID Relates to View
VID, the Visual Interface Dialect, provides an easy-to-use descriptive method of creating user interfaces. It allows programmers to concentrate more on results, and less on the programming details.
VID is really just a translator. When you create interfaces with VID, you are actually using the View graphics system indirectly. As a dialect, VID converts simple descriptive expressions into sets of faces and panes that are processed by the View graphics system.
VID is just one of many possible ways to create an interface. You can also write programs that use the View graphics system directly, bypassing VID. Or, more typically, you use a combination of both VID and the graphics system. VID creates the same face object(s) you would if you used the graphics system directly; it just reduces the amount of code you have to write for common scenarios, while still providing access to the low-level system for those times you need total control. This deep level of integration is powerful, flexible, and easy to use.
In addition, you can create your own interface dialect on top of the View graphics system. For instance, some REBOL users have created dialects that are more efficient at expressing presentations, plotting graphs, and producing games.
Most of the examples in this document have been tested and verified to work properly in REBOL/View 1.3.1 (and higher). If you are using an older version of REBOL, you should upgrade.
To try an example for yourself, cut and paste it into a text file, then add a REBOL header such as this to the top of the file:
REBOL [Title: "Example"]
Many of the examples will also work if you simply past them into REBOL at the console prompt.
If you discover an example that does not work, please let us know by clicking on the contact link above.
- Face Object
The object that controls all graphics.
- Face Hierarchy
How faces are layered and composited.
- Face Functions
The functions that make faces work.
- Face Events
How events are handled.
- Face Content
Text, images, and edges within a face.
- Face Effects
Dynamic effects on faces.
- Face Other Features
Iterated faces and special notes.
- REBOL/View VID Developer's Guide
Describes concepts and features of the VID GUI.
- Beginner's Guide to REBOL Visual Interfaces
A short, easy-to-read guide for new users (older).
- REBOL GUI How-To Articles
Text fields, custom buttons, subpanels, and more.
- REBOL Image Datatype
Many changes and new features.
- REBOL/View Draw Dialect 1.3
2D DRAW commands.
- REBOL/View Draw Dialect (older doc)
How to draw lower-level graphics such as lines, polygons, circles, etc.