REBOL 3.0

Update on Graphics in Host-Kit

Carl Sassenrath, CTO
REBOL Technologies
2-Jul-2010 18:52 GMT

Article #0324
Main page || Index || Prior Article [0323] || Next Article [0325] || 10 Comments || Send feedback

Here's a quick update on the status of graphics in the Host-Kit.

  • The window management and window-event handling code has been exported to the Host-Kit. You will find this C code to be crisp and clean (and ready to be ported to OX X, Linux, and what-have-you.)
  • A new boot extension module (in the Host-Kit) has been added to the initialization in the main program. This module contains the native graphics functions as command functions (externalized native functions.)
  • The graphics related mezzanine functions have also been exported to this boot module, for example VIEW and UNVIEW. So, everything is together now in the open source side of the system, allowing simultaneous changes and eliminating dependencies.
  • A small script has been created that bundles the commands and mezzanines into a single module that is given a module header and converted to a C-code string for boot extension processing.
  • DRAW commands (e.g. box, circle, etc.) are processed by the command block evaluator (currently called DO-COMMANDS). This evaluator is accessible from both REBOL code and C code.
  • For each GOB (graphical object) the graphics compositor calls the command block evaluator with the GOB's DRAW block, which calls back into the deeper graphics library (currently AGG) function base, for example, to add a rectangle to the graphics rendering stack. The C-based Reb_Do_Commands accepts a data reference pointer to make it possible to recurse in this way over different GOBs, nested as needed.
  • A few of the basic DRAW commands have been converted for testing purposes.

Some simple test scripts are now running to show that the graphics compositing is working as desired. An important milestone.

Example drawing:

which was created by this code:

view/no-wait main: make gob! [color: black offset: 0x0 size: 500x500]
repeat n 32 [
    sz: random 100x100
    append main make gob! reduce/no-set [
        draw: reduce [
            'pen random 255.255.255 
            'fill-pen random 255.255.255.255
            'circle sz sz/x * 95% sz/y * 95%
        ]
        offset: random 300x300
        size: sz * 2
    ]
]
show main
wait 1

The next steps in the project will involve working with Cyphre (Richard) to add back all remaining DRAW commands.

There are a few other tasks, minor I hope, to get the open graphics system ready for merging with other on-going GUI developments. For example, we'll want to support the translation of DELECT dialects (unordered optional argument call sequences) into command block sequences.

10 Comments

REBOL 3.0
Updated 20-Dec-2024 - Edit - Copyright REBOL Technologies - REBOL.net